How to use restore_from_backup method in avocado

Best Python code snippet using avocado_python

mysqlops.py

Source:mysqlops.py Github

copy

Full Screen

...118 elif cmd == 'restore':119 if mb.has_data_dir():120 logger.info('data-dir presents, skip restore_from_backup')121 else:122 mb.restore_from_backup()123 mb.catchup()124 elif cmd == 'restore_from_backup':125 if mb.has_data_dir():126 logger.info('data-dir presents, skip restore_from_backup')127 else:128 mb.restore_from_backup()129 elif cmd == 'catchup':130 mb.catchup()131 elif cmd == 'make_mycnf':132 mb.make_runtime_my_cnf()133 elif cmd == 'optimize':134 mb.optimize_tables(args.db)135 elif cmd == 'query':136 rst = mb.query(args.sql)137 def _out():138 for line in rst:139 print utfjson.dump(line)140 return _out141 elif cmd == 'replication_diff':142 rst = mb.diff_replication()...

Full Screen

Full Screen

patcher.py

Source:patcher.py Github

copy

Full Screen

...18 for f in files:19 try:20 EVODiskAOriginal.extract(f, path_in_disk)21 except FileNotFoundError:22 EVODiskAOriginal.restore_from_backup()23 return "File %s not found in disk.\nTry setting the path under 'Advanced'." % f24 except UnicodePathError:25 # TODO: Try writing the command to a batch file, then running that.26 with open('test.bat', 'w') as bat:27 bat.write(cmd)28 return "Patching in paths containing non-ASCII characters not supported."29 if f == '46.EXE' and EVODiskAOriginal.extension.lower() in HARD_DISK_FORMATS:30 print "It's an HDI, so using a different 46.EXE patch"31 patch_filename = path.join('patch', 'HDI_46.EXE.xdelta')32 backup_patch_filename = path.join('patch', 'FtoH_46.EXE.xdelta')33 else:34 patch_filename = path.join('patch', f + '.xdelta')35 backup_patch_filename = None36 extracted_file_path = diskA_dir + '/' + f37 copyfile(extracted_file_path, extracted_file_path + '_edited')38 patchfile = Patch(extracted_file_path, patch_filename, edited=extracted_file_path + '_edited')39 try:40 patchfile.apply()41 except PatchChecksumError:42 if backup_patch_filename is not None:43 print "Trying backup patch:", backup_patch_filename44 patchfile = Patch(extracted_file_path, backup_patch_filename, edited=extracted_file_path + '_edited')45 try:46 print "Applying patch now"47 patchfile.apply()48 print "The patch successfully"49 except PatchChecksumError:50 EVODiskAOriginal.restore_from_backup()51 remove(extracted_file_path)52 remove(extracted_file_path + '_edited')53 return "Checksum error in file %s." % f54 else:55 EVODiskAOriginal.restore_from_backup()56 remove(extracted_file_path)57 remove(extracted_file_path + '_edited')58 return "Checksum error in file %s." % f59 copyfile(extracted_file_path + '_edited', extracted_file_path)60 EVODiskAOriginal.insert(extracted_file_path, path_in_disk)61 remove(extracted_file_path)62 remove(extracted_file_path + '_edited')63 for i, disk in enumerate([disk_a_images, disk_b2_images, disk_b3_images, disk_b4_images]):64 ImgDisk = Disk(disks[i], backup_folder=backup_folder)65 imgdisk_dir = path.dirname(disks[i])66 # For HDIs, don't backup the disk again - this would leave users with a mostly-patched backup67 if disks[i] != diskA:68 ImgDisk.backup()69 for img in disk:70 try:71 ImgDisk.extract(img, path_in_disk)72 except FileNotFoundError:73 ImgDisk.restore_from_backup()74 return "File %s not found in disk." % img75 extracted_file_path = imgdisk_dir + '/' + img76 77 patch_filename = path.join('patch', img + '.xdelta')78 copyfile(extracted_file_path, extracted_file_path + '_edited')79 patchfile = Patch(extracted_file_path, patch_filename, edited=extracted_file_path + '_edited',)80 try:81 patchfile.apply()82 except PatchChecksumError:83 ImgDisk.restore_from_backup()84 remove(extracted_file_path)85 remove(extracted_file_path + '_edited')86 return "Checksum error in file %s." % img87 copyfile(extracted_file_path + '_edited', extracted_file_path)88 # Can't use extracted_file_path, since it also tries to delete the path in the disk...89 ImgDisk.insert(extracted_file_path, path_in_disk)90 remove(extracted_file_path)91 remove(extracted_file_path + '_edited')92 return None93# TODO: Apache License v2 due to xdelta94if __name__ == '__main__':...

Full Screen

Full Screen

__main__.py

Source:__main__.py Github

copy

Full Screen

1import questionary2from .setup import WowSetup3from .config import ADDON_NAMES4INITIAL_SETUP = "Initial Setup (directory tree, config.wtf, symlinks, copy exe)"5POST_SETUP = "Post Setup (default SV, MultiboxUtils.lua, copy AddOns, shortcuts)"6CREATE_BACKUP = "Backup (WTF folders and AddOns)"7RESTORE_FROM_BACKUP = "Restore (full setup using a backup)"8COPY_SV = "Copy SavedVariable(s) (from one account to all others)"9COPY_EXE = "After a game update, recopy the game executable"10CREATE_CONFIG_FROM_DEFAULT = "Generate Config.wtf files based on default template"11DUMP_ACCOUNT_IDS = "Print account IDs (ex: 43512345#5)"12actions = [13 INITIAL_SETUP,14 POST_SETUP,15 CREATE_BACKUP,16 RESTORE_FROM_BACKUP,17 COPY_SV,18 COPY_EXE,19 CREATE_CONFIG_FROM_DEFAULT,20 DUMP_ACCOUNT_IDS,21]22def main():23 setup = WowSetup()24 action = questionary.select(25 "Which action would you like to perform?", actions26 ).ask()27 if action == INITIAL_SETUP:28 setup.initial_setup()29 elif action == POST_SETUP:30 setup.post_setup()31 elif action == CREATE_BACKUP:32 setup.backup()33 elif action == RESTORE_FROM_BACKUP:34 setup.restore_backup()35 elif action == COPY_SV:36 # Prompt user for account index (source of saved_variable)37 acc_indices = [str(x) for x in list(range(len(setup.accounts)))]38 acc_idx_string = questionary.select(39 "Select index of source account to copy the SavedVariable from", acc_indices40 ).ask()41 acc_idx = int(acc_idx_string)42 # Prompt user for addon to copy saved_variable for43 addon_names = ADDON_NAMES44 addon_names.append("All")45 addon_name = questionary.select(46 "Which addon SavedVariable to overwrite?", addon_names47 ).ask()48 if addon_name == "All":49 for addon in ADDON_NAMES:50 setup.copy_sv(acc_idx, addon)51 else:52 setup.copy_sv(acc_idx, addon_name)53 elif action == COPY_EXE:54 setup.copy_executables()55 elif action == CREATE_CONFIG_FROM_DEFAULT:56 setup.create_config_files_from_default()57 elif action == DUMP_ACCOUNT_IDS:58 setup.dump_account_ids()59if __name__ == "__main__":...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful