-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-config.py
More file actions
executable file
·62 lines (54 loc) · 2.69 KB
/
Copy pathcreate-config.py
File metadata and controls
executable file
·62 lines (54 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
import argparse
from db import Database, ClientConfig
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Creates a backup configuration')
parser.add_argument("--cloud-provider",
help="Cloud-provider used for archive storage",
type=str,
default="aws")
parser.add_argument("--region",
help="Cloud-provider region backups containing the archive bucket",
type=str,
default="eu-north-1")
parser.add_argument("--aws-profile",
help="AWS profile to use for upload",
type=str,
required=True)
parser.add_argument("--bucket",
help="Cloud-provider S3/blob bucket where archives are stored",
type=str,
required=True)
parser.add_argument("--client-name",
help="Name of the client",
type=str,
required=True)
parser.add_argument("--backup-root",
help="Directory to backup, a local directory path",
type=str,
required=True)
parser.add_argument("--key-file",
help="Path to the symmetric key to use for encrypting archives",
type=str,
required=True)
parser.add_argument("--cross-devices",
help="Whether backups of this directory will cross mount points",
action=argparse.BooleanOptionalAction,
default=True)
parser.add_argument("--manual-only",
help="Whether backups of this directory should only be done manually",
action=argparse.BooleanOptionalAction,
default=False)
parser.add_argument("--temp-directory",
help="Directory to use for building archives",
type=str,
default=None)
args = parser.parse_args()
options = {}
options[ClientConfig.BACKUPS_CROSS_DEVICES] = ClientConfig.YES if args.cross_devices else ClientConfig.NO
options[ClientConfig.MANUAL_ONLY] = ClientConfig.YES if args.manual_only else ClientConfig.NO
if args.temp_directory: options[ClientConfig.TMP_DIR] = args.temp_directory
db = Database()
config = ClientConfig(args.cloud_provider, args.region, args.aws_profile, args.bucket, args.client_name,
args.backup_root, args.key_file, options, None, db)
config.add_to_database()