diff options
author | Marius Gedminas <marius@gedmin.as> | 2015-09-04 08:47:17 +0200 |
---|---|---|
committer | Marius Gedminas <marius@gedmin.as> | 2015-09-04 08:47:17 +0200 |
commit | 0eb0b56722f2852d187d08265237750001f049aa (patch) | |
tree | e734e9bbd6a915efc1b875934e06b96f12b150a7 /contrib | |
parent | Python 3: use six.text_type instead of unicode (diff) | |
download | ansible-0eb0b56722f2852d187d08265237750001f049aa.tar.xz ansible-0eb0b56722f2852d187d08265237750001f049aa.zip |
Replace type() checks with isinstance()
Fixes the bug I introduced in my previous commit (six.string_types is
(basestring,) on Python 2). Thanks @abadger for noticing!
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/apache-libcloud.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/inventory/apache-libcloud.py b/contrib/inventory/apache-libcloud.py index 5ac0d9c7a5..f7d64c257c 100755 --- a/contrib/inventory/apache-libcloud.py +++ b/contrib/inventory/apache-libcloud.py @@ -260,11 +260,11 @@ class LibcloudInventory(object): key = self.to_safe('ec2_' + key) # Handle complex types - if type(value) in [int, bool]: + if isinstance(value, (int, bool)): instance_vars[key] = value - elif type(value) in string_types: + elif isinstance(value, string_types): instance_vars[key] = value.strip() - elif type(value) == type(None): + elif value is None: instance_vars[key] = '' elif key == 'ec2_region': instance_vars[key] = value.name |