updated kopia state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2025-05-01 09:08:11 +02:00
parent 3273b8ee1b
commit ab7170ecdb

View File

@ -33,16 +33,16 @@ def init(mode="filesystem", path=None, bucket=None, prefix=None, gateway=None, r
print("successfully created repository")
run_connect = Popen(cmd_connect, shell=True, stdout=PIPE, stderr=PIPE)
run_connect.wait()
if run_connect.returncode == 0:
print("successfully connected to repository")
if run_connect.returncode != 0:
print("erro connecting to repository")
else:
print("no valid mode or missing informations")
return None
return True
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 -p {KOPIA_PASSWORD}"
def set_policy(compression="zstd", keep_latest=7, keep_daily=7, keep_weekly=4, keep_monthly=6):
cmd_policy = f"{KOPIA_EXEC} policy set --global --config-file={KOPIA_CONFIG_PATH} --compression={compression} --keep-latest={keep_latest} --keep-hourly 0 --keep-daily {keep_daily} --keep-weekly {keep_weekly} --keep-monthly {keep_monthly} --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:
@ -95,7 +95,7 @@ if __name__ == "__main__":
sys.exit(1)
if args.action == "run":
if not set_policy():
if not set_policy(compression="zstd", keep_latest={{ params.keep_latest|default(7) }}, keep_daily={{ params.keep_daily|default(7) }}, keep_weekly={{ params.keep_weekly|default(4) }}, keep_monthly={{ params.keep_monthly|default(7) }}):
print("set policy error")
sys.exit(1)
if not set_cache({{ kopia.repos[params.repo].cache_size|default(500) }},{{ kopia.repos[params.repo].cache_limit|default(1000) }}):
@ -105,7 +105,7 @@ if __name__ == "__main__":
print("run error")
sys.exit(1)
elif args.action == "env":
print();print("# source this to use kopia with this repo")
print("# source this to use kopia with this repo")
for k,v in ENV.items():
print(f"export {k}=\"{v}\"")
else: