diff --git a/cloud/openstack/_quantum_network.py b/cloud/openstack/_quantum_network.py index 93b10880823..a0a29e6a062 100644 --- a/cloud/openstack/_quantum_network.py +++ b/cloud/openstack/_quantum_network.py @@ -164,18 +164,17 @@ def _get_neutron_client(module, kwargs): def _set_tenant_id(module): global _os_tenant_id if not module.params['tenant_name']: - tenant_name = module.params['login_tenant_name'] + _os_tenant_id = _os_keystone.tenant_id else: tenant_name = module.params['tenant_name'] - for tenant in _os_keystone.tenants.list(): - if tenant.name == tenant_name: - _os_tenant_id = tenant.id - break + for tenant in _os_keystone.tenants.list(): + if tenant.name == tenant_name: + _os_tenant_id = tenant.id + break if not _os_tenant_id: module.fail_json(msg = "The tenant id cannot be found, please check the parameters") - def _get_net_id(neutron, module): kwargs = { 'tenant_id': _os_tenant_id, diff --git a/cloud/openstack/_quantum_router.py b/cloud/openstack/_quantum_router.py index 252e1618d90..0c4d2063017 100644 --- a/cloud/openstack/_quantum_router.py +++ b/cloud/openstack/_quantum_router.py @@ -136,17 +136,16 @@ def _get_neutron_client(module, kwargs): def _set_tenant_id(module): global _os_tenant_id if not module.params['tenant_name']: - login_tenant_name = module.params['login_tenant_name'] + _os_tenant_id = _os_keystone.tenant_id else: - login_tenant_name = module.params['tenant_name'] + tenant_name = module.params['tenant_name'] - for tenant in _os_keystone.tenants.list(): - if tenant.name == login_tenant_name: - _os_tenant_id = tenant.id - break + for tenant in _os_keystone.tenants.list(): + if tenant.name == tenant_name: + _os_tenant_id = tenant.id + break if not _os_tenant_id: - module.fail_json(msg = "The tenant id cannot be found, please check the parameters") - + module.fail_json(msg = "The tenant id cannot be found, please check the parameters") def _get_router_id(module, neutron): kwargs = { diff --git a/cloud/openstack/_quantum_router_interface.py b/cloud/openstack/_quantum_router_interface.py index 4073c7d3b10..c936e98ad65 100644 --- a/cloud/openstack/_quantum_router_interface.py +++ b/cloud/openstack/_quantum_router_interface.py @@ -138,18 +138,17 @@ def _get_neutron_client(module, kwargs): def _set_tenant_id(module): global _os_tenant_id if not module.params['tenant_name']: - login_tenant_name = module.params['login_tenant_name'] + _os_tenant_id = _os_keystone.tenant_id else: - login_tenant_name = module.params['tenant_name'] + tenant_name = module.params['tenant_name'] - for tenant in _os_keystone.tenants.list(): - if tenant.name == login_tenant_name: - _os_tenant_id = tenant.id - break + for tenant in _os_keystone.tenants.list(): + if tenant.name == tenant_name: + _os_tenant_id = tenant.id + break if not _os_tenant_id: module.fail_json(msg = "The tenant id cannot be found, please check the parameters") - def _get_router_id(module, neutron): kwargs = { 'name': module.params['router_name'], diff --git a/cloud/openstack/_quantum_subnet.py b/cloud/openstack/_quantum_subnet.py index 105ca32c582..f2f125f64c8 100644 --- a/cloud/openstack/_quantum_subnet.py +++ b/cloud/openstack/_quantum_subnet.py @@ -170,16 +170,16 @@ def _get_neutron_client(module, kwargs): def _set_tenant_id(module): global _os_tenant_id if not module.params['tenant_name']: - tenant_name = module.params['login_tenant_name'] + _os_tenant_id = _os_keystone.tenant_id else: tenant_name = module.params['tenant_name'] - for tenant in _os_keystone.tenants.list(): - if tenant.name == tenant_name: - _os_tenant_id = tenant.id - break + for tenant in _os_keystone.tenants.list(): + if tenant.name == tenant_name: + _os_tenant_id = tenant.id + break if not _os_tenant_id: - module.fail_json(msg = "The tenant id cannot be found, please check the parameters") + module.fail_json(msg = "The tenant id cannot be found, please check the parameters") def _get_net_id(neutron, module): kwargs = {