summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 15:58:53 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 15:58:53 -0400
commitd62579d6c4bf3d2ae0a5d7e696812dc8202de8bd (patch)
tree6da97171b7ba0d1cf0ae2c98b6983f14d37d9cc6 /src/lib
parentc470d67390088b93d4f2163291ad35864ce9fdd9 (diff)
downloadbcfg2-d62579d6c4bf3d2ae0a5d7e696812dc8202de8bd.tar.gz
bcfg2-d62579d6c4bf3d2ae0a5d7e696812dc8202de8bd.tar.bz2
bcfg2-d62579d6c4bf3d2ae0a5d7e696812dc8202de8bd.zip
fixed some egregiously wrong Options tests
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Options.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index 3af5885bb..ef6807255 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -53,14 +53,6 @@ class DefaultConfigParser(ConfigParser.ConfigParser):
class Option(object):
- def get_cooked_value(self, value):
- if self.boolean:
- return True
- if self.cook:
- return self.cook(value)
- else:
- return value
-
def __init__(self, desc, default, cmd=False, odesc=False,
env=False, cf=False, cook=False, long_arg=False,
deprecated_cf=None):
@@ -71,9 +63,8 @@ class Option(object):
if not self.long:
if cmd and (cmd[0] != '-' or len(cmd) != 2):
raise OptionFailure("Poorly formed command %s" % cmd)
- else:
- if cmd and (not cmd.startswith('--')):
- raise OptionFailure("Poorly formed command %s" % cmd)
+ elif cmd and (not cmd.startswith('--')):
+ raise OptionFailure("Poorly formed command %s" % cmd)
self.odesc = odesc
self.env = env
self.cf = cf
@@ -83,6 +74,14 @@ class Option(object):
self.boolean = True
self.cook = cook
+ def get_cooked_value(self, value):
+ if self.boolean:
+ return True
+ if self.cook:
+ return self.cook(value)
+ else:
+ return value
+
def buildHelpMessage(self):
vals = []
if not self.cmd: