subprocess.run(['dd', f'if={src}', f'of={dest}', 'bs=1M'],
check_output=True, encoding='utf-8', check=True)
-def load_image(cdrom):
+def update_image(cdrom):
"""
Update a cdrom image by downloading the latest version,
transferring it into an LV, moving the old LV out of the way and
"""
Remove stale cdrom images that are no longer in use
- load_image doesn't attempt to remove the old image because it
+ update_image doesn't attempt to remove the old image because it
might still be in use. reap_images attempts to delete any LVs
starting with 'image-old_', but ignores errors, in case they're
still being used.
database.session.add(cdrom)
database.session.commit()
- load_image(cdrom)
+ update_image(cdrom)
def action_add_mirror(args):
attrs = {key: vars(args)[key] for key in ('mirror_id', 'uri_prefix')}
for cdrom in images:
if cdrom is not None:
- load_image(cdrom)
+ update_image(cdrom)
def action_reap(args):
reap_images()