diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2011-06-29 15:22:56 -0700 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2011-06-29 15:22:56 -0700 |
| commit | 7555aca28a5ab1ba4dd1be04a91bf6347eaac84f (patch) | |
| tree | f21bb20974027103bd694e2ebb4d4ec425914047 /nova/utils.py | |
| parent | 097e25f69a3ce4fe29addf93e4f92fa861aa54dc (diff) | |
| download | nova-7555aca28a5ab1ba4dd1be04a91bf6347eaac84f.tar.gz nova-7555aca28a5ab1ba4dd1be04a91bf6347eaac84f.tar.xz nova-7555aca28a5ab1ba4dd1be04a91bf6347eaac84f.zip | |
fix issue of recurse_zones not being converted to bool properly
add bool_from_str util call
add test for bool_from_str
slight rework of min/max_count check
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py index 510cdd9f6..be26899ca 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -772,6 +772,17 @@ def is_uuid_like(val): return (len(val) == 36) and (val.count('-') == 4) +def bool_from_str(val): + """Convert a string representation of a bool into a bool value""" + + if not val: + return False + try: + return True if int(val) else False + except ValueError: + return val.lower() == 'true' + + class Bootstrapper(object): """Provides environment bootstrapping capabilities for entry points.""" |
