diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-06-30 14:20:59 -0500 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2011-06-30 14:20:59 -0500 |
| commit | fa8f7421f48a3bd1f6b01b2ff3cc754c24e0a424 (patch) | |
| tree | a1cbb2835c9c8bd6ea9866115d4fb22c8b1b0aae /nova/utils.py | |
| parent | 46c321d044d6a2db44a22466624a1e7dc71d5935 (diff) | |
| parent | c7ee39c3d00fdc799850b308fefd08f482edb5e5 (diff) | |
| download | nova-fa8f7421f48a3bd1f6b01b2ff3cc754c24e0a424.tar.gz nova-fa8f7421f48a3bd1f6b01b2ff3cc754c24e0a424.tar.xz nova-fa8f7421f48a3bd1f6b01b2ff3cc754c24e0a424.zip | |
trunk merge with migration renumbering
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 b8c83eab2..8784a227d 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -764,6 +764,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.""" |
