Add MS SQL form
Change-Id: Ice2ca4eca53401bc80386f10349193e7a8013dae
This commit is contained in:
parent
1391d75788
commit
aaea34dea1
|
@ -17,13 +17,17 @@ IIS_NAME = 'webServer'
|
|||
ASP_NAME = 'aspNetApp'
|
||||
IIS_FARM_NAME = 'aspNetAppFarm'
|
||||
ASP_FARM_NAME = 'webServerFarm'
|
||||
MSSQL_NAME = 'msSqlServer'
|
||||
|
||||
SERVICE_NAMES = (AD_NAME, IIS_NAME, ASP_NAME,
|
||||
IIS_FARM_NAME, ASP_FARM_NAME, MSSQL_NAME)
|
||||
|
||||
SERVICE_NAMES = (AD_NAME, IIS_NAME, ASP_NAME, IIS_FARM_NAME, ASP_FARM_NAME)
|
||||
SERVICE_NAME_DICT = {AD_NAME: 'Active Directory',
|
||||
IIS_NAME: 'IIS',
|
||||
ASP_NAME: 'ASP.NET Application',
|
||||
IIS_FARM_NAME: 'IIS Farm',
|
||||
ASP_FARM_NAME: 'ASP.NET Farm'}
|
||||
ASP_FARM_NAME: 'ASP.NET Farm',
|
||||
MSSQL_NAME: 'MS SQL Server'}
|
||||
|
||||
STATUS_ID_READY = 'ready'
|
||||
STATUS_ID_PENDING = 'pending'
|
||||
|
|
|
@ -65,13 +65,15 @@ class WizardFormServiceType(forms.Form):
|
|||
iis_farm_service = (IIS_FARM_NAME,
|
||||
'Internet Information Services Web Farm')
|
||||
asp_farm_service = (ASP_FARM_NAME, 'ASP.NET Application Web Farm')
|
||||
ms_sql_service = (MSSQL_NAME, 'MS SQL Server')
|
||||
service = forms.ChoiceField(label=_('Service Type'),
|
||||
choices=[
|
||||
ad_service,
|
||||
iis_service,
|
||||
asp_service,
|
||||
iis_farm_service,
|
||||
asp_farm_service
|
||||
asp_farm_service,
|
||||
ms_sql_service
|
||||
])
|
||||
|
||||
|
||||
|
@ -90,10 +92,10 @@ class ServiceConfigurationForm(forms.Form):
|
|||
admin_pwd2 = form_data.get('adm_password2')
|
||||
compare(admin_pwd1, admin_pwd2)
|
||||
|
||||
recovery_pwd1 = form_data.get('recovery_password')
|
||||
if recovery_pwd1:
|
||||
recovery_pwd2 = form_data.get('recovery_password2')
|
||||
compare(recovery_pwd1, recovery_pwd2, admin=False)
|
||||
second_pwd1 = form_data.get('password_field')
|
||||
if second_pwd1:
|
||||
second_pwd2 = form_data.get('password_field2')
|
||||
compare(second_pwd1, second_pwd2, admin=False)
|
||||
return self.cleaned_data
|
||||
|
||||
|
||||
|
@ -116,9 +118,9 @@ class CommonPropertiesExtension(object):
|
|||
for field, instance in self.fields.iteritems():
|
||||
if not instance.required:
|
||||
instance.widget.attrs['placeholder'] = 'Optional'
|
||||
if field in ['adm_password', 'recovery_password']:
|
||||
if field in ['adm_password', 'password_field']:
|
||||
instance.widget.attrs['class'] = 'password'
|
||||
if field in ['adm_password2', 'recovery_password2']:
|
||||
if field in ['adm_password2', 'password_field2']:
|
||||
instance.widget.attrs['class'] = 'confirm_password'
|
||||
|
||||
|
||||
|
@ -154,9 +156,9 @@ class WizardFormADConfiguration(ServiceConfigurationForm,
|
|||
help_text=_('Retype your password'),
|
||||
error_messages=CONFIRM_ERR_DICT)
|
||||
|
||||
recovery_password = PasswordField(_('Recovery password'))
|
||||
password_field = PasswordField(_('Recovery password'))
|
||||
|
||||
recovery_password2 = PasswordField(
|
||||
password_field2 = PasswordField(
|
||||
_('Confirm password'),
|
||||
error_messages=CONFIRM_ERR_DICT,
|
||||
help_text=_('Retype your password'))
|
||||
|
@ -173,7 +175,7 @@ class WizardFormIISConfiguration(ServiceConfigurationForm,
|
|||
_(u'Just letters, numbers, underscores \
|
||||
and hyphens are allowed.'), 'invalid')
|
||||
|
||||
iis_name = forms.CharField(
|
||||
service_name = forms.CharField(
|
||||
label=_('Service Name'),
|
||||
min_length=2,
|
||||
max_length=64,
|
||||
|
@ -260,6 +262,33 @@ class WizardFormAspNetFarmConfiguration(WizardFormAspNetAppConfiguration,
|
|||
CommonPropertiesExtension.__init__(self)
|
||||
|
||||
|
||||
class WizardFormMSSQLConfiguration(WizardFormIISConfiguration,
|
||||
CommonPropertiesExtension):
|
||||
mixed_mode = forms.BooleanField(
|
||||
label=_('Mixed-mode Authentication '),
|
||||
required=False)
|
||||
|
||||
password_field = PasswordField(
|
||||
_('SA password'),
|
||||
help_text=_('SQL server System Administrator account'))
|
||||
|
||||
password_field2 = PasswordField(
|
||||
_('Confirm password'),
|
||||
error_messages=CONFIRM_ERR_DICT,
|
||||
help_text=_('Retype your password'))
|
||||
|
||||
instance_count = forms.IntegerField(
|
||||
label=_('Instance Count'),
|
||||
min_value=1,
|
||||
max_value=100,
|
||||
initial=1,
|
||||
help_text=_('Enter an integer value between 1 and 100'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(WizardFormMSSQLConfiguration, self).__init__(*args, **kwargs)
|
||||
CommonPropertiesExtension.__init__(self)
|
||||
|
||||
|
||||
class WizardInstanceConfiguration(forms.Form):
|
||||
flavor = forms.ChoiceField(label=_('Instance flavor'),
|
||||
required=False)
|
||||
|
@ -304,4 +333,5 @@ FORMS = [('service_choice', WizardFormServiceType),
|
|||
(ASP_NAME, WizardFormAspNetAppConfiguration),
|
||||
(IIS_FARM_NAME, WizardFormIISFarmConfiguration),
|
||||
(ASP_FARM_NAME, WizardFormAspNetFarmConfiguration),
|
||||
(MSSQL_NAME, WizardFormMSSQLConfiguration),
|
||||
('instance_configuration', WizardInstanceConfiguration)]
|
||||
|
|
|
@ -34,7 +34,8 @@ from muranodashboard.panel import api
|
|||
from muranoclient.common.exceptions import HTTPUnauthorized, \
|
||||
CommunicationError, HTTPInternalServerError, HTTPForbidden
|
||||
|
||||
from consts import AD_NAME, IIS_NAME, ASP_NAME, IIS_FARM_NAME, ASP_FARM_NAME
|
||||
from consts import AD_NAME, IIS_NAME, ASP_NAME, IIS_FARM_NAME, ASP_FARM_NAME,\
|
||||
MSSQL_NAME
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -63,8 +64,13 @@ def is_service_iis_farm(wizard):
|
|||
def is_service_asp_farm(wizard):
|
||||
return get_service_type(wizard) == ASP_FARM_NAME
|
||||
|
||||
|
||||
def is_service_mssql_farm(wizard):
|
||||
return get_service_type(wizard) == MSSQL_NAME
|
||||
|
||||
SERVICE_CHECKER = (is_service_ad, is_service_iis,
|
||||
is_service_asp, is_service_iis_farm, is_service_asp_farm)
|
||||
is_service_asp, is_service_iis_farm,
|
||||
is_service_asp_farm, is_service_mssql_farm)
|
||||
|
||||
|
||||
class Wizard(ModalFormMixin, SessionWizardView):
|
||||
|
@ -94,7 +100,7 @@ class Wizard(ModalFormMixin, SessionWizardView):
|
|||
parameters['domain'] = parameters['name'] # Fix Me in orchestrator
|
||||
parameters['adminPassword'] = \
|
||||
str(step1_data.get('adm_password', ''))
|
||||
recovery_password = str(step1_data.get('recovery_password', ''))
|
||||
recovery_password = str(step1_data.get('password_field', ''))
|
||||
parameters['units'].append({'isMaster': True,
|
||||
'recoveryPassword': recovery_password,
|
||||
'location': 'west-dc'})
|
||||
|
@ -106,16 +112,16 @@ class Wizard(ModalFormMixin, SessionWizardView):
|
|||
})
|
||||
|
||||
elif service_type in [IIS_NAME, ASP_NAME,
|
||||
IIS_FARM_NAME, ASP_FARM_NAME]:
|
||||
IIS_FARM_NAME, ASP_FARM_NAME, MSSQL_NAME]:
|
||||
password = step1_data.get('adm_password', '')
|
||||
parameters['name'] = str(step1_data.get('iis_name', 'noname'))
|
||||
parameters['name'] = str(step1_data.get('service_name', 'noname'))
|
||||
parameters['credentials'] = {'username': 'Administrator',
|
||||
'password': password}
|
||||
|
||||
parameters['domain'] = str(step1_data.get('iis_domain', ''))
|
||||
password = step1_data.get('adm_password', '')
|
||||
domain = step1_data.get('iis_domain', '')
|
||||
parameters['name'] = str(step1_data.get('iis_name', 'noname'))
|
||||
parameters['name'] = str(step1_data.get('service_name', 'noname'))
|
||||
parameters['domain'] = parameters['name']
|
||||
parameters['adminPassword'] = password
|
||||
parameters['domain'] = str(domain)
|
||||
|
@ -129,6 +135,15 @@ class Wizard(ModalFormMixin, SessionWizardView):
|
|||
parameters['loadBalancerPort'] = \
|
||||
step1_data.get('lb_port', '80')
|
||||
|
||||
if service_type == MSSQL_NAME:
|
||||
sa_password = str(
|
||||
step1_data.get('password_field', ''))
|
||||
mixed_mode = str(
|
||||
step1_data.get('mixed_mode', ''))
|
||||
|
||||
parameters['saPassword'] = sa_password
|
||||
parameters['mixedModeAuth'] = mixed_mode
|
||||
|
||||
for unit in range(instance_count):
|
||||
parameters['units'].append({})
|
||||
|
||||
|
|
|
@ -148,6 +148,11 @@
|
|||
<strong>{% blocktrans %} Load Balancer port {% endblocktrans %}</strong>
|
||||
{% blocktrans %} Specify port number where Load Balancer will be running {% endblocktrans %}
|
||||
</p>
|
||||
|
||||
{% elif type == 'msSqlServer' %}
|
||||
<p>{% blocktrans %} MS SQL Server servers {% endblocktrans %}</p>
|
||||
<p>Add a discription here</p>
|
||||
|
||||
{% elif type == '' %}
|
||||
<p>{% blocktrans %} Please try again {% endblocktrans %}</p>
|
||||
|
||||
|
|
Loading…
Reference in New Issue