Skip to content

Commit 8a46610

Browse files
committed
add skip-create-backup flag to restore_backup
1 parent ee82cb6 commit 8a46610

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

modules/backups.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def run_restore_backup(args):
5656
return run_as_root(["bash", restore_script_path] + args)
5757

5858
def restore_backup(self, args):
59-
if len(args) == 0 or len(args) > 2:
60-
color_print("{red}Bad args. Usage:{endc} restore_backup <filename> [-y]")
59+
if len(args) == 0 or len(args) > 3:
60+
color_print("{red}Bad args. Usage:{endc} restore_backup <filename> [-y] [--skip-create-backup]")
6161
return
6262
if '-y' not in args:
6363
res = input(
@@ -67,11 +67,14 @@ def restore_backup(self, args):
6767
return
6868
else:
6969
args.pop(args.index('-y'))
70-
print('Before proceeding, mtc will create a backup of current configuration.')
71-
try:
72-
self.create_backup([])
73-
except:
74-
color_print("{red}Could not create backup{endc}")
70+
if '--skip-create-backup' in args:
71+
args.pop(args.index('--skip-create-backup'))
72+
else:
73+
print('Before proceeding, mtc will create a backup of current configuration.')
74+
try:
75+
self.create_backup([])
76+
except:
77+
color_print("{red}Could not create backup{endc}")
7578

7679
ip = str(ip2int(get_own_ip()))
7780
command_args = ["-m", self.ton.local.buffer.my_work_dir, "-n", args[0], "-i", ip]

0 commit comments

Comments
 (0)