pull/11447/head
Chris Church 9 years ago
parent 3e5dbd045f
commit da56312322

@ -51,11 +51,12 @@ import shade
class OpenStackInventory(object): class OpenStackInventory(object):
def __init__(self, private=False, refresh=False): 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( self.openstack_config = os_client_config.config.OpenStackConfig(
os_client_config.config.CONFIG_FILES.append( config_files)
'/etc/ansible/openstack.yml'),
private)
self.clouds = shade.openstack_clouds(self.openstack_config) self.clouds = shade.openstack_clouds(self.openstack_config)
self.private = private
self.refresh = refresh self.refresh = refresh
self.cache_max_age = self.openstack_config.get_cache_max_age() self.cache_max_age = self.openstack_config.get_cache_max_age()
@ -92,6 +93,7 @@ class OpenStackInventory(object):
hostvars = collections.defaultdict(dict) hostvars = collections.defaultdict(dict)
for cloud in self.clouds: for cloud in self.clouds:
cloud.private = cloud.private or self.private
# Cycle on servers # Cycle on servers
for server in cloud.list_servers(): for server in cloud.list_servers():
@ -152,7 +154,7 @@ def main():
elif args.host: elif args.host:
inventory.get_host(args.host) inventory.get_host(args.host)
except shade.OpenStackCloudException as e: except shade.OpenStackCloudException as e:
print(e.message) sys.stderr.write('%s\n' % e.message)
sys.exit(1) sys.exit(1)
sys.exit(0) sys.exit(0)

Loading…
Cancel
Save