diff options
author | Chris Church <chris@ninemoreminutes.com> | 2015-08-10 21:35:30 +0200 |
---|---|---|
committer | Chris Church <chris@ninemoreminutes.com> | 2015-08-10 21:35:30 +0200 |
commit | da56312322358f62ae93a7924ef55c78fb5ec878 (patch) | |
tree | b31d8f68f5cd61e463fc9350811c8e6a9ebcdd16 /contrib | |
parent | fixed ref to removed var (diff) | |
download | ansible-da56312322358f62ae93a7924ef55c78fb5ec878.tar.xz ansible-da56312322358f62ae93a7924ef55c78fb5ec878.zip |
Openstack inventory updates from Tower. Includes changes from https://github.com/ansible/ansible/pull/10491 and https://github.com/ansible/ansible/pull/10776.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/openstack.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/inventory/openstack.py b/contrib/inventory/openstack.py index 819380c796..103be1bee0 100755 --- a/contrib/inventory/openstack.py +++ b/contrib/inventory/openstack.py @@ -51,11 +51,12 @@ import shade class OpenStackInventory(object): def __init__(self, private=False, refresh=False): + config_files = os_client_config.config.CONFIG_FILES + config_files.append('/etc/ansible/openstack.yml') self.openstack_config = os_client_config.config.OpenStackConfig( - os_client_config.config.CONFIG_FILES.append( - '/etc/ansible/openstack.yml'), - private) + config_files) self.clouds = shade.openstack_clouds(self.openstack_config) + self.private = private self.refresh = refresh self.cache_max_age = self.openstack_config.get_cache_max_age() @@ -92,6 +93,7 @@ class OpenStackInventory(object): hostvars = collections.defaultdict(dict) for cloud in self.clouds: + cloud.private = cloud.private or self.private # Cycle on servers for server in cloud.list_servers(): @@ -152,7 +154,7 @@ def main(): elif args.host: inventory.get_host(args.host) except shade.OpenStackCloudException as e: - print(e.message) + sys.stderr.write('%s\n' % e.message) sys.exit(1) sys.exit(0) |