diff options
Diffstat (limited to 'tuskar_ui')
-rw-r--r-- | tuskar_ui/api.py | 15 | ||||
-rw-r--r-- | tuskar_ui/infrastructure/overcloud/tests.py | 47 | ||||
-rw-r--r-- | tuskar_ui/infrastructure/overcloud/workflows/undeployed_configuration.py | 210 |
3 files changed, 41 insertions, 231 deletions
diff --git a/tuskar_ui/api.py b/tuskar_ui/api.py index 15f6ed11..fe10cbdb 100644 --- a/tuskar_ui/api.py +++ b/tuskar_ui/api.py @@ -267,6 +267,21 @@ class Overcloud(base.APIResourceWrapper): return [cls(oc, request=request) for oc in ocs] @classmethod + def template_parameters(cls, request): + """Return a list of needed template parameters + + :param request: request object + :type request: django.http.HttpRequest + + :return: dict with key/value parameters + :rtype: dict + """ + parameters = tuskarclient(request).overclouds.template_parameters() + # FIXME(lsmola) python client is converting the result to + # object, we have to return it better from client or API + return parameters._info + + @classmethod @handle_errors(_("Unable to retrieve deployment")) def get(cls, request, overcloud_id): """Return the Tuskar Overcloud that matches the ID diff --git a/tuskar_ui/infrastructure/overcloud/tests.py b/tuskar_ui/infrastructure/overcloud/tests.py index 2f5707bb..d12cadb7 100644 --- a/tuskar_ui/infrastructure/overcloud/tests.py +++ b/tuskar_ui/infrastructure/overcloud/tests.py @@ -42,6 +42,23 @@ tuskar_data.data(TEST_DATA) def _mock_overcloud(**kwargs): oc = None stack = TEST_DATA.heatclient_stacks.first() + template_parameters = { + "NeutronPublicInterfaceRawDevice": { + "Default": "", + "Type": "String", + "NoEcho": "false", + "Description": ("If set, the public interface is a vlan with this " + "device as the raw device."), + }, + "HeatPassword": { + "Default": "unset", + "Type": "String", + "NoEcho": "true", + "Description": ("The password for the Heat service account, used " + "by the Heat services.") + }, + } + params = { 'spec_set': [ 'counts', @@ -58,6 +75,7 @@ def _mock_overcloud(**kwargs): 'stack', 'stack_events', 'update', + 'template_parameters', ], 'counts': [], 'create.side_effect': lambda *args, **kwargs: oc, @@ -73,6 +91,7 @@ def _mock_overcloud(**kwargs): 'stack_events': [], 'stack': stack, 'update.side_effect': lambda *args, **kwargs: oc, + 'template_parameters.return_value': template_parameters, } params.update(kwargs) with patch('tuskar_ui.api.Overcloud', **params) as Overcloud: @@ -112,6 +131,7 @@ class OvercloudTests(test.BaseAdminViewTests): 'spec_set': ['list'], 'list.return_value': roles, }), + _mock_overcloud(), patch('tuskar_ui.api.Node', **{ 'spec_set': ['list'], 'list.return_value': [], @@ -166,33 +186,7 @@ class OvercloudTests(test.BaseAdminViewTests): ('4', ''): 0, }, { 'NeutronPublicInterfaceRawDevice': '', - 'NovaComputeDriver': '', - 'NeutronPassword': '', - 'NeutronFlatNetworks': '', - 'NeutronPublicInterfaceDefaultRoute': '', 'HeatPassword': '', - 'notcomputeImage': '', - 'NovaImage': '', - 'SSLKey': '', - 'KeyName': '', - 'GlancePassword': '', - 'CeilometerPassword': '', - 'NtpServer': '', - 'CinderPassword': '', - 'ImageUpdatePolicy': '', - 'NeutronPublicInterface': '', - 'NovaPassword': '', - 'AdminToken': '', - 'SwiftHashSuffix': '', - 'NeutronPublicInterfaceIP': '', - 'NovaComputeLibvirtType': '', - 'AdminPassword': '', - 'CeilometerComputeAgent': '', - 'NeutronBridgeMappings': '', - 'SwiftPassword': '', - 'CeilometerMeteringSecret': '', - 'SSLCertificate': '', - 'Flavor': '', }), ]) roles[0].flavor_id = old_flavor_id @@ -243,6 +237,7 @@ class OvercloudTests(test.BaseAdminViewTests): 'spec_set': ['list'], 'list.return_value': roles, }), + _mock_overcloud(), patch('tuskar_ui.api.Node', **{ 'spec_set': ['list'], 'list.return_value': [node], diff --git a/tuskar_ui/infrastructure/overcloud/workflows/undeployed_configuration.py b/tuskar_ui/infrastructure/overcloud/workflows/undeployed_configuration.py index 0fa2577e..65d4e101 100644 --- a/tuskar_ui/infrastructure/overcloud/workflows/undeployed_configuration.py +++ b/tuskar_ui/infrastructure/overcloud/workflows/undeployed_configuration.py @@ -15,210 +15,9 @@ import django.forms from django.utils.translation import ugettext_lazy as _ import horizon.workflows +from tuskar_ui import api from tuskar_ui import utils -# TODO(rdopieralski) Get this from the Heat template. -TEMPLATE_DATA = { - "Description": ("Nova API,Keystone,Heat Engine and API,Glance,Neutron," - "Dedicated MySQL server,Dedicated RabbitMQ Server," - "Group of Nova Computes," - "ssl-source: SSL endpoint metadata for openstack," - "Swift-common: OpenStack object storage common " - "configurations"), - - "Parameters": { - "NeutronPublicInterfaceRawDevice": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": ("If set, the public interface is a vlan with this " - "device as the raw device."), - }, - "HeatPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the Heat service account, used " - "by the Heat services.") - }, - "NovaComputeDriver": { - "Default": "libvirt.LibvirtDriver", - "Type": "String", - "NoEcho": "false", - "Description": "" - }, - "NeutronPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the neutron service account, " - "used by neutron agents."), - }, - "NeutronBridgeMappings": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": "The OVS logical->physical bridge mappings to use.", - }, - "NeutronPublicInterfaceDefaultRoute": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": ("A custom default route for the " - "NeutronPublicInterface."), - }, - "GlancePassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the glance service account, " - "used by the glance services."), - }, - "notcomputeImage": { - "Default": "overcloud-control", - "Type": "String", - "NoEcho": "false", - "Description": "", - }, - "NovaImage": { - "Default": "overcloud-compute", - "Type": "String", - "NoEcho": "false", - "Description": "" - }, - "SSLKey": { - "Default": "", - "Type": "String", - "NoEcho": "true", - "Description": ("If set, the contents of an SSL certificate .key " - "file for encrypting SSL endpoints."), - }, - "KeyName": { - "Default": "default", - "Type": "String", - "NoEcho": "false", - "Description": ("Name of an existing EC2 KeyPair to enable SSH " - "access to the instances"), - }, - "CeilometerPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": "The password for the ceilometer service account.", - }, - "NtpServer": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": "", - }, - "CinderPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the cinder service account, " - "used by cinder-api."), - }, - "ImageUpdatePolicy": { - "Default": "REPLACE", - "Type": "String", - "NoEcho": "false", - "Description": ("What policy to use when reconstructing " - "instances. REBUILD for rebuilds, " - "REBUILD_PRESERVE_EPHEMERAL to preserve /mnt."), - }, - "NeutronPublicInterface": { - "Default": "eth0", - "Type": "String", - "NoEcho": "false", - "Description": ("What interface to bridge onto br-ex for network " - "nodes."), - }, - "NovaPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the nova service account, used " - "by nova-api."), - }, - "AdminToken": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": "The keystone auth secret." - }, - "NovaComputeLibvirtType": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": "", - }, - "NeutronPublicInterfaceIP": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": ("A custom IP address to put onto the " - "NeutronPublicInterface."), - }, - "SwiftHashSuffix": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("A random string to be used as a salt when " - "hashing to determine mappings in the ring."), - }, - "AdminPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the keystone admin account, " - "used for monitoring, querying neutron etc."), - }, - "CeilometerComputeAgent": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": ("Indicates whether the Compute agent is present " - "and expects nova-compute to be configured " - "accordingly"), - "AllowedValues": ["", "Present"], - }, - "NeutronFlatNetworks": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": ("If set, flat networks to configure in neutron " - "plugins."), - }, - "SwiftPassword": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": ("The password for the swift service account, " - "used by the swift proxy services."), - }, - "CeilometerMeteringSecret": { - "Default": "unset", - "Type": "String", - "NoEcho": "true", - "Description": "Secret shared by the ceilometer services.", - }, - "SSLCertificate": { - "Default": "", - "Type": "String", - "NoEcho": "true", - "Description": ("If set, the contents of an SSL certificate .crt " - "file for encrypting SSL endpoints."), - }, - "Flavor": { - "Default": "baremetal", - "Type": "String", - "NoEcho": "false", - "Description": "Flavor to request when deploying.", - }, - }, -} - def make_field(name, Type, NoEcho, Default, Description, AllowedValues=None, **kwargs): @@ -253,10 +52,11 @@ class Action(horizon.workflows.Action): slug = 'deployed_configuration' name = _("Configuration") - def __init__(self, *args, **kwargs): - super(Action, self).__init__(*args, **kwargs) - parameters = TEMPLATE_DATA['Parameters'].items() + def __init__(self, request, *args, **kwargs): + super(Action, self).__init__(request, *args, **kwargs) + parameters = api.Overcloud.template_parameters(request).items() parameters.sort() + for name, data in parameters: self.fields[name] = make_field(name, **data) |