Skip to content

Commit

Permalink
better errors for invalid '--network' values
Browse files Browse the repository at this point in the history
Add a specific error message for weird systems that have busted
/etc/*-release, tweak the downgrade error message, and fix the TypeError
from the format mismatch.
  • Loading branch information
wgwoods committed Nov 6, 2014
1 parent 755a097 commit ef2606a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions fedup/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,14 @@ def VERSION(arg):
_distros=('fedora', 'redhat', 'centos')
distro, version, id = platform.linux_distribution(supported_dists=_distros)

if float(arg) > float(version):
return arg
else:
msg = _("version must be greater than %i") % version
raise argparse.ArgumentTypeError(msg)
try:
floatver = float(version)
except ValueError:
raise argparse.ArgumentTypeError(_("can't determine system version?"))
if float(arg) <= floatver:
raise argparse.ArgumentTypeError(_("version must be higher than %s")
% version)
return arg

def do_cleanup(args):
if not args.skipbootloader:
Expand Down

0 comments on commit ef2606a

Please sign in to comment.