How to use _call_repair_func method in autotest

Best Python code snippet using autotest_python

base_classes.py

Source:base_classes.py Github

copy

Full Screen

...204 if mountpoint == self._get_mountpoint('/tmp'):205 self.erase_dir_contents('/tmp')206 if mountpoint == self._get_mountpoint('/var/tmp'):207 self.erase_dir_contents('/var/tmp')208 def _call_repair_func(self, err, func, *args, **dargs):209 for old_call in self._already_repaired:210 if old_call == (func, args, dargs):211 # re-raising the original exception because surrounding212 # error handling may want to try other ways to fix it213 logging.warn('Already done this (%s) repair procedure, '214 're-raising the original exception.', func)215 raise err216 try:217 func(*args, **dargs)218 except error.AutoservHardwareRepairRequestedError:219 # let this special exception propagate220 raise221 except error.AutoservError:222 logging.exception('Repair failed but continuing in case it managed'223 ' to repair enough')224 self._already_repaired.append((func, args, dargs))225 def repair_filesystem_only(self):226 """perform file system repairs only"""227 while True:228 # try to repair specific problems229 try:230 logging.info('Running verify to find failures to repair...')231 self.verify()232 if self._removed_files:233 logging.info('Removed files, rebooting to release the'234 ' inodes')235 self.reboot()236 return # verify succeeded, then repair succeeded237 except error.AutoservHostIsShuttingDownError, err:238 logging.exception('verify failed')239 self._call_repair_func(err, self._repair_wait_for_reboot)240 except error.AutoservDiskFullHostError, err:241 logging.exception('verify failed')242 self._call_repair_func(err, self.repair_full_disk,243 self._get_mountpoint(err.path))244 def repair_software_only(self):245 """perform software repairs only"""246 while True:247 try:248 self.repair_filesystem_only()249 break250 except (error.AutoservSshPingHostError, error.AutoservSSHTimeout,251 error.AutoservSshPermissionDeniedError,252 error.AutoservDiskFullHostError), err:253 logging.exception('verify failed')254 logging.info('Trying to reinstall the machine')255 self._call_repair_func(err, self.machine_install)256 def repair_full(self):257 while True:258 try:259 self.repair_software_only()260 break261 except error.AutoservHardwareHostError, err:262 logging.exception('verify failed')263 # software repair failed, try hardware repair264 logging.info('Hardware problem found, '265 'requesting hardware repairs')266 self._call_repair_func(err, self.request_hardware_repair)267 def cleanup(self):268 pass269 def machine_install(self):270 raise NotImplementedError('Machine install not implemented!')271 def install(self, installableObject):272 installableObject.install(self)273 def get_autodir(self):274 raise NotImplementedError('Get autodir not implemented!')275 def set_autodir(self):276 raise NotImplementedError('Set autodir not implemented!')277 def start_loggers(self):278 """ Called to start continuous host logging. """279 pass280 def stop_loggers(self):...

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 autotest 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