summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rwxr-xr-xplaybooks/provisioning/openstack/sample-inventory/openstack.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/playbooks/provisioning/openstack/sample-inventory/openstack.py b/playbooks/provisioning/openstack/sample-inventory/openstack.py
index 9d4886261..8de73e1e0 100755
--- a/playbooks/provisioning/openstack/sample-inventory/openstack.py
+++ b/playbooks/provisioning/openstack/sample-inventory/openstack.py
@@ -54,7 +54,7 @@ from distutils.version import StrictVersion
try:
import json
-except:
+except ImportError:
import simplejson as json
import os_client_config
@@ -147,10 +147,10 @@ def get_host_groups_from_cloud(inventory):
if 'interface_ip' not in server:
continue
try:
- if server["metadata"][os.environ['OS_INV_FILTER_KEY']] == os.environ['OS_INV_FILTER_VALUE']:
+ if server["metadata"][os.environ['OS_INV_FILTER_KEY']] == os.environ['OS_INV_FILTER_VALUE']:
+ firstpass[server['name']].append(server)
+ except Exception:
firstpass[server['name']].append(server)
- except:
- firstpass[server['name']].append(server)
for name, servers in firstpass.items():
if len(servers) == 1 and use_hostnames:
append_hostvars(hostvars, groups, name, servers[0])
@@ -243,7 +243,7 @@ def main():
output = to_json(inventory.get_host(args.host))
print(output)
except shade.OpenStackCloudException as e:
- sys.stderr.write('%s\n' % e.message)
+ sys.stderr.write('%s\n' % str(e))
sys.exit(1)
sys.exit(0)