GNU bug report logs -
#71639
[PATCH WIP 0/5] Improve on restic-backup-service
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi Richard,
On 6/27/24 05:56, Richard Sent wrote:
> I'll take a look at it and see what the code looks like. It might be a
> bit of effort to get that working cleanly while avoiding code dupe. For
> instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup
> program actions.
Yes, 100% agree. What I would do is (and probably there is a better way):
- rename restic-backup-job-program to restic-action-job-program or
something similar. the procedure would be the same but it would take two
additional arguments: an action-name argument or similar that would
replace all instances of "backup" and I think this new procedure should
not access the files field of the job record but it instead it would
take an action-arguments argument which would replace #$@files with
#$@action-arguments in the execlp call. This way, I hope, it could be
general enough to support additional actions besides init in the future,
such as purge or restore.
- create a new restic-backup-job-program and a restic-init-job-program
or similar procedures that would call the new generic
restic-action-job-program
- inside the restic-guix procedure I'd rename the programs list to
backup-programs and I would create a similar list for the init action
with #f placeholders for jobs that do not require initializing, and I
would check the conditional inside the backup procedure something like:
(define (get-program name programs)
[...])
(define (init args)
[...])
(define (backup args)
(define name (third args))
(define backup-program (get-program name backup-programs))
(define init-program (get-program name init-programs))
(when init-program
(init args))
(execlp backup-program backup-program))
this requires the init action not to exec the script resulting from the
gexp but I can't think of a reason why it could be problematic right now
so I guess it is ok.
Please take all of the above as a proposal there are for sure things to
make better.
> Thanks for the feedback!
Thank you very much for your work,
giacomo
[Message part 2 (text/html, inline)]
This bug report was last modified 175 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.