Skip to content

Commit 09c9053

Browse files
committed
fix rollbacks
1 parent f78b206 commit 09c9053

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mytonctrl/mytonctrl.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,26 @@ def Upgrade(ton, args):
332332
else:
333333
text = "Upgrade - {red}Error{endc}"
334334
color_print(text)
335-
#end define
336335

337-
def rollback_to_mtc1(ton, args):
336+
337+
def rollback_to_mtc1(local, ton, args):
338338
color_print("{red}Warning: this is dangerous, please make sure you've backed up mytoncore's db.{endc}")
339-
a = input("Do you want to continue? [Y/n]")
339+
a = input("Do you want to continue? [Y/n]\n")
340340
if a.lower() != 'y':
341341
print('aborted.')
342342
return
343343
ton.rollback_modes()
344+
345+
workdir = local.buffer.my_work_dir
346+
version_file_path = os.path.join(workdir, 'VERSION')
347+
if os.path.exists(version_file_path):
348+
os.remove(version_file_path)
349+
344350
rollback_script_path = pkg_resources.resource_filename('mytonctrl', 'migrations/roll_back_001.sh')
345351
run_args = ["bash", rollback_script_path]
346-
exit_code = run_as_root(run_args)
352+
run_as_root(run_args)
353+
local.exit()
354+
347355

348356
def cleanup_validator_db(ton, args):
349357
cleanup_script_path = pkg_resources.resource_filename('mytonctrl', 'scripts/cleanup.sh')

0 commit comments

Comments
 (0)