diff options
author | Tomas Sedovic <tomas@sedovic.cz> | 2017-06-16 18:08:00 +0200 |
---|---|---|
committer | Tomas Sedovic <tomas@sedovic.cz> | 2017-06-16 18:08:00 +0200 |
commit | 9369c9dfd722e697f83a225d78c2c1dcd1247976 (patch) | |
tree | fbde420c20e6f18fcc8063e268a1525f8848c8d0 /playbooks | |
parent | ad83e8aa81316f061b255def2ab85bb7db58a8f3 (diff) | |
download | openshift-9369c9dfd722e697f83a225d78c2c1dcd1247976.tar.gz openshift-9369c9dfd722e697f83a225d78c2c1dcd1247976.tar.bz2 openshift-9369c9dfd722e697f83a225d78c2c1dcd1247976.tar.xz openshift-9369c9dfd722e697f83a225d78c2c1dcd1247976.zip |
Fix flake8 errors with the openstack inventory
Diffstat (limited to 'playbooks')
-rwxr-xr-x | playbooks/provisioning/openstack/sample-inventory/openstack.py | 10 |
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) |