summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Guerri <davide.guerri@gmail.com>2015-04-20 15:11:12 +0100
committerDavide Guerri <davide.guerri@gmail.com>2015-04-20 15:11:12 +0100
commit89024bf08616a7147f94249ccf7e64617b5ea8b9 (patch)
treedec9010ebec4a6dff5539a98c79362dd2d0f81ea
parent05836c9bd9e3925c84fb97402bd70718eeb48bff (diff)
downloadopenstack-ansible-modules-89024bf08616a7147f94249ccf7e64617b5ea8b9.tar.gz
Add missing region_name in keystone auth
-rw-r--r--neutron_floating_ip21
1 files changed, 11 insertions, 10 deletions
diff --git a/neutron_floating_ip b/neutron_floating_ip
index 4c14102..6d3ccd3 100644
--- a/neutron_floating_ip
+++ b/neutron_floating_ip
@@ -89,10 +89,12 @@ EXAMPLES = '''
def _get_ksclient(module, kwargs):
try:
- kclient = ksclient.Client(username=kwargs.get('login_username'),
- password=kwargs.get('login_password'),
- tenant_name=kwargs.get('login_tenant_name'),
- auth_url=kwargs.get('auth_url'))
+ kclient = ksclient.Client(
+ username=module.params.get('login_username'),
+ password=module.params.get('login_password'),
+ tenant_name=module.params.get('login_tenant_name'),
+ auth_url=module.params.get('auth_url'),
+ region_name=module.params.get('region_name'))
except Exception as e:
module.fail_json(msg = "Error authenticating to the keystone: %s " % e.message)
global _os_keystone
@@ -136,7 +138,7 @@ def _get_server_state(module, nova):
except Exception as e:
module.fail_json(msg = "Error in getting the server list: %s" % e.message)
return server_info, server
-
+
def _get_port_info(neutron, module, instance_id):
if module.params['port_network_name'] is None:
kwargs = {
@@ -158,7 +160,7 @@ def _get_port_info(neutron, module, instance_id):
if not ports['ports']:
return None, None
return ports['ports'][0]['fixed_ips'][0]['ip_address'], ports['ports'][0]['id']
-
+
def _get_floating_ip(module, neutron, fixed_ip_address):
kwargs = {
'fixed_ip_address': fixed_ip_address
@@ -222,7 +224,7 @@ def _update_floating_ip(neutron, module, port_id, floating_ip_id):
def main():
-
+
module = AnsibleModule(
argument_spec = dict(
login_username = dict(default='admin'),
@@ -236,14 +238,14 @@ def main():
state = dict(default='present', choices=['absent', 'present'])
),
)
-
+
try:
nova = nova_client.Client(module.params['login_username'], module.params['login_password'],
module.params['login_tenant_name'], module.params['auth_url'], service_type='compute')
neutron = _get_neutron_client(module, module.params)
except Exception as e:
module.fail_json(msg="Error in authenticating to nova: %s" % e.message)
-
+
server_info, server_obj = _get_server_state(module, nova)
if not server_info:
module.fail_json(msg="The instance name provided cannot be found")
@@ -271,4 +273,3 @@ def main():
from ansible.module_utils.basic import *
main()
-