diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-09-16 15:50:04 -0700 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-11-10 17:35:43 -0600 |
commit | 477c9c4119df5fd45c1129651922d238dccad8c9 (patch) | |
tree | 8ccbb610e1748a4cb07b93686d6926e4521db815 /src/lib/Bcfg2/Options/Types.py | |
parent | 389ce1a86b704222ddc9458cd49c281e7601b803 (diff) | |
download | bcfg2-477c9c4119df5fd45c1129651922d238dccad8c9.tar.gz bcfg2-477c9c4119df5fd45c1129651922d238dccad8c9.tar.bz2 bcfg2-477c9c4119df5fd45c1129651922d238dccad8c9.zip |
testsuite: Added unit tests for new option parsing
Diffstat (limited to 'src/lib/Bcfg2/Options/Types.py')
-rw-r--r-- | src/lib/Bcfg2/Options/Types.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py index d11e54fba..1c04fede3 100644 --- a/src/lib/Bcfg2/Options/Types.py +++ b/src/lib/Bcfg2/Options/Types.py @@ -38,9 +38,11 @@ def comma_dict(value): for item in items: if '=' in item: key, value = item.split(r'=', 1) - try: - result[key] = bool(value) - except ValueError: + if value in ["true", "yes", "on"]: + result[key] = True + elif value in ["false", "no", "off"]: + result[key] = False + else: try: result[key] = int(value) except ValueError: @@ -107,8 +109,6 @@ def size(value): """ Given a number of bytes in a human-readable format (e.g., '512m', '2g'), get the absolute number of bytes as an integer. """ - if value == -1: - return value mat = _bytes_re.match(value) if not mat: raise ValueError("Not a valid size", value) |