Merge "Adds config to disable the password in stack"
This commit is contained in:
commit
4de120386a
@ -830,6 +830,21 @@ A dictionary of settings which can be used to enable optional services provided
|
|||||||
by cinder. Currently only the backup service is available.
|
by cinder. Currently only the backup service is available.
|
||||||
|
|
||||||
|
|
||||||
|
``OPENSTACK_HEAT_STACK``
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
.. versionadded:: 9.0.0(Mitaka)
|
||||||
|
|
||||||
|
Default: ``{'enable_user_pass': True}``
|
||||||
|
|
||||||
|
A dictionary of settings to use with heat stacks. Currently, the only setting
|
||||||
|
available is "enable_user_pass", which can be used to disable the password
|
||||||
|
field while launching the stack. Currently HEAT API needs user password to
|
||||||
|
perform all the heat operations because in HEAT API trusts is not enabled by
|
||||||
|
default. So, this setting can be set as "False" in-case HEAT uses trusts by
|
||||||
|
default otherwise it needs to be set as "True".
|
||||||
|
|
||||||
|
|
||||||
``OPENSTACK_NEUTRON_NETWORK``
|
``OPENSTACK_NEUTRON_NETWORK``
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.utils import html
|
from django.utils import html
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.decorators.debug import sensitive_variables # noqa
|
from django.views.decorators.debug import sensitive_variables # noqa
|
||||||
@ -281,18 +282,24 @@ class CreateStackForm(forms.SelfHandlingForm):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
parameters = kwargs.pop('parameters')
|
parameters = kwargs.pop('parameters')
|
||||||
# special case: load template data from API, not passed in params
|
# special case: load template data from API, not passed in params
|
||||||
if(kwargs.get('validate_me')):
|
if kwargs.get('validate_me'):
|
||||||
parameters = kwargs.pop('validate_me')
|
parameters = kwargs.pop('validate_me')
|
||||||
super(CreateStackForm, self).__init__(*args, **kwargs)
|
super(CreateStackForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
if self._stack_password_enabled():
|
||||||
|
self.fields['password'] = forms.CharField(
|
||||||
|
label=_('Password for user "%s"') % self.request.user.username,
|
||||||
|
help_text=_('This is required for operations to be performed '
|
||||||
|
'throughout the lifecycle of the stack'),
|
||||||
|
widget=forms.PasswordInput())
|
||||||
|
|
||||||
self._build_parameter_fields(parameters)
|
self._build_parameter_fields(parameters)
|
||||||
|
|
||||||
def _build_parameter_fields(self, template_validate):
|
def _stack_password_enabled(self):
|
||||||
self.fields['password'] = forms.CharField(
|
stack_settings = getattr(settings, 'OPENSTACK_HEAT_STACK', {})
|
||||||
label=_('Password for user "%s"') % self.request.user.username,
|
return stack_settings.get('enable_user_pass', True)
|
||||||
help_text=_('This is required for operations to be performed '
|
|
||||||
'throughout the lifecycle of the stack'),
|
|
||||||
widget=forms.PasswordInput())
|
|
||||||
|
|
||||||
|
def _build_parameter_fields(self, template_validate):
|
||||||
self.help_text = template_validate['Description']
|
self.help_text = template_validate['Description']
|
||||||
|
|
||||||
params = template_validate.get('Parameters', {})
|
params = template_validate.get('Parameters', {})
|
||||||
@ -368,8 +375,9 @@ class CreateStackForm(forms.SelfHandlingForm):
|
|||||||
'timeout_mins': data.get('timeout_mins'),
|
'timeout_mins': data.get('timeout_mins'),
|
||||||
'disable_rollback': not(data.get('enable_rollback')),
|
'disable_rollback': not(data.get('enable_rollback')),
|
||||||
'parameters': dict(params_list),
|
'parameters': dict(params_list),
|
||||||
'password': data.get('password')
|
|
||||||
}
|
}
|
||||||
|
if data.get('password'):
|
||||||
|
fields['password'] = data.get('password')
|
||||||
|
|
||||||
if data.get('template_data'):
|
if data.get('template_data'):
|
||||||
fields['template'] = data.get('template_data')
|
fields['template'] = data.get('template_data')
|
||||||
@ -422,8 +430,9 @@ class EditStackForm(CreateStackForm):
|
|||||||
'timeout_mins': data.get('timeout_mins'),
|
'timeout_mins': data.get('timeout_mins'),
|
||||||
'disable_rollback': not(data.get('enable_rollback')),
|
'disable_rollback': not(data.get('enable_rollback')),
|
||||||
'parameters': dict(params_list),
|
'parameters': dict(params_list),
|
||||||
'password': data.get('password')
|
|
||||||
}
|
}
|
||||||
|
if data.get('password'):
|
||||||
|
fields['password'] = data.get('password')
|
||||||
|
|
||||||
# if the user went directly to this form, resubmit the existing
|
# if the user went directly to this form, resubmit the existing
|
||||||
# template data. otherwise, submit what they had from the first form
|
# template data. otherwise, submit what they had from the first form
|
||||||
|
@ -277,6 +277,12 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
'supported_vnic_types': ['*']
|
'supported_vnic_types': ['*']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The OPENSTACK_HEAT_STACK settings can be used to disable password
|
||||||
|
# field required while launching the stack.
|
||||||
|
OPENSTACK_HEAT_STACK = {
|
||||||
|
'enable_user_pass': True,
|
||||||
|
}
|
||||||
|
|
||||||
# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
|
# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
|
||||||
# in the OpenStack Dashboard related to the Image service, such as the list
|
# in the OpenStack Dashboard related to the Image service, such as the list
|
||||||
# of supported image formats.
|
# of supported image formats.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user