mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-10-10 20:27:42 +00:00
Make rcb dump env vars to properly escape them
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = '0.6.0'
|
||||
__version__ = '0.7.1'
|
||||
|
@@ -51,6 +51,9 @@ def main():
|
||||
elif args.action == "crontab":
|
||||
crontab(config)
|
||||
|
||||
elif args.action == "dump-env":
|
||||
dump_env()
|
||||
|
||||
# Random test stuff here
|
||||
elif args.action == "test":
|
||||
nodes = utils.get_swarm_nodes()
|
||||
@@ -290,6 +293,14 @@ def crontab(config):
|
||||
print(cron.generate_crontab(config))
|
||||
|
||||
|
||||
def dump_env():
|
||||
"""Dump all environment variables to a script that can be sourced from cron"""
|
||||
print("#!/bin/bash")
|
||||
print("# This file was generated by restic-compose-backup")
|
||||
for key, value in os.environ.items():
|
||||
print("export {}='{}'".format(key, value))
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(prog='restic_compose_backup')
|
||||
parser.add_argument(
|
||||
@@ -303,6 +314,7 @@ def parse_args():
|
||||
'cleanup',
|
||||
'version',
|
||||
'crontab',
|
||||
'dump-env',
|
||||
'test',
|
||||
],
|
||||
)
|
||||
|
Reference in New Issue
Block a user