From 9369c9dfd722e697f83a225d78c2c1dcd1247976 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Fri, 16 Jun 2017 18:08:00 +0200 Subject: Fix flake8 errors with the openstack inventory --- playbooks/provisioning/openstack/sample-inventory/openstack.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'playbooks/provisioning') 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) -- cgit v1.2.3