diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2015-03-16 16:04:17 +0100 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2015-03-17 08:43:53 +0100 |
commit | 39d35140fc5707455c2cd971a40dd2db5e093284 (patch) | |
tree | 1a374f9e928b7a4c0331ac359112e059f868e5d1 | |
parent | a4c7ac6e974850b4c2c4b5f8ebc0bfe35d2682a8 (diff) | |
download | tuskar-ui-39d35140fc5707455c2cd971a40dd2db5e093284.tar.gz |
Make role validation more useful
We need to be able to show if a role is valid or not even when it's
not assigned to any flavor. To do that, we do the flavor check only
when there is at least one node assigned to the role.
Change-Id: I2e5253c54f5f3247781a18bc59e9c9f25ba74c11
-rw-r--r-- | tuskar_ui/api/tuskar.py | 6 | ||||
-rw-r--r-- | tuskar_ui/infrastructure/overview/forms.py | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/tuskar_ui/api/tuskar.py b/tuskar_ui/api/tuskar.py index 59e2cd31..89bb1e2b 100644 --- a/tuskar_ui/api/tuskar.py +++ b/tuskar_ui/api/tuskar.py @@ -474,11 +474,11 @@ class Role(base.APIResourceWrapper): node_count = plan.get_role_node_count(self) pending_required_params = list(Parameter.pending_parameters( Parameter.required_parameters(self.parameter_list(plan)))) - return not (node_count and ( + return not ( self.image(plan) is None or - self.flavor(plan) is None or + (node_count and self.flavor(plan) is None) or pending_required_params - )) + ) @property def id(self): diff --git a/tuskar_ui/infrastructure/overview/forms.py b/tuskar_ui/infrastructure/overview/forms.py index fbd041b1..ca4362eb 100644 --- a/tuskar_ui/infrastructure/overview/forms.py +++ b/tuskar_ui/infrastructure/overview/forms.py @@ -46,7 +46,10 @@ WEBROOT = getattr(settings, 'WEBROOT', '/') def validate_roles(request, plan): """Validates the roles in plan and returns dict describing the issues""" for role in plan.role_list: - if not role.is_valid_for_deployment(plan): + if ( + plan.get_role_node_count(role) and + not role.is_valid_for_deployment(plan) + ): message = { 'text': _(u"Configure Roles."), 'is_critical': True, |