fix #sync.cfg/pull: don't remove by default
and convert existing (manually created/edited) jobs to the previous default value of 'true'. the GUI has always set this value and defaults to 'false'. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
01ae7bfaf2
commit
61ef4ae8cb
31
debian/postinst
vendored
31
debian/postinst
vendored
@ -4,6 +4,14 @@ set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
update_sync_job() {
|
||||
job="$1"
|
||||
|
||||
echo "Updating sync job '$job' to make old 'remove-vanished' default explicit.."
|
||||
proxmox-backup-manager sync-job update "$job" --remove-vanished true \
|
||||
|| echo "Failed, please check sync.cfg manually!"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# need to have user backup in the tape group
|
||||
@ -32,6 +40,29 @@ case "$1" in
|
||||
echo "Fixing up termproxy user id in task log..."
|
||||
flock -w 30 /var/log/proxmox-backup/tasks/active.lock sed -i 's/:termproxy::\([^@]\+\): /:termproxy::\1@pam: /' /var/log/proxmox-backup/tasks/active || true
|
||||
fi
|
||||
|
||||
if dpkg --compare-versions "$2" 'lt' '7.1-1' && test -e /etc/proxmox-backup/sync.cfg; then
|
||||
prev_job=""
|
||||
|
||||
# read from HERE doc because POSIX sh limitations
|
||||
while read -r key value; do
|
||||
if test "$key" = "sync:"; then
|
||||
if test -n "$prev_job"; then
|
||||
# previous job doesn't have an explicit value
|
||||
update_sync_job "$prev_job"
|
||||
fi
|
||||
prev_job=$value
|
||||
else
|
||||
prev_job=""
|
||||
fi
|
||||
done <<EOF
|
||||
$(grep -e '^sync:' -e 'remove-vanished' /etc/proxmox-backup/sync.cfg)
|
||||
EOF
|
||||
if test -n "$prev_job"; then
|
||||
# last job doesn't have an explicit value
|
||||
update_sync_job "$prev_job"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
|
@ -52,7 +52,7 @@ pub const VERIFICATION_SCHEDULE_SCHEMA: Schema = StringSchema::new(
|
||||
|
||||
pub const REMOVE_VANISHED_BACKUPS_SCHEMA: Schema = BooleanSchema::new(
|
||||
"Delete vanished backups. This remove the local copy if the remote backup was deleted.")
|
||||
.default(true)
|
||||
.default(false)
|
||||
.schema();
|
||||
|
||||
#[api(
|
||||
|
@ -179,7 +179,7 @@ async fn pull (
|
||||
) -> Result<String, Error> {
|
||||
|
||||
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
|
||||
let delete = remove_vanished.unwrap_or(true);
|
||||
let delete = remove_vanished.unwrap_or(false);
|
||||
|
||||
check_pull_privs(&auth_id, &store, &remote, &remote_store, delete)?;
|
||||
|
||||
|
@ -57,7 +57,7 @@ impl PullParameters {
|
||||
let (remote_config, _digest) = pbs_config::remote::config()?;
|
||||
let remote: Remote = remote_config.lookup("remote", remote)?;
|
||||
|
||||
let remove_vanished = remove_vanished.unwrap_or(true);
|
||||
let remove_vanished = remove_vanished.unwrap_or(false);
|
||||
|
||||
let source = BackupRepository::new(
|
||||
Some(remote.config.auth_id.clone()),
|
||||
|
Loading…
Reference in New Issue
Block a user