Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Fix traceback with '--iso <UNMOUNTABLE>' (#1044083)
Browse files Browse the repository at this point in the history
There's no 'message' function in fedup.commandline.

So: make device_setup return the mountpoint of the device - unless the
mount fails, in which case it returns None. In that case we can print
the message and exit cleanly from the main script, like most other
errors.

Bonus: remove a gratuitous umount attempt (it happens automatically
thanks to atexit)
  • Loading branch information
wgwoods committed Jan 23, 2014
1 parent 471b7c7 commit cd2ac9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions fedup.py
Expand Up @@ -100,9 +100,12 @@ def main(args):
return

if args.device or args.iso:
device_setup(args)
mnt = device_setup(args)

if args.iso:
if not mnt:
message('--iso: '+_('Unable to open %s') % args.iso)
raise SystemExit(2)
log.debug("iso is %s", os.path.realpath(args.iso))
def isocleanup():
log.debug("unmounting %s", args.device.mnt)
Expand Down Expand Up @@ -140,7 +143,6 @@ def isocleanup():
print _("The '%s' repo was rejected by yum as invalid.") % args.instrepo
if args.iso:
print _("The given ISO probably isn't an install DVD image.")
media.umount(args.device.mnt)
elif args.device:
print _("The media doesn't contain a valid install DVD image.")
else:
Expand Down
4 changes: 2 additions & 2 deletions fedup/commandline.py
Expand Up @@ -235,9 +235,9 @@ def device_setup(args):
args.device = media.loopmount(args.iso)
except media.CalledProcessError as e:
log.info("mount failure: %s", e.output)
message('--iso: '+_('Unable to open %s') % args.iso)
raise SystemExit(2)
return
else:
args.repos.append(('add', 'upgradeiso=file://%s' % args.device.mnt))
if not args.instrepo:
args.instrepo = 'upgradeiso'
return args.device.mnt

0 comments on commit cd2ac9d

Please sign in to comment.