summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/utils/settings_utils.py
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2018-02-22 11:42:52 -0700
committerspisarski <s.pisarski@cablelabs.com>2018-02-22 11:42:52 -0700
commitc711acf8ae3e4ad6f746500747857bcc9fd6f7be (patch)
tree4eeba467b4f42b37e935ccfff6b547bd11c65778 /snaps/openstack/utils/settings_utils.py
parentf3553913925b8ee5869c8e06047d6e4161a968c7 (diff)
Changed pattern on how objects lookup themselves by name and project.
The pattern being replaced has unwittingly added the requirement that all creator credentials must be of type 'admin' as when looking up the associated project ID required a call to keystone.projects.list(). As the SNAPS integration tests were always creating users with an 'admin' role, this issue was not caught. As part of this patch, integration test users will no longer be admin. JIRA: SNAPS-274 Change-Id: I02957f69e31a9d4dfa63362d371f061687e59fbf Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/utils/settings_utils.py')
-rw-r--r--snaps/openstack/utils/settings_utils.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/snaps/openstack/utils/settings_utils.py b/snaps/openstack/utils/settings_utils.py
index c14437d..e43f8f5 100644
--- a/snaps/openstack/utils/settings_utils.py
+++ b/snaps/openstack/utils/settings_utils.py
@@ -224,15 +224,16 @@ def create_keypair_config(heat_cli, stack, keypair, pk_output_key):
return KeypairConfig(name=keypair.name)
-def create_vm_inst_config(nova, neutron, server, project_id):
+def create_vm_inst_config(nova, keystone, neutron, server, project_name):
"""
Returns a VmInstanceConfig object
note: if the server instance is not active, the PortSettings objects will
not be generated resulting in an invalid configuration
:param nova: the nova client
+ :param keystone: the keystone client
:param neutron: the neutron client
:param server: a SNAPS-OO VmInst domain object
- :param project_id: the associated project ID
+ :param project_name: the associated project name
:return:
"""
@@ -245,7 +246,7 @@ def create_vm_inst_config(nova, neutron, server, project_id):
kwargs['port_settings'] = __create_port_configs(neutron, server.ports)
kwargs['security_group_names'] = server.sec_grp_names
kwargs['floating_ip_settings'] = __create_floatingip_config(
- neutron, kwargs['port_settings'], project_id)
+ neutron, keystone, kwargs['port_settings'], project_name)
return VmInstanceConfig(**kwargs)
@@ -282,11 +283,12 @@ def __create_port_configs(neutron, ports):
return out
-def __create_floatingip_config(neutron, port_settings, project_id):
+def __create_floatingip_config(neutron, keystone, port_settings, project_name):
"""
Returns a list of FloatingIpConfig objects as they pertain to an
existing deployed server instance
:param neutron: the neutron client
+ :param keystone: the keystone client
:param port_settings: list of SNAPS-OO PortConfig objects
:return: a list of FloatingIpConfig objects or an empty list if no
floating IPs have been created
@@ -298,10 +300,10 @@ def __create_floatingip_config(neutron, port_settings, project_id):
fip_ports = list()
for port_setting in port_settings:
setting_port = neutron_utils.get_port(
- neutron, port_setting, project_id=project_id)
+ neutron, keystone, port_setting, project_name=project_name)
if setting_port:
network = neutron_utils.get_network(
- neutron, network_name=port_setting.network_name)
+ neutron, keystone, network_name=port_setting.network_name)
network_ports = neutron_utils.get_ports(neutron, network)
if network_ports:
for setting_port in network_ports: