This commit is contained in:
parent
8e82650b96
commit
772700f039
@ -89,24 +89,27 @@ if __name__ == "__main__":
|
||||
parser.add_argument('action', nargs="?")
|
||||
args = parser.parse_args()
|
||||
|
||||
res_init = init(mode="s3", bucket="kopia", prefix="{{ name }}", gateway="{{ kopia.repos[params.repo].gateway|default('gateway.storjshare.io') }}", region="{{ kopia.repos[params.repo].region|default('EU1') }}", ak="{{ kopia.repos[params.repo].ak }}", sak="{{ kopia.repos[params.repo].sak }}")
|
||||
if not res_init:
|
||||
print("init error")
|
||||
sys.exit(1)
|
||||
|
||||
if args.action == "run":
|
||||
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) }}):
|
||||
print("set cache error")
|
||||
sys.exit(1)
|
||||
if not run(before_tasks={{ params.before_tasks|default([]) }}):
|
||||
print("run error")
|
||||
sys.exit(1)
|
||||
elif args.action == "env":
|
||||
if args.action == "env":
|
||||
print("# source this to use kopia with this repo")
|
||||
for k,v in ENV.items():
|
||||
print(f"export {k}=\"{v}\"")
|
||||
sys.exit(0)
|
||||
else:
|
||||
list_snapshots()
|
||||
res_init = init(mode="s3", bucket="kopia", prefix="{{ name }}", gateway="{{ kopia.repos[params.repo].gateway|default('gateway.storjshare.io') }}", region="{{ kopia.repos[params.repo].region|default('EU1') }}", ak="{{ kopia.repos[params.repo].ak }}", sak="{{ kopia.repos[params.repo].sak }}")
|
||||
if not res_init:
|
||||
print("init error")
|
||||
sys.exit(1)
|
||||
|
||||
if args.action == "run":
|
||||
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) }}):
|
||||
print("set cache error")
|
||||
sys.exit(1)
|
||||
if not run(before_tasks={{ params.before_tasks|default([]) }}):
|
||||
print("run error")
|
||||
sys.exit(1)
|
||||
else:
|
||||
list_snapshots()
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user