1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #4 from mavimo/master

Add support for ./nova.ini file
This commit is contained in:
Michael DeHaan 2012-09-18 19:06:18 -07:00
commit 95bbe2ef8b

View file

@ -76,9 +76,23 @@ except:
# executed with no parameters, return the list of
# all groups and hosts
def nova_load_config_file():
p = ConfigParser.SafeConfigParser()
path1 = os.getcwd() + "/nova.ini"
path2 = os.path.expanduser(os.environ.get('ANSIBLE_CONFIG', "~/nova.ini"))
path3 = "/etc/ansible/nova.ini"
config = ConfigParser.SafeConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + '/nova.ini')
if os.path.exists(path1):
p.read(path1)
elif os.path.exists(path2):
p.read(path2)
elif os.path.exists(path3):
p.read(path3)
else:
return None
return p
config = nova_load_config_file()
client = nova_client.Client(
version = config.get('openstack', 'version'),