[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a
Garrett Holmstrom
gholms at fedoraproject.org
Sun Jun 16 02:31:13 UTC 2013
The following commit has been merged in the master branch:
commit 72623190c169b81b0e5057f5ae56e81932d812cb
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Tue Apr 30 13:39:19 2013 -0700
autoscaling_tag_def: Raise ArgumentTypeErrors instead of ValueErrors
Raising ValueErrors for bad input instead of ArgumentTypeErrors was
causing argparse to mask relevant error messages.
Fixes TOOLS-318
diff --git a/euca2ools/commands/autoscaling/argtypes.py b/euca2ools/commands/autoscaling/argtypes.py
index 84b30ba..a206778 100644
--- a/euca2ools/commands/autoscaling/argtypes.py
+++ b/euca2ools/commands/autoscaling/argtypes.py
@@ -29,14 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
+from argparse import ArgumentTypeError
+
+
def autoscaling_tag_def(tag_str):
tag_dict = {}
pieces = ','.split(tag_str)
for piece in pieces:
piece = piece.strip()
if '=' not in piece:
- raise ValueError(("invalid tag definition: each segment of '{0}' "
- "must have format KEY=VALUE").format(piece))
+ raise ArgumentTypeError(
+ "invalid tag definition: each segment of '{0}' must have "
+ "format KEY=VALUE".format(piece))
key, val = piece.split('=', 1)
if key == 'k':
tag_dict['Key'] = val
@@ -50,10 +54,12 @@ def autoscaling_tag_def(tag_str):
if val.lower() in ('true', 'false'):
tag_dict['PropagateAtLaunch'] = val.lower()
else:
- raise ValueError("value for to 'p=' must be 'true' or 'false'")
+ raise ArgumentTypeError(
+ "value for to 'p=' must be 'true' or 'false'")
else:
- raise ValueError("unrecognized tag segment '{0}'".format(piece))
+ raise ArgumentTypeError(
+ "unrecognized tag segment '{0}'".format(piece))
if not tag_dict.get('Key'):
- raise ValueError(
+ raise ArgumentTypeError(
"tag '{0}' must contain a 'k=' segment with a non-empty value")
return tag_dict
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list