Hostname template format + PEP8 fixes
Change-Id: I5ebbd2622440b006ee073b7eb29e80db6d968f0e
This commit is contained in:
parent
9742a70e8d
commit
b1a6015274
|
@ -1,14 +1,13 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import bunch
|
||||
|
@ -121,8 +120,9 @@ def environment_delete(request, environment_id):
|
|||
|
||||
|
||||
def environment_get(request, environment_id):
|
||||
session_id = Session.get(request, environment_id)
|
||||
log.debug('Environment::Get <Id: {0}>'.format(environment_id))
|
||||
env = muranoclient(request).environments.get(environment_id)
|
||||
env = muranoclient(request).environments.get(environment_id, session_id)
|
||||
log.debug('Environment::Get {0}'.format(env))
|
||||
return env
|
||||
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import string
|
||||
|
@ -88,7 +87,14 @@ class WizardFormConfiguration(forms.Form):
|
|||
pass
|
||||
|
||||
|
||||
class WizardFormADConfiguration(forms.Form):
|
||||
class CommonPropertiesExtension(object):
|
||||
def __init__(self):
|
||||
self.fields.insert(
|
||||
len(self.fields), 'unit_name_template',
|
||||
forms.CharField(label=_('Hostname template'), required=False))
|
||||
|
||||
|
||||
class WizardFormADConfiguration(forms.Form, CommonPropertiesExtension):
|
||||
dc_name = forms.CharField(label=_('Domain Name'),
|
||||
required=True)
|
||||
|
||||
|
@ -104,9 +110,10 @@ class WizardFormADConfiguration(forms.Form):
|
|||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(WizardFormADConfiguration, self).__init__(*args, **kwargs)
|
||||
CommonPropertiesExtension.__init__(self)
|
||||
|
||||
|
||||
class WizardFormIISConfiguration(forms.Form):
|
||||
class WizardFormIISConfiguration(forms.Form, CommonPropertiesExtension):
|
||||
iis_name = forms.CharField(label=_('Service Name'),
|
||||
required=True)
|
||||
|
||||
|
@ -127,6 +134,7 @@ class WizardFormIISConfiguration(forms.Form):
|
|||
self.fields['iis_domain'].choices = [("", "")] + \
|
||||
[(domain.name, domain.name)
|
||||
for domain in domains]
|
||||
CommonPropertiesExtension.__init__(self)
|
||||
|
||||
|
||||
class WebFarmExtension(forms.Form):
|
||||
|
@ -142,16 +150,26 @@ class WebFarmExtension(forms.Form):
|
|||
initial=80)
|
||||
|
||||
|
||||
class WizardFormAspNetAppConfiguration(WizardFormIISConfiguration):
|
||||
class WizardFormAspNetAppConfiguration(WizardFormIISConfiguration,
|
||||
WebFarmExtension,
|
||||
CommonPropertiesExtension):
|
||||
repository = forms.CharField(label=_('Git repository'),
|
||||
required=True)
|
||||
|
||||
|
||||
class WizardFormIISFarmConfiguration(WizardFormIISConfiguration,
|
||||
WebFarmExtension):
|
||||
pass
|
||||
WebFarmExtension,
|
||||
CommonPropertiesExtension):
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(WizardFormIISFarmConfiguration, self).__init__(
|
||||
request, *args, **kwargs)
|
||||
CommonPropertiesExtension.__init__(self)
|
||||
|
||||
|
||||
class WizardFormAspNetFarmConfiguration(WizardFormAspNetAppConfiguration,
|
||||
WebFarmExtension):
|
||||
pass
|
||||
WebFarmExtension,
|
||||
CommonPropertiesExtension):
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(WizardFormAspNetFarmConfiguration, self).__init__(
|
||||
request, *args, **kwargs)
|
||||
CommonPropertiesExtension.__init__(self)
|
||||
|
|
|
@ -17,4 +17,4 @@ import horizon
|
|||
from panel import Panel
|
||||
|
||||
project = horizon.get_dashboard('project')
|
||||
project.register(Panel)
|
||||
project.register(Panel)
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import horizon
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
|
|
@ -1,211 +1,209 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from horizon import messages
|
||||
from horizon import exceptions
|
||||
|
||||
from horizon import tables
|
||||
from muranodashboard.panel import api
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
STATUS_ID_READY = 'ready'
|
||||
STATUS_ID_PENDING = 'pending'
|
||||
STATUS_ID_DEPLOYING = 'deploying'
|
||||
|
||||
STATUS_CHOICES = (
|
||||
(None, True),
|
||||
('Ready to configure', True),
|
||||
('Ready', True),
|
||||
('Configuring', False),
|
||||
|
||||
)
|
||||
|
||||
STATUS_DISPLAY_CHOICES = (
|
||||
(STATUS_ID_READY, 'Ready'),
|
||||
(STATUS_ID_DEPLOYING, 'Deploy in progress'),
|
||||
(STATUS_ID_PENDING, 'Configuring'),
|
||||
('', 'Ready to configure'),
|
||||
)
|
||||
|
||||
|
||||
class CreateService(tables.LinkAction):
|
||||
name = 'CreateService'
|
||||
verbose_name = _('Create Service')
|
||||
url = 'horizon:project:murano:create'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, service):
|
||||
try:
|
||||
api.service_create(request, service)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t create service right now')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
||||
class CreateEnvironment(tables.LinkAction):
|
||||
name = 'CreateEnvironment'
|
||||
verbose_name = _('Create Environment')
|
||||
url = 'horizon:project:murano:create_environment'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, datum):
|
||||
return True
|
||||
|
||||
def action(self, request, environment):
|
||||
api.environment_create(request, environment)
|
||||
|
||||
|
||||
class DeleteEnvironment(tables.DeleteAction):
|
||||
data_type_singular = _("Environment")
|
||||
data_type_plural = _("Environments")
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, environment_id):
|
||||
try:
|
||||
api.environment_delete(request, environment_id)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t delete this environment right now')
|
||||
exceptions.handle(request, msg)
|
||||
|
||||
class DeleteService(tables.DeleteAction):
|
||||
data_type_singular = _('Service')
|
||||
data_type_plural = _('Services')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, service_id):
|
||||
try:
|
||||
api.service_delete(request, service_id)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t delete service right now')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
class DeployEnvironment(tables.BatchAction):
|
||||
name = 'deploy'
|
||||
action_present = _('Deploy')
|
||||
action_past = _('Deployed')
|
||||
data_type_singular = _('Environment')
|
||||
data_type_plural = _('Environments')
|
||||
classes = 'btn-launch'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
services = api.services_list(request, environment.id)
|
||||
|
||||
if status not in [STATUS_ID_DEPLOYING, None] and services:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def action(self, request, environment_id):
|
||||
try:
|
||||
api.environment_deploy(request, environment_id)
|
||||
except:
|
||||
msg = _('Unable to deploy. Maybe this environment \
|
||||
is already deploying by someone else. Try again later')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
||||
class ShowEnvironmentServices(tables.LinkAction):
|
||||
name = 'edit'
|
||||
verbose_name = _('Services')
|
||||
url = 'horizon:project:murano:services'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class UpdateEnvironmentRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, environment_id):
|
||||
return api.environment_get(request, environment_id)
|
||||
|
||||
|
||||
class UpdateServiceRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, service_id):
|
||||
return api.service_get(request, service_id)
|
||||
|
||||
|
||||
class EnvironmentsTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
link='horizon:project:murano:services',
|
||||
verbose_name=_('Name'))
|
||||
|
||||
status = tables.Column('status', verbose_name=_('Status'),
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
display_choices=STATUS_DISPLAY_CHOICES)
|
||||
|
||||
class Meta:
|
||||
name = 'murano'
|
||||
verbose_name = _('Environments')
|
||||
row_class = UpdateEnvironmentRow
|
||||
status_columns = ['status']
|
||||
table_actions = (CreateEnvironment, DeleteEnvironment)
|
||||
row_actions = (ShowEnvironmentServices, DeployEnvironment,\
|
||||
DeleteEnvironment)
|
||||
|
||||
|
||||
class ServicesTable(tables.DataTable):
|
||||
name = tables.Column('name', verbose_name=_('Name'),
|
||||
link=('horizon:project:murano:service_details'))
|
||||
|
||||
_type = tables.Column('service_type', verbose_name=_('Type'))
|
||||
|
||||
status = tables.Column('status', verbose_name=_('Status'),
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
display_choices=STATUS_DISPLAY_CHOICES)
|
||||
|
||||
operation = tables.Column('operation', verbose_name=_('Operation'))
|
||||
|
||||
class Meta:
|
||||
name = 'services'
|
||||
verbose_name = _('Services')
|
||||
row_class = UpdateServiceRow
|
||||
status_columns = ['status']
|
||||
table_actions = (CreateService, DeleteService)
|
||||
row_actions = (DeleteService,)
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from horizon import exceptions
|
||||
|
||||
from horizon import tables
|
||||
from muranodashboard.panel import api
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
STATUS_ID_READY = 'ready'
|
||||
STATUS_ID_PENDING = 'pending'
|
||||
STATUS_ID_DEPLOYING = 'deploying'
|
||||
|
||||
STATUS_CHOICES = (
|
||||
(None, True),
|
||||
('Ready to configure', True),
|
||||
('Ready', True),
|
||||
('Configuring', False),
|
||||
|
||||
)
|
||||
|
||||
STATUS_DISPLAY_CHOICES = (
|
||||
(STATUS_ID_READY, 'Ready'),
|
||||
(STATUS_ID_DEPLOYING, 'Deploy in progress'),
|
||||
(STATUS_ID_PENDING, 'Configuring'),
|
||||
('', 'Ready to configure'),
|
||||
)
|
||||
|
||||
|
||||
class CreateService(tables.LinkAction):
|
||||
name = 'CreateService'
|
||||
verbose_name = _('Create Service')
|
||||
url = 'horizon:project:murano:create'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, service):
|
||||
try:
|
||||
api.service_create(request, service)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t create service right now')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
||||
class CreateEnvironment(tables.LinkAction):
|
||||
name = 'CreateEnvironment'
|
||||
verbose_name = _('Create Environment')
|
||||
url = 'horizon:project:murano:create_environment'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, datum):
|
||||
return True
|
||||
|
||||
def action(self, request, environment):
|
||||
api.environment_create(request, environment)
|
||||
|
||||
|
||||
class DeleteEnvironment(tables.DeleteAction):
|
||||
data_type_singular = _("Environment")
|
||||
data_type_plural = _("Environments")
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, environment_id):
|
||||
try:
|
||||
api.environment_delete(request, environment_id)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t delete this environment right now')
|
||||
exceptions.handle(request, msg)
|
||||
|
||||
|
||||
class DeleteService(tables.DeleteAction):
|
||||
data_type_singular = _('Service')
|
||||
data_type_plural = _('Services')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, service_id):
|
||||
try:
|
||||
api.service_delete(request, service_id)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t delete service right now')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
||||
class DeployEnvironment(tables.BatchAction):
|
||||
name = 'deploy'
|
||||
action_present = _('Deploy')
|
||||
action_past = _('Deployed')
|
||||
data_type_singular = _('Environment')
|
||||
data_type_plural = _('Environments')
|
||||
classes = 'btn-launch'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
services = api.services_list(request, environment.id)
|
||||
|
||||
if status not in [STATUS_ID_DEPLOYING, None] and services:
|
||||
return True
|
||||
return False
|
||||
|
||||
def action(self, request, environment_id):
|
||||
try:
|
||||
api.environment_deploy(request, environment_id)
|
||||
except:
|
||||
msg = _('Unable to deploy. Maybe this environment \
|
||||
is already deploying by someone else. Try again later')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
||||
class ShowEnvironmentServices(tables.LinkAction):
|
||||
name = 'edit'
|
||||
verbose_name = _('Services')
|
||||
url = 'horizon:project:murano:services'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class UpdateEnvironmentRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, environment_id):
|
||||
return api.environment_get(request, environment_id)
|
||||
|
||||
|
||||
class UpdateServiceRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, service_id):
|
||||
return api.service_get(request, service_id)
|
||||
|
||||
|
||||
class EnvironmentsTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
link='horizon:project:murano:services',
|
||||
verbose_name=_('Name'))
|
||||
|
||||
status = tables.Column('status', verbose_name=_('Status'),
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
display_choices=STATUS_DISPLAY_CHOICES)
|
||||
|
||||
class Meta:
|
||||
name = 'murano'
|
||||
verbose_name = _('Environments')
|
||||
row_class = UpdateEnvironmentRow
|
||||
status_columns = ['status']
|
||||
table_actions = (CreateEnvironment, DeleteEnvironment)
|
||||
row_actions = (ShowEnvironmentServices, DeployEnvironment,
|
||||
DeleteEnvironment)
|
||||
|
||||
|
||||
class ServicesTable(tables.DataTable):
|
||||
name = tables.Column('name', verbose_name=_('Name'),
|
||||
link=('horizon:project:murano:service_details'))
|
||||
|
||||
_type = tables.Column('service_type', verbose_name=_('Type'))
|
||||
|
||||
status = tables.Column('status', verbose_name=_('Status'),
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
display_choices=STATUS_DISPLAY_CHOICES)
|
||||
|
||||
operation = tables.Column('operation', verbose_name=_('Operation'))
|
||||
|
||||
class Meta:
|
||||
name = 'services'
|
||||
verbose_name = _('Services')
|
||||
row_class = UpdateServiceRow
|
||||
status_columns = ['status']
|
||||
table_actions = (CreateService, DeleteService)
|
||||
row_actions = (DeleteService,)
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
import logging
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tabs
|
||||
from muranodashboard.panel import api
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
from .views import IndexView, Services, CreateEnvironmentView, DetailServiceView
|
||||
from .views import Wizard
|
||||
from .forms import WizardFormServiceType, WizardFormConfiguration
|
||||
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.murano.views'
|
||||
|
||||
urlpatterns = patterns(VIEW_MOD,
|
||||
url(r'^environments$', IndexView.as_view(), name='index'),
|
||||
url(r'^create$', Wizard.as_view([WizardFormServiceType, WizardFormConfiguration]), name='create'),
|
||||
url(r'^create_environment$', CreateEnvironmentView.as_view(), name='create_environment'),
|
||||
url(r'^(?P<environment_id>[^/]+)/services$', Services.as_view(), name='services'),
|
||||
url(r'^services/(?P<service_id>[^/]+)$', DetailServiceView.as_view(), name='service_details')
|
||||
)
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
from views import IndexView, Services, CreateEnvironmentView, DetailServiceView
|
||||
from views import Wizard
|
||||
from forms import WizardFormServiceType, WizardFormConfiguration
|
||||
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.murano.views'
|
||||
|
||||
urlpatterns = patterns(
|
||||
VIEW_MOD,
|
||||
url(r'^environments$', IndexView.as_view(), name='index'),
|
||||
url(r'^create$', Wizard.as_view(
|
||||
[WizardFormServiceType, WizardFormConfiguration]),
|
||||
name='create'),
|
||||
url(r'^create_environment$', CreateEnvironmentView.as_view(),
|
||||
name='create_environment'),
|
||||
url(r'^(?P<environment_id>[^/]+)/services$', Services.as_view(),
|
||||
name='services'),
|
||||
url(r'^services/(?P<service_id>[^/]+)$', DetailServiceView.as_view(),
|
||||
name='service_details')
|
||||
)
|
||||
|
|
|
@ -1,223 +1,225 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
from muranoclient.common.exceptions import CommunicationError
|
||||
import re
|
||||
|
||||
from django.views import generic
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.formtools.wizard.views import SessionWizardView
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from horizon import tables
|
||||
from horizon import workflows
|
||||
from horizon.forms.views import ModalFormMixin
|
||||
|
||||
from muranodashboard.panel import api
|
||||
|
||||
from tables import EnvironmentsTable, ServicesTable
|
||||
from workflows import CreateEnvironment
|
||||
from tabs import ServicesTabs
|
||||
from forms import WizardFormADConfiguration
|
||||
from forms import WizardFormIISConfiguration
|
||||
from forms import WizardFormAspNetAppConfiguration
|
||||
from forms import WizardFormIISFarmConfiguration
|
||||
from forms import WizardFormAspNetFarmConfiguration
|
||||
|
||||
from horizon import messages
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Wizard(ModalFormMixin, SessionWizardView, generic.FormView):
|
||||
template_name = 'services_tabs.html'
|
||||
|
||||
def done(self, form_list, **kwargs):
|
||||
link = self.request.__dict__['META']['HTTP_REFERER']
|
||||
environment_id = re.search('murano/(\S+)', link).group(0)[7:-9]
|
||||
|
||||
url = "/project/murano/%s/services" % environment_id
|
||||
|
||||
service_type = form_list[0].data.get('0-service', '')
|
||||
parameters = {'service_type': service_type}
|
||||
data = form_list[1].data
|
||||
parameters['units'] = []
|
||||
if service_type == 'Active Directory':
|
||||
parameters['configuration'] = 'standalone'
|
||||
parameters['name'] = str(data.get('1-dc_name', 'noname'))
|
||||
parameters['domain'] = parameters['name'] # Fix Me in orchestrator
|
||||
parameters['adminPassword'] = str(data.get('1-adm_password', ''))
|
||||
recovery_password = str(data.get('1-recovery_password', ''))
|
||||
parameters['units'].append({'isMaster': True,
|
||||
'recoveryPassword': recovery_password,
|
||||
'location': 'west-dc'})
|
||||
dc_count = int(data.get('1-dc_count', 1))
|
||||
for dc in range(dc_count - 1):
|
||||
parameters['units'].append({
|
||||
'isMaster': False,
|
||||
'recoveryPassword': recovery_password
|
||||
})
|
||||
|
||||
elif service_type in ['IIS', 'ASP.NET Application', 'IIS Farm', 'ASP.NET Farm']:
|
||||
password = data.get('1-adm_password', '')
|
||||
parameters['name'] = str(data.get('1-iis_name', 'noname'))
|
||||
parameters['credentials'] = {'username': 'Administrator',
|
||||
'password': password}
|
||||
parameters['domain'] = str(data.get('1-iis_domain', ''))
|
||||
password = form_list[1].data.get('1-adm_password', '')
|
||||
domain = form_list[1].data.get('1-iis_domain', '')
|
||||
dc_user = form_list[1].data.get('1-domain_user_name', '')
|
||||
dc_pass = form_list[1].data.get('1-domain_user_password', '')
|
||||
parameters['name'] = str(form_list[1].data.get('1-iis_name',
|
||||
'noname'))
|
||||
parameters['domain'] = parameters['name']
|
||||
parameters['adminPassword'] = password
|
||||
parameters['domain'] = str(domain)
|
||||
|
||||
if service_type == 'ASP.NET Application' or service_type == 'ASP.NET Farm':
|
||||
parameters['repository'] = form_list[1]\
|
||||
.data.get('1-repository', '')
|
||||
instance_count = 1
|
||||
if service_type == 'IIS Farm' or service_type == 'ASP.NET Farm':
|
||||
instance_count = int(data.get('1-instance_count', 1))
|
||||
parameters['loadBalancerPort'] = int(data.get('1-lb_port', 80))
|
||||
|
||||
for unit in range(instance_count - 1):
|
||||
parameters['units'].append({})
|
||||
|
||||
try:
|
||||
service = api.service_create(self.request, environment_id, parameters)
|
||||
|
||||
except:
|
||||
msg = _('Sorry, you can\'t create service right now. Try again later')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
|
||||
message = "The %s service successfully created." % service_type
|
||||
messages.success(self.request, message)
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
def get_form(self, step=None, data=None, files=None):
|
||||
form = super(Wizard, self).get_form(step, data, files)
|
||||
if data:
|
||||
self.service_type = data.get('0-service', '')
|
||||
if self.service_type == 'Active Directory':
|
||||
self.form_list['1'] = WizardFormADConfiguration
|
||||
elif self.service_type == 'IIS':
|
||||
self.form_list['1'] = WizardFormIISConfiguration
|
||||
elif self.service_type == 'ASP.NET Application':
|
||||
self.form_list['1'] = WizardFormAspNetAppConfiguration
|
||||
elif self.service_type == 'IIS Farm':
|
||||
self.form_list['1'] = WizardFormIISFarmConfiguration
|
||||
elif self.service_type == 'ASP.NET Farm':
|
||||
self.form_list['1'] = WizardFormAspNetFarmConfiguration
|
||||
|
||||
return form
|
||||
|
||||
def get_form_kwargs(self, step=None):
|
||||
return {'request': self.request} if step == u'1' else {}
|
||||
|
||||
def get_form_step_data(self, form):
|
||||
LOG.debug(form.data)
|
||||
return form.data
|
||||
|
||||
def get_context_data(self, form, **kwargs):
|
||||
context = super(Wizard, self).get_context_data(form=form, **kwargs)
|
||||
if self.steps.index > 0:
|
||||
context.update({'service_type': self.service_type})
|
||||
return context
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = EnvironmentsTable
|
||||
template_name = 'index.html'
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
environments = api.environments_list(self.request)
|
||||
except CommunicationError:
|
||||
environments = []
|
||||
messages.error(self.request, 'Could not connect to Murano API '
|
||||
'Service, check connection details.')
|
||||
return environments
|
||||
|
||||
|
||||
class Services(tables.DataTableView):
|
||||
table_class = ServicesTable
|
||||
template_name = 'services.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(Services, self).get_context_data(**kwargs)
|
||||
context['environment_name'] = self.environment_name
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
self.environment_id = self.kwargs['environment_id']
|
||||
environment = api.environment_get(self.request, self.environment_id)
|
||||
self.environment_name = environment.name
|
||||
services = api.services_list(self.request, self.environment_id)
|
||||
except:
|
||||
services = []
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve list of services for '
|
||||
'environment "%s".') % self.environment_id)
|
||||
self._services = services
|
||||
return self._services
|
||||
|
||||
|
||||
class DetailServiceView(tabs.TabView):
|
||||
tab_group_class = ServicesTabs
|
||||
template_name = 'service_details.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailServiceView, self).get_context_data(**kwargs)
|
||||
context["service"] = self.get_data()
|
||||
context["service_name"] = self.get_data().name
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
if not hasattr(self, "_service"):
|
||||
try:
|
||||
service_id = self.kwargs['service_id']
|
||||
service = api.service_get(self.request, service_id)
|
||||
except:
|
||||
redirect = reverse('horizon:project:murano:index')
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'service "%s".') % service_id,
|
||||
redirect=redirect)
|
||||
self._service = service
|
||||
return self._service
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
service = self.get_data()
|
||||
return self.tab_group_class(request, service=service, **kwargs)
|
||||
|
||||
|
||||
class CreateEnvironmentView(workflows.WorkflowView):
|
||||
workflow_class = CreateEnvironment
|
||||
template_name = 'create_dc.html'
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(CreateEnvironmentView, self).get_initial()
|
||||
initial['project_id'] = self.request.user.tenant_id
|
||||
initial['user_id'] = self.request.user.id
|
||||
return initial
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
from muranoclient.common.exceptions import CommunicationError
|
||||
import re
|
||||
|
||||
from django.views import generic
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.formtools.wizard.views import SessionWizardView
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from horizon import tables
|
||||
from horizon import workflows
|
||||
from horizon.forms.views import ModalFormMixin
|
||||
|
||||
from muranodashboard.panel import api
|
||||
|
||||
from tables import EnvironmentsTable, ServicesTable
|
||||
from workflows import CreateEnvironment
|
||||
from tabs import ServicesTabs
|
||||
from forms import WizardFormADConfiguration
|
||||
from forms import WizardFormIISConfiguration
|
||||
from forms import WizardFormAspNetAppConfiguration
|
||||
from forms import WizardFormIISFarmConfiguration
|
||||
from forms import WizardFormAspNetFarmConfiguration
|
||||
|
||||
from horizon import messages
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Wizard(ModalFormMixin, SessionWizardView, generic.FormView):
|
||||
template_name = 'services_tabs.html'
|
||||
|
||||
def done(self, form_list, **kwargs):
|
||||
link = self.request.__dict__['META']['HTTP_REFERER']
|
||||
environment_id = re.search('murano/(\S+)', link).group(0)[7:-9]
|
||||
|
||||
url = "/project/murano/%s/services" % environment_id
|
||||
|
||||
service_type = form_list[0].data.get('0-service', '')
|
||||
parameters = {'service_type': service_type}
|
||||
data = form_list[1].data
|
||||
parameters['units'] = []
|
||||
parameters['unitNamingPattern'] = data.get(
|
||||
'1-unit_name_template', None)
|
||||
if service_type == 'Active Directory':
|
||||
parameters['configuration'] = 'standalone'
|
||||
parameters['name'] = str(data.get('1-dc_name', 'noname'))
|
||||
parameters['domain'] = parameters['name'] # Fix Me in orchestrator
|
||||
parameters['adminPassword'] = str(data.get('1-adm_password', ''))
|
||||
recovery_password = str(data.get('1-recovery_password', ''))
|
||||
parameters['units'].append({'isMaster': True,
|
||||
'recoveryPassword': recovery_password,
|
||||
'location': 'west-dc'})
|
||||
dc_count = int(data.get('1-dc_count', 1))
|
||||
for dc in range(dc_count - 1):
|
||||
parameters['units'].append({
|
||||
'isMaster': False,
|
||||
'recoveryPassword': recovery_password
|
||||
})
|
||||
|
||||
elif service_type in ['IIS', 'ASP.NET Application',
|
||||
'IIS Farm', 'ASP.NET Farm']:
|
||||
password = data.get('1-adm_password', '')
|
||||
parameters['name'] = str(data.get('1-iis_name', 'noname'))
|
||||
parameters['credentials'] = {'username': 'Administrator',
|
||||
'password': password}
|
||||
parameters['domain'] = str(data.get('1-iis_domain', ''))
|
||||
password = form_list[1].data.get('1-adm_password', '')
|
||||
domain = form_list[1].data.get('1-iis_domain', '')
|
||||
parameters['name'] = str(form_list[1].data.get('1-iis_name',
|
||||
'noname'))
|
||||
parameters['domain'] = parameters['name']
|
||||
parameters['adminPassword'] = password
|
||||
parameters['domain'] = str(domain)
|
||||
|
||||
if service_type == 'ASP.NET Application' \
|
||||
or service_type == 'ASP.NET Farm':
|
||||
parameters['repository'] = \
|
||||
form_list[1].data.get('1-repository', '')
|
||||
instance_count = 1
|
||||
if service_type == 'IIS Farm' or service_type == 'ASP.NET Farm':
|
||||
instance_count = int(data.get('1-instance_count', 1))
|
||||
parameters['loadBalancerPort'] = int(data.get('1-lb_port', 80))
|
||||
|
||||
for unit in range(instance_count - 1):
|
||||
parameters['units'].append({})
|
||||
|
||||
try:
|
||||
api.service_create(self.request, environment_id, parameters)
|
||||
except:
|
||||
msg = _('Sorry, you can\'t create service right now.'
|
||||
' Try again later')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
|
||||
message = "The %s service successfully created." % service_type
|
||||
messages.success(self.request, message)
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
def get_form(self, step=None, data=None, files=None):
|
||||
form = super(Wizard, self).get_form(step, data, files)
|
||||
if data:
|
||||
self.service_type = data.get('0-service', '')
|
||||
if self.service_type == 'Active Directory':
|
||||
self.form_list['1'] = WizardFormADConfiguration
|
||||
elif self.service_type == 'IIS':
|
||||
self.form_list['1'] = WizardFormIISConfiguration
|
||||
elif self.service_type == 'ASP.NET Application':
|
||||
self.form_list['1'] = WizardFormAspNetAppConfiguration
|
||||
elif self.service_type == 'IIS Farm':
|
||||
self.form_list['1'] = WizardFormIISFarmConfiguration
|
||||
elif self.service_type == 'ASP.NET Farm':
|
||||
self.form_list['1'] = WizardFormAspNetFarmConfiguration
|
||||
|
||||
return form
|
||||
|
||||
def get_form_kwargs(self, step=None):
|
||||
return {'request': self.request} if step == u'1' else {}
|
||||
|
||||
def get_form_step_data(self, form):
|
||||
LOG.debug(form.data)
|
||||
return form.data
|
||||
|
||||
def get_context_data(self, form, **kwargs):
|
||||
context = super(Wizard, self).get_context_data(form=form, **kwargs)
|
||||
if self.steps.index > 0:
|
||||
context.update({'service_type': self.service_type})
|
||||
return context
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = EnvironmentsTable
|
||||
template_name = 'index.html'
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
environments = api.environments_list(self.request)
|
||||
except CommunicationError:
|
||||
environments = []
|
||||
messages.error(self.request, 'Could not connect to Murano API '
|
||||
'Service, check connection details.')
|
||||
return environments
|
||||
|
||||
|
||||
class Services(tables.DataTableView):
|
||||
table_class = ServicesTable
|
||||
template_name = 'services.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(Services, self).get_context_data(**kwargs)
|
||||
context['environment_name'] = self.environment_name
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
self.environment_id = self.kwargs['environment_id']
|
||||
environment = api.environment_get(
|
||||
self.request, self.environment_id)
|
||||
self.environment_name = environment.name
|
||||
services = api.services_list(self.request, self.environment_id)
|
||||
except:
|
||||
services = []
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve list of services for '
|
||||
'environment "%s".') % self.environment_id)
|
||||
self._services = services
|
||||
return self._services
|
||||
|
||||
|
||||
class DetailServiceView(tabs.TabView):
|
||||
tab_group_class = ServicesTabs
|
||||
template_name = 'service_details.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailServiceView, self).get_context_data(**kwargs)
|
||||
context["service"] = self.get_data()
|
||||
context["service_name"] = self.get_data().name
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
if not hasattr(self, "_service"):
|
||||
try:
|
||||
service_id = self.kwargs['service_id']
|
||||
service = api.service_get(self.request, service_id)
|
||||
except:
|
||||
redirect = reverse('horizon:project:murano:index')
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'service "%s".') % service_id,
|
||||
redirect=redirect)
|
||||
self._service = service
|
||||
return self._service
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
service = self.get_data()
|
||||
return self.tab_group_class(request, service=service, **kwargs)
|
||||
|
||||
|
||||
class CreateEnvironmentView(workflows.WorkflowView):
|
||||
workflow_class = CreateEnvironment
|
||||
template_name = 'create_dc.html'
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(CreateEnvironmentView, self).get_initial()
|
||||
initial['project_id'] = self.request.user.tenant_id
|
||||
initial['user_id'] = self.request.user.id
|
||||
return initial
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
|
||||
from django.utils.text import normalize_newlines
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from horizon import exceptions
|
||||
|
|
|
@ -31,14 +31,18 @@ ADMIN_MEDIA_PREFIX = '/static/admin/'
|
|||
|
||||
ROOT_URLCONF = 'openstack_dashboard.urls'
|
||||
|
||||
RECOVERABLE_EXC = (muranoclient.HTTPException, muranoclient.CommunicationError, muranoclient.Forbidden)
|
||||
EXTENDED_RECOVERABLE_EXCEPTIONS = tuple(exceptions.RECOVERABLE + RECOVERABLE_EXC)
|
||||
RECOVERABLE_EXC = (muranoclient.HTTPException,
|
||||
muranoclient.CommunicationError,
|
||||
muranoclient.Forbidden)
|
||||
EXTENDED_RECOVERABLE_EXCEPTIONS = tuple(
|
||||
exceptions.RECOVERABLE + RECOVERABLE_EXC)
|
||||
|
||||
NOT_FOUND_EXC = (muranoclient.HTTPNotFound,muranoclient.EndpointNotFound)
|
||||
NOT_FOUND_EXC = (muranoclient.HTTPNotFound, muranoclient.EndpointNotFound)
|
||||
EXTENDED_NOT_FOUND_EXCEPTIONS = tuple(exceptions.NOT_FOUND + NOT_FOUND_EXC)
|
||||
|
||||
UNAUTHORIZED_EXC = (muranoclient.HTTPUnauthorized, )
|
||||
EXTENDED_UNAUTHORIZED_EXCEPTIONS = tuple(exceptions.UNAUTHORIZED + UNAUTHORIZED_EXC)
|
||||
EXTENDED_UNAUTHORIZED_EXCEPTIONS = tuple(
|
||||
exceptions.UNAUTHORIZED + UNAUTHORIZED_EXC)
|
||||
|
||||
|
||||
HORIZON_CONFIG = {
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<p>{% trans "Please, set the complex password for local administrator account." %}</p>
|
||||
<p>{% trans "Also, you can add this IIS server to the existing domain and configure credentials for domain user." %}</p>
|
||||
{% endif %}
|
||||
<p>{% trans "You can specify a template for a host-name format. Use # character for a sequential number like myhost#." %}</p>
|
||||
|
||||
{% else %}
|
||||
<h3>{% trans "Description" %}:</h3>
|
||||
|
|
91
tox.ini
91
tox.ini
|
@ -1,53 +1,38 @@
|
|||
[tox]
|
||||
envlist = py26,py27,pep8,pyflakes
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=0.05
|
||||
NOSE_OPENSTACK_YELLOW=0.025
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
NOSE_OPENSTACK_STDOUT=1
|
||||
NOSE_XUNIT=1
|
||||
deps =
|
||||
-r{toxinidir}/tools/pip-requires
|
||||
-r{toxinidir}/tools/test-requires
|
||||
commands =
|
||||
|
||||
[testenv:integration]
|
||||
commands =
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
||||
[tox:jenkins]
|
||||
downloadcache = ~/cache/pip
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
flake8
|
||||
hacking
|
||||
commands =
|
||||
|
||||
[testenv:pyflakes]
|
||||
deps =
|
||||
commands =
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
commands =
|
||||
|
||||
[testenv:pylint]
|
||||
commands =
|
||||
|
||||
[flake8]
|
||||
# H301 one import per line
|
||||
# H302 import only modules
|
||||
ignore = H301,H302
|
||||
show-source = true
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
|
||||
[tox]
|
||||
envlist = py26,py27,pep8,pyflakes
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=0.05
|
||||
NOSE_OPENSTACK_YELLOW=0.025
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
deps = -r{toxinidir}/tools/pip-requires
|
||||
-r{toxinidir}/tools/test-requires
|
||||
commands =
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8==1.3.3
|
||||
commands = pep8 --repeat --show-source muranodashboard setup.py
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = nosetests --cover-erase --cover-package=muranodashboard --with-xcoverage
|
||||
|
||||
[testenv:pyflakes]
|
||||
deps = flake8
|
||||
commands = flake8
|
||||
|
||||
[tox:jenkins]
|
||||
downloadcache = ~/cache/pip
|
||||
|
||||
[flake8]
|
||||
# H301 one import per line
|
||||
# H302 import only modules
|
||||
ignore = H301,H302,F403
|
||||
show-source = true
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
|
Loading…
Reference in New Issue