Skip to content

mxproxmox: add check pbackup #286

Merged
merged 7 commits into from
Dec 8, 2022
Merged

mxproxmox: add check pbackup #286

merged 7 commits into from
Dec 8, 2022

Conversation

donald
Copy link
Collaborator

@donald donald commented Dec 7, 2022

Add command to assist in adding scientific projects to the backup job list of mxproxmox (/etc/mxproxmox/backup-list.dat).

We want to add a command which doesn't need to run with privileges to
read the credential file. Initialization of the ua needs to read the
credential file. Factor out the code to initialize the ua so that we can
make that optional on a per-command basis.
@donald donald force-pushed the mxproxmox-add-check-pbackup branch 2 times, most recently from ca75d1a to 24ee883 Compare December 7, 2022 08:17
Add new command `check-pbackup`, which makes suggestions, what jobs to
add to /etc/mxproxmox/backup-list.dat based on pbackup configuration.

The output consists of out-commented lines which can be added to
/etc/mxproxmox/backup-list.dat and uncommented one by one to phase in
new proxmox backup jobs.
@donald donald force-pushed the mxproxmox-add-check-pbackup branch from 24ee883 to 1b5f675 Compare December 7, 2022 10:28
Remove trailing whitespace from lines read from backup-list.

If we keep trailing whitespace, the following split will keep the
whitespace in $opt_limit. This is later checked with `if
defined($limit)` , which is true. Still, the empty string will evaluate
numerically to zero (with a warning). A limit zero is not what we want
here.

From `perldoc -f split`:

    When assigning to a list, if LIMIT is omitted, or zero, Perl supplies a
    LIMIT one larger than the number of variables in the list, to avoid
    unnecessary work

This has this surprising effect:

      DB<1> x split " ","a   "
    0  'a'
      DB<2> @a = split " ","a   "
      DB<3> x @s
      empty array
      DB<4> x @a
    0  'a'
      DB<5> ($a, $b) = split " ","a   "
      DB<6> x ($a, $b)
    0  'a'
    1  ''
      DB<7>
@donald donald force-pushed the mxproxmox-add-check-pbackup branch from 86e9865 to bbd5231 Compare December 8, 2022 18:39
@donald donald merged commit 1e3aca5 into master Dec 8, 2022
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant