diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index c84eafb7..68fc7f12 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -227,17 +227,17 @@ class BlockPair(): # Done return complete - def safety_check(self, dry_run=False): + def safety_check(self): """Run safety check and abort if necessary.""" dest_size = -1 if self.destination.exists(): - dest_size = self.destination.stat().st_size + dest_obj = hw_obj.Disk(self.destination) + dest_size = dest_obj.details['size'] + del dest_obj # Raise exception if necessary - if dry_run: - std.print_warning(f'Assuming destination is okay ({self.destination})') - elif dest_size < self.size: - std.print_error('Invalid destination: {self.destination}') + if dest_size < self.size: + std.print_error(f'Invalid destination: {self.destination}') raise std.GenericAbort() @@ -537,8 +537,9 @@ class State(): ) # Safety Check #2 - for pair in self.block_pairs: - pair.safety_check(dry_run=docopt_args['--dry-run']) + if not docopt_args['--dry-run']: + for pair in self.block_pairs: + pair.safety_check() def init_tmux(self): """Initialize tmux layout.""" @@ -717,7 +718,7 @@ class State(): raise std.GenericAbort() # Update settings - settings['Needs Format'] = not dry_run + settings['Needs Format'] = False self.save_settings(settings, working_dir) def retry_all_passes(self): diff --git a/scripts/wk/std.py b/scripts/wk/std.py index 37df3e21..e98b9d5d 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -739,7 +739,7 @@ def color_string(strings, colors, sep=' '): # Convert to strings if necessary try: - iterator = iter(strings) + iter(strings) except TypeError: # Assuming single element passed, convert to string strings = (str(strings),)