This commit is contained in:
parent
6478350a5e
commit
5003f1e2ac
@ -42,7 +42,7 @@ def init(mode="filesystem", path=None, bucket=None, prefix=None, gateway=None, r
|
||||
|
||||
|
||||
def set_policy(compression="zstd"):
|
||||
cmd_policy = f"{KOPIA_EXEC} policy set --global --config-file={KOPIA_CONFIG_PATH} --compression={compression} --keep-latest={{ params.keep_latest|default(7) }} --keep-hourly 0 --keep-daily {{ params.keep_daily|default(7) }} --keep-weekly {{ params.keep_weekly|default(4) }} --keep-monthly {{ params.keep_monthly|default(6) }} --keep-annual 0 --one-file-system=true"
|
||||
cmd_policy = f"{KOPIA_EXEC} policy set --global --config-file={KOPIA_CONFIG_PATH} --compression={compression} --keep-latest={{ params.keep_latest|default(7) }} --keep-hourly 0 --keep-daily {{ params.keep_daily|default(7) }} --keep-weekly {{ params.keep_weekly|default(4) }} --keep-monthly {{ params.keep_monthly|default(6) }} --keep-annual 0 --one-file-system=true -p {KOPIA_PASSWORD}"
|
||||
run_policy = Popen(cmd_policy, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
run_policy.wait()
|
||||
if run_policy.returncode == 0:
|
||||
@ -52,8 +52,8 @@ def set_policy(compression="zstd"):
|
||||
|
||||
def set_cache(size=500, limit=1000):
|
||||
rcs = []
|
||||
cmds_cache = [f"{KOPIA_EXEC} cache set --content-cache-size-mb {size} --config-file={KOPIA_CONFIG_PATH}",
|
||||
f"{KOPIA_EXEC} cache set --content-cache-size-limit-mb {limit} --config-file={KOPIA_CONFIG_PATH}"]
|
||||
cmds_cache = [f"{KOPIA_EXEC} cache set --content-cache-size-mb {size} --config-file={KOPIA_CONFIG_PATH} -p {KOPIA_PASSWORD}",
|
||||
f"{KOPIA_EXEC} cache set --content-cache-size-limit-mb {limit} --config-file={KOPIA_CONFIG_PATH} -p {KOPIA_PASSWORD}"]
|
||||
for cmd_cache in cmds_cache:
|
||||
run_cache = Popen(cmd_cache, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
run_cache.wait()
|
||||
@ -72,14 +72,14 @@ def run(before_tasks=[]):
|
||||
if not all(rcs):
|
||||
return False
|
||||
|
||||
cmd_launch = f"{KOPIA_EXEC} snapshot create {{ params.dirs|map(attribute='path')|join(' ') }} --config-file={KOPIA_CONFIG_PATH}"
|
||||
cmd_launch = f"{KOPIA_EXEC} snapshot create {{ params.dirs|map(attribute='path')|join(' ') }} --config-file={KOPIA_CONFIG_PATH} -p {KOPIA_PASSWORD}"
|
||||
run_launch = Popen(cmd_launch, shell=True)
|
||||
run_launch.wait()
|
||||
return run_launch.returncode == 0
|
||||
|
||||
|
||||
def list_snapshots():
|
||||
cmd_list = f"{KOPIA_EXEC} snapshot list --config-file={KOPIA_CONFIG_PATH}"
|
||||
cmd_list = f"{KOPIA_EXEC} snapshot list --config-file={KOPIA_CONFIG_PATH} -p {KOPIA_PASSWORD}"
|
||||
run_list = Popen(cmd_list, shell=True)
|
||||
run_list.wait()
|
||||
return run_list.returncode == 0
|
||||
|
Loading…
Reference in New Issue
Block a user