Fix E128 errors in openstack_dashboard/dashboards/project/
E128 continuation line under-indented for visual indent Partial-Bug: #1375929 Change-Id: I6bc8db7dab6fc2c3aad7fa54b6e07643b595f230
This commit is contained in:
parent
79df5b42ed
commit
2a9349bd67
@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.project.access_and_security.\
|
||||
api_access import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^ec2/$', views.download_ec2_bundle, name='ec2'),
|
||||
url(r'^openrc/$', views.download_rc_file, name='openrc'),
|
||||
)
|
||||
|
@ -46,7 +46,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
|
||||
return False
|
||||
|
||||
fip = api.network.tenant_floating_ip_allocate(request,
|
||||
pool=data['pool'])
|
||||
pool=data['pool'])
|
||||
messages.success(request,
|
||||
_('Allocated Floating IP %(ip)s.')
|
||||
% {"ip": fip.ip})
|
||||
|
@ -238,14 +238,15 @@ class FloatingIpViewTests(test.TestCase):
|
||||
IsA(http.HttpRequest),
|
||||
'network').MultipleTimes() \
|
||||
.AndReturn(True)
|
||||
api.base.is_service_enabled(IsA(http.HttpRequest),
|
||||
api.base.is_service_enabled(
|
||||
IsA(http.HttpRequest),
|
||||
'ec2').MultipleTimes() \
|
||||
.AndReturn(False)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
res = self.client.get(INDEX_URL +
|
||||
"?tab=access_security_tabs__floating_ips_tab")
|
||||
"?tab=access_security_tabs__floating_ips_tab")
|
||||
|
||||
allocate_link = tables.AllocateIP()
|
||||
url = allocate_link.get_link_url()
|
||||
|
@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.project.access_and_security.\
|
||||
floating_ips import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^associate/$', views.AssociateView.as_view(), name='associate'),
|
||||
url(r'^allocate/$', views.AllocateView.as_view(), name='allocate')
|
||||
)
|
||||
|
@ -30,17 +30,16 @@ from openstack_dashboard import api
|
||||
NEW_LINES = re.compile(r"\r|\n")
|
||||
|
||||
KEYPAIR_NAME_REGEX = re.compile(r"^[\w\- ]+$", re.UNICODE)
|
||||
KEYPAIR_ERROR_MESSAGES = {'invalid': _('Key pair name may '
|
||||
'only contain letters, '
|
||||
'numbers, underscores, '
|
||||
'spaces and hyphens.')}
|
||||
KEYPAIR_ERROR_MESSAGES = {
|
||||
'invalid': _('Key pair name may only contain letters, '
|
||||
'numbers, underscores, spaces and hyphens.')}
|
||||
|
||||
|
||||
class CreateKeypair(forms.SelfHandlingForm):
|
||||
name = forms.RegexField(max_length=255,
|
||||
label=_("Key Pair Name"),
|
||||
regex=KEYPAIR_NAME_REGEX,
|
||||
error_messages=KEYPAIR_ERROR_MESSAGES)
|
||||
label=_("Key Pair Name"),
|
||||
regex=KEYPAIR_NAME_REGEX,
|
||||
error_messages=KEYPAIR_ERROR_MESSAGES)
|
||||
|
||||
def handle(self, request, data):
|
||||
return True # We just redirect to the download view.
|
||||
@ -48,9 +47,9 @@ class CreateKeypair(forms.SelfHandlingForm):
|
||||
|
||||
class ImportKeypair(forms.SelfHandlingForm):
|
||||
name = forms.RegexField(max_length=255,
|
||||
label=_("Key Pair Name"),
|
||||
regex=KEYPAIR_NAME_REGEX,
|
||||
error_messages=KEYPAIR_ERROR_MESSAGES)
|
||||
label=_("Key Pair Name"),
|
||||
regex=KEYPAIR_NAME_REGEX,
|
||||
error_messages=KEYPAIR_ERROR_MESSAGES)
|
||||
public_key = forms.CharField(label=_("Public Key"), widget=forms.Textarea(
|
||||
attrs={'class': 'modal-body-fixed-width'}))
|
||||
|
||||
|
@ -72,8 +72,8 @@ class KeyPairViewTests(test.TestCase):
|
||||
def test_create_keypair_get(self):
|
||||
res = self.client.get(
|
||||
reverse('horizon:project:access_and_security:keypairs:create'))
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/keypairs/create.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/access_and_security/keypairs/create.html')
|
||||
|
||||
def test_download_keypair_get(self):
|
||||
keypair_name = "keypair"
|
||||
|
@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.project.access_and_security.keypairs \
|
||||
import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(r'^import/$', views.ImportView.as_view(), name='import'),
|
||||
url(r'^(?P<keypair_name>[^/]+)/download/$', views.DownloadView.as_view(),
|
||||
|
@ -87,8 +87,8 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
res = self.client.get(reverse('horizon:project:access_and_security:'
|
||||
'security_groups:update',
|
||||
args=[sec_group.id]))
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/security_groups/_update.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/access_and_security/security_groups/_update.html')
|
||||
self.assertEqual(res.context['security_group'].name,
|
||||
sec_group.name)
|
||||
|
||||
@ -118,15 +118,15 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
|
||||
def test_create_security_groups_get(self):
|
||||
res = self.client.get(SG_CREATE_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/security_groups/create.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/access_and_security/security_groups/create.html')
|
||||
|
||||
@test.create_stubs({api.network: ('security_group_create',)})
|
||||
def test_create_security_groups_post(self):
|
||||
sec_group = self.security_groups.first()
|
||||
api.network.security_group_create(IsA(http.HttpRequest),
|
||||
sec_group.name,
|
||||
sec_group.description) \
|
||||
sec_group.name,
|
||||
sec_group.description) \
|
||||
.AndReturn(sec_group)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -140,8 +140,8 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
def test_create_security_groups_post_exception(self):
|
||||
sec_group = self.security_groups.first()
|
||||
api.network.security_group_create(IsA(http.HttpRequest),
|
||||
sec_group.name,
|
||||
sec_group.description) \
|
||||
sec_group.name,
|
||||
sec_group.description) \
|
||||
.AndRaise(self.exceptions.nova)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -162,8 +162,8 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
'name': fail_name,
|
||||
'description': sec_group.description}
|
||||
res = self.client.post(SG_CREATE_URL, formData)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/security_groups/create.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/access_and_security/security_groups/create.html')
|
||||
self.assertContains(res, "ASCII")
|
||||
|
||||
@test.create_stubs({api.network: ('security_group_get',)})
|
||||
@ -174,8 +174,8 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
sec_group.id).AndReturn(sec_group)
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(self.detail_url)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/security_groups/detail.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/access_and_security/security_groups/detail.html')
|
||||
|
||||
@test.create_stubs({api.network: ('security_group_get',)})
|
||||
def test_detail_get_exception(self):
|
||||
|
@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.project.access_and_security.\
|
||||
security_groups import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(r'^(?P<security_group_id>[^/]+)/$',
|
||||
views.DetailView.as_view(),
|
||||
|
@ -101,7 +101,7 @@ class FloatingIPsTab(tabs.TableTab):
|
||||
except Exception:
|
||||
floating_ip_pools = []
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve floating IP pools.'))
|
||||
_('Unable to retrieve floating IP pools.'))
|
||||
pool_dict = dict([(obj.id, obj.name) for obj in floating_ip_pools])
|
||||
|
||||
instances = []
|
||||
@ -109,7 +109,7 @@ class FloatingIPsTab(tabs.TableTab):
|
||||
instances, has_more = nova.server_list(self.request)
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve instance list.'))
|
||||
_('Unable to retrieve instance list.'))
|
||||
|
||||
instances_dict = dict([(obj.id, obj.name) for obj in instances])
|
||||
|
||||
|
@ -199,7 +199,7 @@ class SecurityGroupTabTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
|
||||
res = self.client.get(INDEX_URL +
|
||||
"?tab=access_security_tabs__security_groups_tab")
|
||||
"?tab=access_security_tabs__security_groups_tab")
|
||||
|
||||
security_groups = res.context['security_groups_table'].data
|
||||
self.assertItemsEqual(security_groups, self.security_groups.list())
|
||||
|
@ -31,7 +31,8 @@ from openstack_dashboard.dashboards.project.access_and_security.\
|
||||
from openstack_dashboard.dashboards.project.access_and_security import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'api_access/', include(api_access_urls, namespace='api_access')),
|
||||
url(r'keypairs/', include(keypair_urls, namespace='keypairs')),
|
||||
|
@ -228,8 +228,8 @@ class CopyObject(forms.SelfHandlingForm):
|
||||
return True
|
||||
except exceptions.HorizonException as exc:
|
||||
messages.error(request, exc)
|
||||
raise exceptions.Http302(reverse(index,
|
||||
args=[tables.wrap_delimiter(orig_container)]))
|
||||
raise exceptions.Http302(
|
||||
reverse(index, args=[tables.wrap_delimiter(orig_container)]))
|
||||
except Exception:
|
||||
redirect = reverse(index,
|
||||
args=[tables.wrap_delimiter(orig_container)])
|
||||
|
@ -181,8 +181,10 @@ class SwiftTests(test.TestCase):
|
||||
prefix=None).AndReturn(ret)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
res = self.client.get(reverse('horizon:project:containers:index',
|
||||
args=[tables.wrap_delimiter(self.containers.first().name)]))
|
||||
container_name = self.containers.first().name
|
||||
res = self.client.get(
|
||||
reverse('horizon:project:containers:index',
|
||||
args=[tables.wrap_delimiter(container_name)]))
|
||||
self.assertTemplateUsed(res, 'project/containers/index.html')
|
||||
# UTF8 encoding here to ensure there aren't problems with Nose output.
|
||||
expected = [obj.name.encode('utf8') for obj in self.objects.list()]
|
||||
@ -268,8 +270,8 @@ class SwiftTests(test.TestCase):
|
||||
obj = self.objects.first()
|
||||
|
||||
api.swift.swift_create_pseudo_folder(IsA(http.HttpRequest),
|
||||
container.name,
|
||||
obj.name + "/").AndReturn(obj)
|
||||
container.name,
|
||||
obj.name + "/").AndReturn(obj)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
create_pseudo_folder_url = reverse('horizon:project:containers:'
|
||||
|
@ -25,7 +25,8 @@ from openstack_dashboard.dashboards.project.containers import views
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.containers.views'
|
||||
|
||||
# Swift containers and objects.
|
||||
urlpatterns = patterns(VIEW_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEW_MOD,
|
||||
url(r'^((?P<container_name>.+?)/)?(?P<subfolder_path>(.+/)+)?$',
|
||||
views.ContainerView.as_view(), name='index'),
|
||||
|
||||
|
@ -109,8 +109,9 @@ def render_node_groups(cluster_template):
|
||||
|
||||
class ClusterTemplatesTable(tables.DataTable):
|
||||
name = tables.Column("name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.cluster_templates:details"))
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing."
|
||||
"cluster_templates:details"))
|
||||
plugin_name = tables.Column("plugin_name",
|
||||
verbose_name=_("Plugin"))
|
||||
hadoop_version = tables.Column("hadoop_version",
|
||||
|
@ -32,8 +32,8 @@ class DataProcessingClusterTemplateTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.cluster_templates/'
|
||||
'cluster_templates.html')
|
||||
'project/data_processing.cluster_templates/'
|
||||
'cluster_templates.html')
|
||||
self.assertContains(res, 'Cluster Templates')
|
||||
self.assertContains(res, 'Name')
|
||||
|
||||
|
@ -169,9 +169,8 @@ class ConfigureNodegroupsAction(workflows.Action):
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
|
||||
self.templates = saharaclient.nodegroup_template_find(request,
|
||||
plugin_name=plugin,
|
||||
hadoop_version=hadoop_version)
|
||||
self.templates = saharaclient.nodegroup_template_find(
|
||||
request, plugin_name=plugin, hadoop_version=hadoop_version)
|
||||
|
||||
deletable = request.REQUEST.get("deletable", dict())
|
||||
|
||||
|
@ -105,8 +105,9 @@ class ClustersTable(tables.DataTable):
|
||||
)
|
||||
|
||||
name = tables.Column("name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.clusters:details"))
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing."
|
||||
"clusters:details"))
|
||||
status = tables.Column("status",
|
||||
verbose_name=_("Status"),
|
||||
status=True,
|
||||
|
@ -69,9 +69,9 @@ class GeneralTab(tabs.Tab):
|
||||
net_name = None
|
||||
|
||||
cluster_info.update({"cluster": cluster,
|
||||
"base_image": base_image,
|
||||
"cluster_template": cluster_template,
|
||||
"network": net_name})
|
||||
"base_image": base_image,
|
||||
"cluster_template": cluster_template,
|
||||
"network": net_name})
|
||||
except Exception as e:
|
||||
LOG.error("Unable to fetch cluster details: %s" % str(e))
|
||||
|
||||
|
@ -31,7 +31,7 @@ class DataProcessingClusterTests(test.TestCase):
|
||||
.AndReturn(self.clusters.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.clusters/clusters.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.clusters/clusters.html')
|
||||
self.assertContains(res, 'Clusters')
|
||||
self.assertContains(res, 'Name')
|
||||
|
@ -68,8 +68,8 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
|
||||
})
|
||||
|
||||
super(ScaleCluster, self).__init__(request, context_seed,
|
||||
entry_point, *args,
|
||||
**kwargs)
|
||||
entry_point, *args,
|
||||
**kwargs)
|
||||
# Initialize node groups.
|
||||
for step in self.steps:
|
||||
if not isinstance(step, clt_create_flow.ConfigureNodegroups):
|
||||
|
@ -23,8 +23,9 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class PluginsTable(tables.DataTable):
|
||||
title = tables.Column("title",
|
||||
verbose_name=_("Title"),
|
||||
link=("horizon:project:data_processing.data_plugins:details"))
|
||||
verbose_name=_("Title"),
|
||||
link=("horizon:project:data_processing."
|
||||
"data_plugins:details"))
|
||||
|
||||
versions = tables.Column("versions",
|
||||
verbose_name=_("Supported Versions"),
|
||||
|
@ -32,8 +32,8 @@ class DataProcessingPluginsTests(test.TestCase):
|
||||
.AndReturn(self.plugins.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.data_plugins/plugins.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.data_plugins/plugins.html')
|
||||
self.assertContains(res, 'vanilla')
|
||||
self.assertContains(res, 'plugin')
|
||||
|
||||
@ -43,8 +43,8 @@ class DataProcessingPluginsTests(test.TestCase):
|
||||
.AndReturn(self.plugins.list()[0])
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.data_plugins/details.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.data_plugins/details.html')
|
||||
self.assertContains(res, 'vanilla')
|
||||
self.assertContains(res, 'plugin')
|
||||
self.assertContains(res, 'Plugin Overview')
|
||||
|
@ -57,8 +57,9 @@ class DeleteDataSource(tables.BatchAction):
|
||||
|
||||
class DataSourcesTable(tables.DataTable):
|
||||
name = tables.Column("name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.data_sources:details"))
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing."
|
||||
"data_sources:details"))
|
||||
type = tables.Column("type",
|
||||
verbose_name=_("Type"))
|
||||
description = tables.Column("description",
|
||||
|
@ -31,8 +31,8 @@ class DataProcessingDataSourceTests(test.TestCase):
|
||||
.AndReturn(self.data_sources.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.data_sources/data_sources.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.data_sources/data_sources.html')
|
||||
self.assertContains(res, 'Data Sources')
|
||||
self.assertContains(res, 'Name')
|
||||
self.assertContains(res, 'sampleOutput')
|
||||
@ -44,7 +44,7 @@ class DataProcessingDataSourceTests(test.TestCase):
|
||||
.AndReturn(self.data_sources.list()[0])
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.data_sources/details.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.data_sources/details.html')
|
||||
self.assertContains(res, 'sampleOutput')
|
||||
self.assertContains(res, 'Data Source Details')
|
||||
|
@ -77,7 +77,8 @@ class DownloadJobBinary(tables.LinkAction):
|
||||
|
||||
|
||||
class JobBinariesTable(tables.DataTable):
|
||||
name = tables.Column("name",
|
||||
name = tables.Column(
|
||||
"name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.job_binaries:details"))
|
||||
type = tables.Column("url",
|
||||
|
@ -31,8 +31,8 @@ class DataProcessingJobBinaryTests(test.TestCase):
|
||||
.AndReturn(self.job_binaries.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.job_binaries/job_binaries.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.job_binaries/job_binaries.html')
|
||||
self.assertContains(res, 'Job Binaries')
|
||||
self.assertContains(res, 'Name')
|
||||
self.assertContains(res, 'example.pig')
|
||||
@ -43,8 +43,8 @@ class DataProcessingJobBinaryTests(test.TestCase):
|
||||
.AndReturn(self.job_binaries.list()[0])
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.job_binaries/details.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.job_binaries/details.html')
|
||||
self.assertContains(res, 'Job Binary Details')
|
||||
|
||||
@test.create_stubs({api.sahara: ('job_binary_list',
|
||||
@ -53,7 +53,7 @@ class DataProcessingJobBinaryTests(test.TestCase):
|
||||
'job_binary_delete',)})
|
||||
def test_delete(self):
|
||||
jb_list = (api.sahara.job_binary_list(IsA(http.HttpRequest))
|
||||
.AndReturn(self.job_binaries.list()))
|
||||
.AndReturn(self.job_binaries.list()))
|
||||
api.sahara.job_binary_get(IsA(http.HttpRequest), IsA(unicode)) \
|
||||
.AndReturn(self.job_binaries.list()[0])
|
||||
api.sahara.job_binary_delete(IsA(http.HttpRequest), jb_list[0].id)
|
||||
|
@ -135,9 +135,10 @@ class JobExecutionsTable(tables.DataTable):
|
||||
)
|
||||
|
||||
name = tables.Column("id",
|
||||
verbose_name=_("ID"),
|
||||
display_choices=(("id", "ID"), ("name", "Name")),
|
||||
link=("horizon:project:data_processing.job_executions:details"))
|
||||
verbose_name=_("ID"),
|
||||
display_choices=(("id", "ID"), ("name", "Name")),
|
||||
link=("horizon:project:data_processing."
|
||||
"job_executions:details"))
|
||||
job_name = tables.Column(
|
||||
"job_name",
|
||||
verbose_name=_("Job"),
|
||||
@ -147,9 +148,9 @@ class JobExecutionsTable(tables.DataTable):
|
||||
verbose_name=_("Cluster"),
|
||||
link=get_cluster_link)
|
||||
status = StatusColumn("info",
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
verbose_name=_("Status"))
|
||||
status=True,
|
||||
status_choices=STATUS_CHOICES,
|
||||
verbose_name=_("Status"))
|
||||
|
||||
def get_object_display(self, datum):
|
||||
return datum.id
|
||||
|
@ -31,8 +31,8 @@ class DataProcessingJobExecutionTests(test.TestCase):
|
||||
.AndReturn(self.job_executions.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.job_executions/job_executions.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.job_executions/job_executions.html')
|
||||
self.assertContains(res, 'Executions')
|
||||
|
||||
@test.create_stubs({api.sahara: ('job_execution_get',)})
|
||||
@ -41,6 +41,6 @@ class DataProcessingJobExecutionTests(test.TestCase):
|
||||
.AndReturn(self.job_executions.list()[0])
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.job_executions/details.html')
|
||||
self.assertTemplateUsed(
|
||||
res, 'project/data_processing.job_executions/details.html')
|
||||
self.assertContains(res, 'RUNNING')
|
||||
|
@ -146,8 +146,8 @@ class ChoosePlugin(tables.LinkAction):
|
||||
|
||||
class JobsTable(tables.DataTable):
|
||||
name = tables.Column("name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.jobs:details"))
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.jobs:details"))
|
||||
description = tables.Column("description",
|
||||
verbose_name=_("Description"))
|
||||
|
||||
|
@ -32,7 +32,7 @@ class DataProcessingJobTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.jobs/jobs.html')
|
||||
'project/data_processing.jobs/jobs.html')
|
||||
self.assertContains(res, 'Jobs')
|
||||
self.assertContains(res, 'Name')
|
||||
|
||||
@ -43,5 +43,5 @@ class DataProcessingJobTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.jobs/details.html')
|
||||
'project/data_processing.jobs/details.html')
|
||||
self.assertContains(res, 'pigjob')
|
||||
|
@ -75,7 +75,8 @@ class DeleteTemplate(tables.BatchAction):
|
||||
|
||||
|
||||
class NodegroupTemplatesTable(tables.DataTable):
|
||||
name = tables.Column("name",
|
||||
name = tables.Column(
|
||||
"name",
|
||||
verbose_name=_("Name"),
|
||||
link=("horizon:project:data_processing.nodegroup_templates:details"))
|
||||
plugin_name = tables.Column("plugin_name",
|
||||
|
@ -34,8 +34,8 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(INDEX_URL)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/data_processing.nodegroup_templates/'
|
||||
'nodegroup_templates.html')
|
||||
'project/data_processing.nodegroup_templates/'
|
||||
'nodegroup_templates.html')
|
||||
self.assertContains(res, 'Node Group Templates')
|
||||
self.assertContains(res, 'Name')
|
||||
self.assertContains(res, 'Plugin')
|
||||
|
@ -76,9 +76,8 @@ class GeneralConfigAction(workflows.Action):
|
||||
workflow_helpers.get_plugin_and_hadoop_version(request))
|
||||
process_choices = []
|
||||
try:
|
||||
version_details = saharaclient.plugin_get_version_details(request,
|
||||
plugin,
|
||||
hadoop_version)
|
||||
version_details = saharaclient.plugin_get_version_details(
|
||||
request, plugin, hadoop_version)
|
||||
for service, processes in version_details.node_processes.items():
|
||||
for process in processes:
|
||||
process_choices.append(
|
||||
|
@ -100,7 +100,7 @@ class DatabasesBackupsTests(test.TestCase):
|
||||
res = self.client.get(BACKUP_URL)
|
||||
self.assertMessageCount(res, error=1)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/database_backups/backup.html')
|
||||
'project/database_backups/backup.html')
|
||||
|
||||
@test.create_stubs({api.trove: ('instance_list',
|
||||
'backup_list',
|
||||
@ -150,7 +150,7 @@ class DatabasesBackupsTests(test.TestCase):
|
||||
res = self.client.get(DETAILS_URL)
|
||||
|
||||
self.assertTemplateUsed(res,
|
||||
'project/database_backups/details.html')
|
||||
'project/database_backups/details.html')
|
||||
|
||||
@test.create_stubs({api.trove: ('backup_get',)})
|
||||
def test_detail_backup_notfound(self):
|
||||
|
@ -59,7 +59,7 @@ class BackupDetailsAction(workflows.Action):
|
||||
try:
|
||||
backups = api.trove.backup_list(request)
|
||||
choices = [(b.id, b.name) for b in backups
|
||||
if b.status == 'COMPLETED']
|
||||
if b.status == 'COMPLETED']
|
||||
except Exception:
|
||||
choices = []
|
||||
msg = _("Unable to list database backups for parent.")
|
||||
|
@ -256,8 +256,8 @@ class InstancesTable(tables.DataTable):
|
||||
verbose_name=_("Size"),
|
||||
attrs={'data-type': 'size'})
|
||||
volume = tables.Column(get_volume_size,
|
||||
verbose_name=_("Volume Size"),
|
||||
attrs={'data-type': 'size'})
|
||||
verbose_name=_("Volume Size"),
|
||||
attrs={'data-type': 'size'})
|
||||
status = tables.Column("status",
|
||||
filters=(d_filters.title,
|
||||
filters.replace_underscores),
|
||||
|
@ -131,8 +131,8 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove.datastore_list(IsA(http.HttpRequest))\
|
||||
.AndReturn(self.datastores.list())
|
||||
# Mock datastore versions
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest),
|
||||
IsA(str)).AndReturn(self.datastore_versions.list())
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(LAUNCH_URL)
|
||||
self.assertTemplateUsed(res, 'project/databases/launch.html')
|
||||
@ -179,8 +179,8 @@ class DatabaseTests(test.TestCase):
|
||||
.AndReturn(self.datastores.list())
|
||||
|
||||
# Mock datastore versions
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest),
|
||||
IsA(str)).AndReturn(self.datastore_versions.list())
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
@ -235,8 +235,8 @@ class DatabaseTests(test.TestCase):
|
||||
.AndReturn(self.datastores.list())
|
||||
|
||||
# Mock datastore versions
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest),
|
||||
IsA(str)).AndReturn(self.datastore_versions.list())
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
@ -388,5 +388,5 @@ class DatabaseTests(test.TestCase):
|
||||
'new_size': database_size,
|
||||
}
|
||||
res = self.client.post(url, post)
|
||||
self.assertContains(res,
|
||||
"New size for volume must be greater than current size.")
|
||||
self.assertContains(
|
||||
res, "New size for volume must be greater than current size.")
|
||||
|
@ -156,7 +156,7 @@ class InsertRuleToPolicyLink(policy.PolicyTargetMixin,
|
||||
verbose_name = _("Insert Rule")
|
||||
classes = ("ajax-modal", "btn-update",)
|
||||
policy_rules = (("network", "get_firewall_policy"),
|
||||
("network", "insert_rule"),)
|
||||
("network", "insert_rule"),)
|
||||
|
||||
def get_link_url(self, policy):
|
||||
base_url = reverse("horizon:project:firewalls:insertrule",
|
||||
@ -170,7 +170,7 @@ class RemoveRuleFromPolicyLink(policy.PolicyTargetMixin,
|
||||
verbose_name = _("Remove Rule")
|
||||
classes = ("ajax-modal", "btn-danger",)
|
||||
policy_rules = (("network", "get_firewall_policy"),
|
||||
("network", "remove_rule"),)
|
||||
("network", "remove_rule"),)
|
||||
|
||||
def get_link_url(self, policy):
|
||||
base_url = reverse("horizon:project:firewalls:removerule",
|
||||
@ -213,7 +213,7 @@ class RulesTable(tables.DataTable):
|
||||
filters=(filters.upper,),
|
||||
verbose_name=_("Action"))
|
||||
enabled = tables.Column("enabled",
|
||||
verbose_name=_("Enabled"))
|
||||
verbose_name=_("Enabled"))
|
||||
firewall_policy_id = tables.Column(get_policy_name,
|
||||
link=get_policy_link,
|
||||
verbose_name=_("In Policy"))
|
||||
|
@ -80,22 +80,18 @@ class CreateImageForm(forms.SelfHandlingForm):
|
||||
'ng-model': 'diskFormat'}))
|
||||
architecture = forms.CharField(max_length=255, label=_("Architecture"),
|
||||
required=False)
|
||||
minimum_disk = forms.IntegerField(label=_("Minimum Disk (GB)"),
|
||||
min_value=0,
|
||||
help_text=_('The minimum disk size'
|
||||
' required to boot the'
|
||||
' image. If unspecified, this'
|
||||
' value defaults to 0'
|
||||
' (no minimum).'),
|
||||
required=False)
|
||||
minimum_ram = forms.IntegerField(label=_("Minimum RAM (MB)"),
|
||||
min_value=0,
|
||||
help_text=_('The minimum memory size'
|
||||
' required to boot the'
|
||||
' image. If unspecified, this'
|
||||
' value defaults to 0 (no'
|
||||
' minimum).'),
|
||||
required=False)
|
||||
minimum_disk = forms.IntegerField(
|
||||
label=_("Minimum Disk (GB)"),
|
||||
min_value=0,
|
||||
help_text=_('The minimum disk size required to boot the image. '
|
||||
'If unspecified, this value defaults to 0 (no minimum).'),
|
||||
required=False)
|
||||
minimum_ram = forms.IntegerField(
|
||||
label=_("Minimum RAM (MB)"),
|
||||
min_value=0,
|
||||
help_text=_('The minimum memory size required to boot the image. '
|
||||
'If unspecified, this value defaults to 0 (no minimum).'),
|
||||
required=False)
|
||||
is_public = forms.BooleanField(label=_("Public"), required=False)
|
||||
protected = forms.BooleanField(label=_("Protected"), required=False)
|
||||
|
||||
@ -181,8 +177,8 @@ class CreateImageForm(forms.SelfHandlingForm):
|
||||
try:
|
||||
image = api.glance.image_create(request, **meta)
|
||||
messages.success(request,
|
||||
_('Your image %s has been queued for creation.') %
|
||||
data['name'])
|
||||
_('Your image %s has been queued for creation.') %
|
||||
data['name'])
|
||||
return image
|
||||
except Exception:
|
||||
exceptions.handle(request, _('Unable to create new image.'))
|
||||
|
@ -134,7 +134,7 @@ class ImageViewTests(test.TestCase):
|
||||
url = reverse('horizon:project:images:images:create')
|
||||
res = self.client.get(url)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/images/images/create.html')
|
||||
'project/images/images/create.html')
|
||||
|
||||
@test.create_stubs({api.glance: ('image_create',)})
|
||||
def test_image_create_post_copy_from(self):
|
||||
@ -226,7 +226,7 @@ class ImageViewTests(test.TestCase):
|
||||
args=[image.id]))
|
||||
|
||||
self.assertTemplateUsed(res,
|
||||
'project/images/images/detail.html')
|
||||
'project/images/images/detail.html')
|
||||
self.assertEqual(res.context['image'].name, image.name)
|
||||
self.assertEqual(res.context['image'].protected, image.protected)
|
||||
self.assertContains(res, "<h1>Image Details: %s</h1>" % image.name,
|
||||
@ -269,9 +269,9 @@ class ImageViewTests(test.TestCase):
|
||||
|
||||
res = self.client.get(
|
||||
reverse('horizon:project:images:images:detail',
|
||||
args=[image.id]))
|
||||
args=[image.id]))
|
||||
self.assertTemplateUsed(res,
|
||||
'project/images/images/detail.html')
|
||||
'project/images/images/detail.html')
|
||||
self.assertEqual(res.context['image'].protected, image.protected)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_get',)})
|
||||
@ -301,7 +301,7 @@ class ImageViewTests(test.TestCase):
|
||||
args=[image.id]))
|
||||
|
||||
self.assertTemplateUsed(res,
|
||||
'project/images/images/_update.html')
|
||||
'project/images/images/_update.html')
|
||||
self.assertEqual(res.context['image'].name, image.name)
|
||||
# Bug 1076216 - is_public checkbox not being set correctly
|
||||
self.assertContains(res, "<input type='checkbox' id='id_public'"
|
||||
|
@ -25,7 +25,8 @@ from openstack_dashboard.dashboards.project.images.images import views
|
||||
VIEWS_MOD = 'openstack_dashboard.dashboards.project.images.images.views'
|
||||
|
||||
|
||||
urlpatterns = patterns(VIEWS_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEWS_MOD,
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(r'^(?P<image_id>[^/]+)/update/$',
|
||||
views.UpdateView.as_view(), name='update'),
|
||||
|
@ -39,7 +39,7 @@ class SnapshotsViewTests(test.TestCase):
|
||||
args=[server.id])
|
||||
res = self.client.get(url)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/images/snapshots/create.html')
|
||||
'project/images/snapshots/create.html')
|
||||
|
||||
def test_create_get_server_exception(self):
|
||||
server = self.servers.first()
|
||||
|
@ -22,7 +22,8 @@ from django.conf.urls import url
|
||||
from openstack_dashboard.dashboards.project.images.snapshots import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^(?P<instance_id>[^/]+)/create',
|
||||
views.CreateView.as_view(),
|
||||
name='create')
|
||||
|
@ -42,7 +42,7 @@ class CreateView(forms.ModalFormView):
|
||||
def get_object(self):
|
||||
try:
|
||||
return api.nova.server_get(self.request,
|
||||
self.kwargs["instance_id"])
|
||||
self.kwargs["instance_id"])
|
||||
except Exception:
|
||||
redirect = reverse('horizon:project:instances:index')
|
||||
exceptions.handle(self.request,
|
||||
|
@ -56,7 +56,7 @@ class ImagesAndSnapshotsTests(test.TestCase):
|
||||
row_actions = images_table.get_row_actions(images[1])
|
||||
self.assertTrue(len(row_actions), 2)
|
||||
self.assertTrue('delete_image' not in
|
||||
[a.name for a in row_actions])
|
||||
[a.name for a in row_actions])
|
||||
row_actions = images_table.get_row_actions(images[2])
|
||||
self.assertTrue(len(row_actions), 3)
|
||||
|
||||
@ -126,13 +126,14 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
|
||||
private_images = [image for image in self.images.list()
|
||||
if (image.status == 'active' and
|
||||
not image.is_public)]
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([public_images, False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([private_images, False, False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -151,17 +152,19 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
|
||||
private_images = [image for image in self.images.list()
|
||||
if (image.status == 'active' and
|
||||
not image.is_public)]
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([public_images, False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([private_images, False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': 'other-tenant',
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': 'other-tenant',
|
||||
'status': 'active'}) \
|
||||
.AndReturn([private_images, False, False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -206,19 +209,20 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
|
||||
private_images = [image for image in self.images.list()
|
||||
if (image.status == 'active' and
|
||||
not image.is_public)]
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndRaise(self.exceptions.glance)
|
||||
exceptions.handle(IsA(http.HttpRequest),
|
||||
"Unable to retrieve public images.")
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([private_images, False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([public_images, False, False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -258,19 +262,21 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
|
||||
private_images = [image for image in self.images.list()
|
||||
if (image.status == 'active' and
|
||||
not image.is_public)]
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([public_images, False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndRaise(self.exceptions.glance)
|
||||
exceptions.handle(IsA(http.HttpRequest),
|
||||
"Unable to retrieve images for the current project.")
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([private_images, False, False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
@ -27,7 +27,8 @@ from openstack_dashboard.dashboards.project.images.snapshots \
|
||||
from openstack_dashboard.dashboards.project.images import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'', include(image_urls, namespace='images')),
|
||||
url(r'', include(snapshot_urls, namespace='snapshots')),
|
||||
|
@ -35,18 +35,21 @@ def _image_choice_title(img):
|
||||
class RebuildInstanceForm(forms.SelfHandlingForm):
|
||||
instance_id = forms.CharField(widget=forms.HiddenInput())
|
||||
|
||||
image = forms.ChoiceField(label=_("Select Image"),
|
||||
widget=forms.SelectWidget(attrs={'class': 'image-selector'},
|
||||
data_attrs=('size', 'display-name'),
|
||||
transform=_image_choice_title))
|
||||
password = forms.RegexField(label=_("Rebuild Password"),
|
||||
required=False,
|
||||
widget=forms.PasswordInput(render_value=False),
|
||||
regex=validators.password_validator(),
|
||||
error_messages={'invalid': validators.password_validator_msg()})
|
||||
confirm_password = forms.CharField(label=_("Confirm Rebuild Password"),
|
||||
required=False,
|
||||
widget=forms.PasswordInput(render_value=False))
|
||||
image = forms.ChoiceField(
|
||||
label=_("Select Image"),
|
||||
widget=forms.SelectWidget(attrs={'class': 'image-selector'},
|
||||
data_attrs=('size', 'display-name'),
|
||||
transform=_image_choice_title))
|
||||
password = forms.RegexField(
|
||||
label=_("Rebuild Password"),
|
||||
required=False,
|
||||
widget=forms.PasswordInput(render_value=False),
|
||||
regex=validators.password_validator(),
|
||||
error_messages={'invalid': validators.password_validator_msg()})
|
||||
confirm_password = forms.CharField(
|
||||
label=_("Confirm Rebuild Password"),
|
||||
required=False,
|
||||
widget=forms.PasswordInput(render_value=False))
|
||||
disk_config = forms.ChoiceField(label=_("Disk Partition"),
|
||||
required=False)
|
||||
|
||||
|
@ -215,7 +215,8 @@ class TogglePause(tables.BatchAction):
|
||||
has_permission = True
|
||||
policy_check = getattr(settings, "POLICY_CHECK_FUNCTION", None)
|
||||
if policy_check:
|
||||
has_permission = policy_check(policy, request,
|
||||
has_permission = policy_check(
|
||||
policy, request,
|
||||
target={'project_id': getattr(instance, 'tenant_id', None)})
|
||||
|
||||
return (has_permission
|
||||
@ -282,7 +283,8 @@ class ToggleSuspend(tables.BatchAction):
|
||||
has_permission = True
|
||||
policy_check = getattr(settings, "POLICY_CHECK_FUNCTION", None)
|
||||
if policy_check:
|
||||
has_permission = policy_check(policy, request,
|
||||
has_permission = policy_check(
|
||||
policy, request,
|
||||
target={'project_id': getattr(instance, 'tenant_id', None)})
|
||||
|
||||
return (has_permission
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,8 @@ INSTANCES_KEYPAIR = r'^(?P<instance_id>[^/]+)/(?P<keypair_name>[^/]+)/%s$'
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.instances.views'
|
||||
|
||||
|
||||
urlpatterns = patterns(VIEW_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEW_MOD,
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^launch$', views.LaunchInstanceView.as_view(), name='launch'),
|
||||
url(r'^(?P<instance_id>[^/]+)/$',
|
||||
|
@ -55,7 +55,7 @@ def sort_flavor_list(request, flavors):
|
||||
else:
|
||||
key = sort_key
|
||||
flavor_list = [(flavor.id, '%s' % flavor.name)
|
||||
for flavor in sorted(flavors, key=key, reverse=rev)]
|
||||
for flavor in sorted(flavors, key=key, reverse=rev)]
|
||||
return flavor_list
|
||||
except Exception:
|
||||
exceptions.handle(request,
|
||||
|
@ -211,7 +211,7 @@ class UpdateView(workflows.WorkflowView):
|
||||
def get_initial(self):
|
||||
initial = super(UpdateView, self).get_initial()
|
||||
initial.update({'instance_id': self.kwargs['instance_id'],
|
||||
'name': getattr(self.get_object(), 'name', '')})
|
||||
'name': getattr(self.get_object(), 'name', '')})
|
||||
return initial
|
||||
|
||||
|
||||
@ -331,15 +331,17 @@ class ResizeView(workflows.WorkflowView):
|
||||
except Exception:
|
||||
redirect = reverse("horizon:project:instances:index")
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve flavors.'), redirect=redirect)
|
||||
_('Unable to retrieve flavors.'),
|
||||
redirect=redirect)
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(ResizeView, self).get_initial()
|
||||
_object = self.get_object()
|
||||
if _object:
|
||||
initial.update({'instance_id': self.kwargs['instance_id'],
|
||||
'name': getattr(_object, 'name', None),
|
||||
'old_flavor_id': _object.flavor['id'],
|
||||
'old_flavor_name': getattr(_object, 'flavor_name', ''),
|
||||
'flavors': self.get_flavors()})
|
||||
initial.update(
|
||||
{'instance_id': self.kwargs['instance_id'],
|
||||
'name': getattr(_object, 'name', None),
|
||||
'old_flavor_id': _object.flavor['id'],
|
||||
'old_flavor_name': getattr(_object, 'flavor_name', ''),
|
||||
'flavors': self.get_flavors()})
|
||||
return initial
|
||||
|
@ -110,11 +110,11 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
filesizeformat(x.bytes)))))
|
||||
|
||||
volume_size = forms.IntegerField(label=_("Device size (GB)"),
|
||||
initial=1,
|
||||
min_value=0,
|
||||
required=False,
|
||||
help_text=_("Volume size in gigabytes "
|
||||
"(integer value)."))
|
||||
initial=1,
|
||||
min_value=0,
|
||||
required=False,
|
||||
help_text=_("Volume size in gigabytes "
|
||||
"(integer value)."))
|
||||
|
||||
device_name = forms.CharField(label=_("Device Name"),
|
||||
required=False,
|
||||
@ -158,14 +158,16 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
try:
|
||||
if api.nova.extension_supported("BlockDeviceMappingV2Boot",
|
||||
request):
|
||||
source_type_choices.append(("volume_image_id",
|
||||
_("Boot from image (creates a new volume)")))
|
||||
source_type_choices.append(
|
||||
("volume_image_id",
|
||||
_("Boot from image (creates a new volume)")))
|
||||
except Exception:
|
||||
exceptions.handle(request, _('Unable to retrieve extensions '
|
||||
'information.'))
|
||||
'information.'))
|
||||
|
||||
source_type_choices.append(("volume_snapshot_id",
|
||||
_("Boot from volume snapshot (creates a new volume)")))
|
||||
source_type_choices.append(
|
||||
("volume_snapshot_id",
|
||||
_("Boot from volume snapshot (creates a new volume)")))
|
||||
self.fields['source_type'].choices = source_type_choices
|
||||
|
||||
def clean(self):
|
||||
@ -205,15 +207,15 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
if flavor and available_cores < count * flavor.vcpus:
|
||||
count_error.append(_("Cores(Available: %(avail)s, "
|
||||
"Requested: %(req)s)")
|
||||
% {'avail': available_cores,
|
||||
'req': count * flavor.vcpus})
|
||||
% {'avail': available_cores,
|
||||
'req': count * flavor.vcpus})
|
||||
|
||||
available_ram = usages['ram']['available']
|
||||
if flavor and available_ram < count * flavor.ram:
|
||||
count_error.append(_("RAM(Available: %(avail)s, "
|
||||
"Requested: %(req)s)")
|
||||
% {'avail': available_ram,
|
||||
'req': count * flavor.ram})
|
||||
% {'avail': available_ram,
|
||||
'req': count * flavor.ram})
|
||||
|
||||
if count_error:
|
||||
value_str = ", ".join(count_error)
|
||||
@ -342,9 +344,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
flavors = json.dumps([f._info for f in
|
||||
instance_utils.flavor_list(self.request)])
|
||||
extra['flavors'] = flavors
|
||||
images = image_utils.get_available_images(self.request,
|
||||
self.initial['project_id'],
|
||||
self._images_cache)
|
||||
images = image_utils.get_available_images(
|
||||
self.request, self.initial['project_id'], self._images_cache)
|
||||
if images is not None:
|
||||
attrs = [{'id': i.id,
|
||||
'min_disk': getattr(i, 'min_disk', 0),
|
||||
@ -377,8 +378,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
def populate_image_id_choices(self, request, context):
|
||||
choices = []
|
||||
images = image_utils.get_available_images(request,
|
||||
context.get('project_id'),
|
||||
self._images_cache)
|
||||
context.get('project_id'),
|
||||
self._images_cache)
|
||||
for image in images:
|
||||
image.bytes = image.size
|
||||
image.volume_size = max(
|
||||
@ -396,8 +397,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
|
||||
def populate_instance_snapshot_id_choices(self, request, context):
|
||||
images = image_utils.get_available_images(request,
|
||||
context.get('project_id'),
|
||||
self._images_cache)
|
||||
context.get('project_id'),
|
||||
self._images_cache)
|
||||
choices = [(image.id, image.name)
|
||||
for image in images
|
||||
if image.properties.get("image_type", '') == "snapshot"]
|
||||
@ -550,7 +551,7 @@ class SetAccessControls(workflows.Step):
|
||||
action_class = SetAccessControlsAction
|
||||
depends_on = ("project_id", "user_id")
|
||||
contributes = ("keypair_id", "security_group_ids",
|
||||
"admin_pass", "confirm_admin_pass")
|
||||
"admin_pass", "confirm_admin_pass")
|
||||
|
||||
def contribute(self, data, context):
|
||||
if data:
|
||||
@ -732,11 +733,13 @@ class SetNetwork(workflows.Step):
|
||||
|
||||
|
||||
class SetAdvancedAction(workflows.Action):
|
||||
disk_config = forms.ChoiceField(label=_("Disk Partition"), required=False,
|
||||
disk_config = forms.ChoiceField(
|
||||
label=_("Disk Partition"), required=False,
|
||||
help_text=_("Automatic: The entire disk is a single partition and "
|
||||
"automatically resizes. Manual: Results in faster build "
|
||||
"times but requires manual partitioning."))
|
||||
config_drive = forms.BooleanField(label=_("Configuration Drive"),
|
||||
config_drive = forms.BooleanField(
|
||||
label=_("Configuration Drive"),
|
||||
required=False, help_text=_("Configure OpenStack to write metadata to "
|
||||
"a special configuration drive that "
|
||||
"attaches to the instance when it boots."))
|
||||
@ -820,9 +823,10 @@ class LaunchInstance(workflows.Workflow):
|
||||
if source_type in ['image_id', 'instance_snapshot_id']:
|
||||
image_id = context['source_id']
|
||||
elif source_type in ['volume_id', 'volume_snapshot_id']:
|
||||
dev_mapping_1 = {context['device_name']: '%s::%s' %
|
||||
(context['source_id'],
|
||||
int(bool(context['delete_on_terminate'])))}
|
||||
dev_mapping_1 = {context['device_name']:
|
||||
'%s::%s' %
|
||||
(context['source_id'],
|
||||
int(bool(context['delete_on_terminate'])))}
|
||||
elif source_type == 'volume_image_id':
|
||||
device_name = context.get('device_name', '').strip() or None
|
||||
dev_mapping_2 = [
|
||||
|
@ -252,8 +252,8 @@ class UpdateMonitor(forms.SelfHandlingForm):
|
||||
'timeout': context['timeout'],
|
||||
'max_retries': context['max_retries'],
|
||||
'admin_state_up': context['admin_state_up']}}
|
||||
monitor = api.lbaas.pool_health_monitor_update(request,
|
||||
context['monitor_id'], **data)
|
||||
monitor = api.lbaas.pool_health_monitor_update(
|
||||
request, context['monitor_id'], **data)
|
||||
msg = _('Health monitor %s was successfully updated.')\
|
||||
% context['monitor_id']
|
||||
LOG.debug(msg)
|
||||
|
@ -516,10 +516,12 @@ class LoadBalancerTests(test.TestCase):
|
||||
'subnet_id':
|
||||
'3f7c5d79-ee55-47b0-9213-8e669fb03009'}],
|
||||
'network_id': '72c3ab6c-c80f-4341-9dc5-210fa31ac6c2'})
|
||||
api.neutron.port_list(IsA(http.HttpRequest),
|
||||
api.neutron.port_list(
|
||||
IsA(http.HttpRequest),
|
||||
device_id=server1.id).AndReturn([port1, port2])
|
||||
else:
|
||||
api.neutron.port_list(IsA(http.HttpRequest),
|
||||
api.neutron.port_list(
|
||||
IsA(http.HttpRequest),
|
||||
device_id=server1.id).AndReturn([port1, ])
|
||||
|
||||
form_data = {'pool_id': member.pool_id,
|
||||
|
@ -49,9 +49,9 @@ class NetworkTopologyTests(test.TestCase):
|
||||
api.nova.server_list(
|
||||
IsA(http.HttpRequest)).AndReturn([self.servers.list(), False])
|
||||
tenant_networks = [net for net in self.networks.list()
|
||||
if not net['router:external']]
|
||||
if not net['router:external']]
|
||||
external_networks = [net for net in self.networks.list()
|
||||
if net['router:external']]
|
||||
if net['router:external']]
|
||||
api.neutron.network_list_for_tenant(
|
||||
IsA(http.HttpRequest),
|
||||
self.tenant.id).AndReturn(tenant_networks)
|
||||
|
@ -220,7 +220,7 @@ class JSONView(View):
|
||||
'name': router.name,
|
||||
'status': router.status,
|
||||
'external_gateway_info': router.external_gateway_info}
|
||||
for router in neutron_routers]
|
||||
for router in neutron_routers]
|
||||
self.add_resource_url('horizon:project:routers:detail', routers)
|
||||
return routers
|
||||
|
||||
|
@ -22,6 +22,7 @@ PORTS = r'^(?P<port_id>[^/]+)/%s$'
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.networks.ports.views'
|
||||
|
||||
|
||||
urlpatterns = patterns(VIEW_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEW_MOD,
|
||||
url(PORTS % 'detail', views.DetailView.as_view(), name='detail')
|
||||
)
|
||||
|
@ -22,6 +22,7 @@ SUBNETS = r'^(?P<subnet_id>[^/]+)/%s$'
|
||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.networks.subnets.views'
|
||||
|
||||
|
||||
urlpatterns = patterns(VIEW_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEW_MOD,
|
||||
url(SUBNETS % 'detail', views.DetailView.as_view(), name='detail')
|
||||
)
|
||||
|
@ -92,7 +92,7 @@ class UpdateView(workflows.WorkflowView):
|
||||
for p in subnet['allocation_pools']]
|
||||
initial['allocation_pools'] = '\n'.join(pools)
|
||||
routes = ['%s,%s' % (r['destination'], r['nexthop'])
|
||||
for r in subnet['host_routes']]
|
||||
for r in subnet['host_routes']]
|
||||
initial['host_routes'] = '\n'.join(routes)
|
||||
|
||||
return initial
|
||||
|
@ -30,7 +30,8 @@ from openstack_dashboard.dashboards.project.networks import views
|
||||
NETWORKS = r'^(?P<network_id>[^/]+)/%s$'
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^create$', views.CreateView.as_view(), name='create'),
|
||||
url(NETWORKS % 'detail', views.DetailView.as_view(), name='detail'),
|
||||
|
@ -23,7 +23,8 @@ from django.conf.urls import url
|
||||
from openstack_dashboard.dashboards.project.overview import views
|
||||
|
||||
|
||||
urlpatterns = patterns('openstack_dashboard.dashboards.project.overview.views',
|
||||
urlpatterns = patterns(
|
||||
'openstack_dashboard.dashboards.project.overview.views',
|
||||
url(r'^$', views.ProjectOverview.as_view(), name='index'),
|
||||
url(r'^warning$', views.WarningView.as_view(), name='warning'),
|
||||
)
|
||||
|
@ -83,8 +83,8 @@ class RulesGridTab(tabs.Tab):
|
||||
|
||||
def get_routerrulesgrid_data(self, rules):
|
||||
ports = self.tab_group.ports
|
||||
networks = api.neutron.network_list_for_tenant(self.request,
|
||||
self.request.user.tenant_id)
|
||||
networks = api.neutron.network_list_for_tenant(
|
||||
self.request, self.request.user.tenant_id)
|
||||
for n in networks:
|
||||
n.set_id_as_name_if_empty()
|
||||
netnamemap = {}
|
||||
|
@ -19,5 +19,6 @@ from openstack_dashboard.dashboards.project.routers.ports import views
|
||||
|
||||
PORTS = r'^(?P<port_id>[^/]+)/%s$'
|
||||
|
||||
urlpatterns = patterns('horizon.dashboards.project.networks.ports.views',
|
||||
urlpatterns = patterns(
|
||||
'horizon.dashboards.project.networks.ports.views',
|
||||
url(PORTS % 'detail', views.DetailView.as_view(), name='detail'))
|
||||
|
@ -181,7 +181,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "create")\
|
||||
.AndReturn(True)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "create")\
|
||||
"l3-ha", "create")\
|
||||
.AndReturn(True)
|
||||
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
.AndReturn(router)
|
||||
@ -204,7 +204,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "create")\
|
||||
.MultipleTimes().AndReturn(True)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "create")\
|
||||
"l3-ha", "create")\
|
||||
.MultipleTimes().AndReturn(True)
|
||||
param = {'name': router.name,
|
||||
'distributed': True,
|
||||
@ -230,7 +230,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "create")\
|
||||
.MultipleTimes().AndReturn(False)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "create")\
|
||||
"l3-ha", "create")\
|
||||
.AndReturn(False)
|
||||
self.exceptions.neutron.status_code = 409
|
||||
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
@ -252,7 +252,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "create")\
|
||||
.MultipleTimes().AndReturn(False)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "create")\
|
||||
"l3-ha", "create")\
|
||||
.MultipleTimes().AndReturn(False)
|
||||
self.exceptions.neutron.status_code = 999
|
||||
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
@ -279,7 +279,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "update")\
|
||||
.AndReturn(dvr_enabled)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "update")\
|
||||
"l3-ha", "update")\
|
||||
.AndReturn(ha_enabled)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -331,7 +331,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "update")\
|
||||
.AndReturn(False)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "update")\
|
||||
"l3-ha", "update")\
|
||||
.AndReturn(False)
|
||||
api.neutron.router_update(IsA(http.HttpRequest), router.id,
|
||||
name=router.name,
|
||||
@ -359,7 +359,7 @@ class RouterActionTests(test.TestCase):
|
||||
"dvr", "update")\
|
||||
.AndReturn(True)
|
||||
api.neutron.get_feature_permission(IsA(http.HttpRequest),
|
||||
"l3-ha", "update")\
|
||||
"l3-ha", "update")\
|
||||
.AndReturn(True)
|
||||
api.neutron.router_update(IsA(http.HttpRequest), router.id,
|
||||
name=router.name,
|
||||
@ -598,7 +598,8 @@ class RouterRuleTests(test.TestCase):
|
||||
args=[router.id]))
|
||||
|
||||
self.assertTemplateUsed(res, '%s/routers/detail.html' % self.DASHBOARD)
|
||||
self.assertTemplateNotUsed(res,
|
||||
self.assertTemplateNotUsed(
|
||||
res,
|
||||
'%s/routers/extensions/routerrules/grid.html' % self.DASHBOARD)
|
||||
|
||||
@test.create_stubs({api.neutron: ('router_get', 'port_list',
|
||||
@ -627,7 +628,8 @@ class RouterRuleTests(test.TestCase):
|
||||
|
||||
self.assertTemplateUsed(res, '%s/routers/detail.html' % self.DASHBOARD)
|
||||
if self.DASHBOARD == 'project':
|
||||
self.assertTemplateUsed(res,
|
||||
self.assertTemplateUsed(
|
||||
res,
|
||||
'%s/routers/extensions/routerrules/grid.html' % self.DASHBOARD)
|
||||
rules = res.context['routerrules_table'].data
|
||||
self.assertItemsEqual(rules, router['router_rules'])
|
||||
|
@ -25,7 +25,8 @@ from openstack_dashboard.dashboards.project.routers import views
|
||||
ROUTER_URL = r'^(?P<router_id>[^/]+)/%s'
|
||||
|
||||
|
||||
urlpatterns = patterns('horizon.dashboards.project.routers.views',
|
||||
urlpatterns = patterns(
|
||||
'horizon.dashboards.project.routers.views',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(ROUTER_URL % '$',
|
||||
|
@ -55,7 +55,7 @@ class TemplateForm(forms.SelfHandlingForm):
|
||||
# TODO(jomara) - update URL choice for template & environment files
|
||||
# w/ client side download when applicable
|
||||
base_choices = [('file', _('File')),
|
||||
('raw', _('Direct Input'))]
|
||||
('raw', _('Direct Input'))]
|
||||
url_choice = [('url', _('URL'))]
|
||||
attributes = {'class': 'switchable', 'data-slug': 'templatesource'}
|
||||
template_source = forms.ChoiceField(label=_('Template Source'),
|
||||
@ -129,9 +129,9 @@ class TemplateForm(forms.SelfHandlingForm):
|
||||
files = self.request.FILES
|
||||
self.clean_uploaded_files('template', _('template'), cleaned, files)
|
||||
self.clean_uploaded_files('environment',
|
||||
_('environment'),
|
||||
cleaned,
|
||||
files)
|
||||
_('environment'),
|
||||
cleaned,
|
||||
files)
|
||||
|
||||
# Validate the template and get back the params.
|
||||
kwargs = {}
|
||||
@ -226,9 +226,11 @@ class ChangeTemplateForm(TemplateForm):
|
||||
class Meta:
|
||||
name = _('Edit Template')
|
||||
help_text = _('Select a new template to re-launch a stack.')
|
||||
stack_id = forms.CharField(label=_('Stack ID'),
|
||||
stack_id = forms.CharField(
|
||||
label=_('Stack ID'),
|
||||
widget=forms.widgets.HiddenInput)
|
||||
stack_name = forms.CharField(label=_('Stack Name'),
|
||||
stack_name = forms.CharField(
|
||||
label=_('Stack Name'),
|
||||
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
|
||||
|
||||
|
||||
@ -255,9 +257,10 @@ class CreateStackForm(forms.SelfHandlingForm):
|
||||
label=_('Stack Name'),
|
||||
help_text=_('Name of the stack to create.'),
|
||||
regex=r"^[a-zA-Z][a-zA-Z0-9_.-]*$",
|
||||
error_messages={'invalid': _('Name must start with a letter and may '
|
||||
'only contain letters, numbers, underscores, '
|
||||
'periods and hyphens.')})
|
||||
error_messages={'invalid':
|
||||
_('Name must start with a letter and may '
|
||||
'only contain letters, numbers, underscores, '
|
||||
'periods and hyphens.')})
|
||||
timeout_mins = forms.IntegerField(
|
||||
initial=60,
|
||||
label=_('Creation Timeout (minutes)'),
|
||||
@ -372,9 +375,11 @@ class EditStackForm(CreateStackForm):
|
||||
class Meta:
|
||||
name = _('Update Stack Parameters')
|
||||
|
||||
stack_id = forms.CharField(label=_('Stack ID'),
|
||||
stack_id = forms.CharField(
|
||||
label=_('Stack ID'),
|
||||
widget=forms.widgets.HiddenInput)
|
||||
stack_name = forms.CharField(label=_('Stack Name'),
|
||||
stack_name = forms.CharField(
|
||||
label=_('Stack Name'),
|
||||
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
|
||||
|
||||
@sensitive_variables('password')
|
||||
|
@ -184,14 +184,14 @@ class ResourcesTable(tables.DataTable):
|
||||
verbose_name=_("Stack Resource"),
|
||||
link=get_resource_url)
|
||||
physical_resource = tables.Column('physical_resource_id',
|
||||
verbose_name=_("Resource"),
|
||||
link=mappings.resource_to_url)
|
||||
verbose_name=_("Resource"),
|
||||
link=mappings.resource_to_url)
|
||||
resource_type = tables.Column("resource_type",
|
||||
verbose_name=_("Stack Resource Type"),)
|
||||
verbose_name=_("Stack Resource Type"),)
|
||||
updated_time = tables.Column('updated_time',
|
||||
verbose_name=_("Date Updated"),
|
||||
filters=(filters.parse_isotime,
|
||||
filters.timesince_or_never))
|
||||
verbose_name=_("Date Updated"),
|
||||
filters=(filters.parse_isotime,
|
||||
filters.timesince_or_never))
|
||||
status = tables.Column("resource_status",
|
||||
filters=(title, filters.replace_underscores),
|
||||
verbose_name=_("Status"),
|
||||
|
@ -141,14 +141,16 @@ class StackTests(test.TestCase):
|
||||
settings.API_RESULT_PAGE_SIZE)
|
||||
|
||||
url = "%s?%s=%s" % (reverse('horizon:project:stacks:index'),
|
||||
tables.StacksTable._meta.pagination_param, stacks[2].id)
|
||||
tables.StacksTable._meta.pagination_param,
|
||||
stacks[2].id)
|
||||
res = self.client.get(url)
|
||||
# get second page (items 2-4)
|
||||
self.assertEqual(len(res.context['stacks_table'].data),
|
||||
settings.API_RESULT_PAGE_SIZE)
|
||||
|
||||
url = "%s?%s=%s" % (reverse('horizon:project:stacks:index'),
|
||||
tables.StacksTable._meta.pagination_param, stacks[4].id)
|
||||
tables.StacksTable._meta.pagination_param,
|
||||
stacks[4].id)
|
||||
res = self.client.get(url)
|
||||
# get third page (item 5)
|
||||
self.assertEqual(len(res.context['stacks_table'].data),
|
||||
@ -194,13 +196,15 @@ class StackTests(test.TestCase):
|
||||
settings.API_RESULT_PAGE_SIZE)
|
||||
|
||||
url = "%s?%s=%s" % (reverse('horizon:project:stacks:index'),
|
||||
tables.StacksTable._meta.pagination_param, stacks[2].id)
|
||||
tables.StacksTable._meta.pagination_param,
|
||||
stacks[2].id)
|
||||
res = self.client.get(url)
|
||||
# get second page (item 3)
|
||||
self.assertEqual(len(res.context['stacks_table'].data), 1)
|
||||
|
||||
url = "%s?%s=%s" % (reverse('horizon:project:stacks:index'),
|
||||
tables.StacksTable._meta.prev_pagination_param, stacks[2].id)
|
||||
tables.StacksTable._meta.prev_pagination_param,
|
||||
stacks[2].id)
|
||||
res = self.client.get(url)
|
||||
# prev back to get first page with 2 pages
|
||||
self.assertEqual(len(res.context['stacks_table'].data),
|
||||
@ -590,7 +594,7 @@ class StackTests(test.TestCase):
|
||||
|
||||
# POST to edit form
|
||||
api.heat.stack_get(IsA(http.HttpRequest),
|
||||
stack.id).AndReturn(stack)
|
||||
stack.id).AndReturn(stack)
|
||||
|
||||
fields = {
|
||||
'stack_name': stack.stack_name,
|
||||
@ -606,7 +610,7 @@ class StackTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
|
||||
url = reverse('horizon:project:stacks:change_template',
|
||||
args=[stack.id])
|
||||
args=[stack.id])
|
||||
res = self.client.get(url)
|
||||
self.assertTemplateUsed(res, 'project/stacks/change_template.html')
|
||||
|
||||
@ -616,7 +620,7 @@ class StackTests(test.TestCase):
|
||||
res = self.client.post(url, form_data)
|
||||
|
||||
url = reverse('horizon:project:stacks:edit_stack',
|
||||
args=[stack.id, ])
|
||||
args=[stack.id, ])
|
||||
form_data = {'template_source': 'raw',
|
||||
'template_data': template.data,
|
||||
'password': 'password',
|
||||
@ -716,7 +720,7 @@ class TemplateFormTests(test.TestCase):
|
||||
}
|
||||
json_str = '{notvalidjson::::::json/////json'
|
||||
files = {'template_upload':
|
||||
self.SimpleFile('template_name', json_str)}
|
||||
self.SimpleFile('template_name', json_str)}
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.ValidationError,
|
||||
@ -735,7 +739,7 @@ class TemplateFormTests(test.TestCase):
|
||||
|
||||
json_str = '{"isvalid":"json"}'
|
||||
files = {'template_upload':
|
||||
self.SimpleFile('template_name', json_str)}
|
||||
self.SimpleFile('template_name', json_str)}
|
||||
|
||||
t.clean_uploaded_files('template', 'template', precleaned, files)
|
||||
self.assertEqual(
|
||||
|
@ -20,7 +20,8 @@ VIEWS_MOD = ('openstack_dashboard.dashboards.project'
|
||||
'.volumes.backups.views')
|
||||
|
||||
|
||||
urlpatterns = patterns(VIEWS_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEWS_MOD,
|
||||
url(r'^(?P<backup_id>[^/]+)/$',
|
||||
views.BackupDetailView.as_view(),
|
||||
name='detail'),
|
||||
|
@ -23,8 +23,10 @@ from openstack_dashboard.api import cinder
|
||||
|
||||
class UpdateForm(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255, label=_("Snapshot Name"))
|
||||
description = forms.CharField(max_length=255, widget=forms.Textarea(
|
||||
attrs={'rows': 4}), label=_("Description"), required=False)
|
||||
description = forms.CharField(max_length=255,
|
||||
widget=forms.Textarea(attrs={'rows': 4}),
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
def handle(self, request, data):
|
||||
snapshot_id = self.initial['snapshot_id']
|
||||
|
@ -16,7 +16,8 @@ from django.conf.urls import url
|
||||
from openstack_dashboard.dashboards.project.volumes.snapshots import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^(?P<snapshot_id>[^/]+)$',
|
||||
views.DetailView.as_view(),
|
||||
name='detail'),
|
||||
|
@ -24,7 +24,8 @@ from openstack_dashboard.dashboards.project.volumes import views
|
||||
from openstack_dashboard.dashboards.project.volumes.volumes \
|
||||
import urls as volume_urls
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^\?tab=volumes_and_snapshots__snapshots_tab$',
|
||||
views.IndexView.as_view(), name='snapshots_tab'),
|
||||
|
@ -73,8 +73,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
widget=forms.SelectWidget(
|
||||
attrs={'class': 'image-selector'},
|
||||
data_attrs=('size', 'name'),
|
||||
transform=lambda x: "%s (%s)" % (x.name,
|
||||
filesizeformat(x.size * 1024 * 1024 * 1024))),
|
||||
transform=lambda x: "%s (%s)" % (
|
||||
x.name, filesizeformat(x.size * 1024 * 1024 * 1024))),
|
||||
required=False)
|
||||
type = forms.ChoiceField(
|
||||
label=_("Type"),
|
||||
@ -116,9 +116,9 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
self.fields['type'].initial = orig_volume.volume_type
|
||||
except Exception:
|
||||
pass
|
||||
self.fields['size'].help_text = _('Volume size must be equal '
|
||||
'to or greater than the snapshot size (%sGB)') \
|
||||
% snapshot.size
|
||||
self.fields['size'].help_text = (
|
||||
_('Volume size must be equal to or greater than the '
|
||||
'snapshot size (%sGB)') % snapshot.size)
|
||||
del self.fields['image_source']
|
||||
del self.fields['volume_source']
|
||||
del self.fields['volume_source_type']
|
||||
@ -199,11 +199,11 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
else:
|
||||
del self.fields['snapshot_source']
|
||||
except Exception:
|
||||
exceptions.handle(request, _("Unable to retrieve "
|
||||
"volume snapshots."))
|
||||
exceptions.handle(request,
|
||||
_("Unable to retrieve volume snapshots."))
|
||||
|
||||
images = utils.get_available_images(request,
|
||||
request.user.tenant_id)
|
||||
request.user.tenant_id)
|
||||
if images:
|
||||
source_type_choices.append(("image_source", _("Image")))
|
||||
choices = [('', _("Choose an image"))]
|
||||
@ -309,8 +309,9 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
data["snapshot_source"])
|
||||
snapshot_id = snapshot.id
|
||||
if (data['size'] < snapshot.size):
|
||||
error_message = _('The volume size cannot be less than '
|
||||
'the snapshot size (%sGB)') % snapshot.size
|
||||
error_message = (_('The volume size cannot be less than '
|
||||
'the snapshot size (%sGB)')
|
||||
% snapshot.size)
|
||||
raise ValidationError(error_message)
|
||||
az = None
|
||||
elif (data.get("image_source", None) and
|
||||
@ -321,15 +322,17 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
image_id = image.id
|
||||
image_size = functions.bytes_to_gigabytes(image.size)
|
||||
if (data['size'] < image_size):
|
||||
error_message = _('The volume size cannot be less than '
|
||||
'the image size (%s)') % filesizeformat(image.size)
|
||||
error_message = (_('The volume size cannot be less than '
|
||||
'the image size (%s)')
|
||||
% filesizeformat(image.size))
|
||||
raise ValidationError(error_message)
|
||||
properties = getattr(image, 'properties', {})
|
||||
min_disk_size = (getattr(image, 'min_disk', 0) or
|
||||
properties.get('min_disk', 0))
|
||||
if (min_disk_size > 0 and data['size'] < min_disk_size):
|
||||
error_message = _('The volume size cannot be less than '
|
||||
'the image minimum disk size (%sGB)') % min_disk_size
|
||||
error_message = (_('The volume size cannot be less than '
|
||||
'the image minimum disk size (%sGB)')
|
||||
% min_disk_size)
|
||||
raise ValidationError(error_message)
|
||||
elif (data.get("volume_source", None) and
|
||||
source_type in [None, 'volume_source']):
|
||||
@ -338,8 +341,9 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
volume_id = volume.id
|
||||
|
||||
if data['size'] < volume.size:
|
||||
error_message = _('The volume size cannot be less than '
|
||||
'the source volume size (%sGB)') % volume.size
|
||||
error_message = (_('The volume size cannot be less than '
|
||||
'the source volume size (%sGB)')
|
||||
% volume.size)
|
||||
raise ValidationError(error_message)
|
||||
else:
|
||||
if type(data['size']) is str:
|
||||
@ -466,8 +470,10 @@ class AttachForm(forms.SelfHandlingForm):
|
||||
|
||||
class CreateSnapshotForm(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255, label=_("Snapshot Name"))
|
||||
description = forms.CharField(max_length=255, widget=forms.Textarea(
|
||||
attrs={'rows': 4}), label=_("Description"), required=False)
|
||||
description = forms.CharField(max_length=255,
|
||||
widget=forms.Textarea(attrs={'rows': 4}),
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(CreateSnapshotForm, self).__init__(request, *args, **kwargs)
|
||||
@ -504,8 +510,10 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
|
||||
|
||||
class UpdateForm(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255, label=_("Volume Name"))
|
||||
description = forms.CharField(max_length=255, widget=forms.Textarea(
|
||||
attrs={'rows': 4}), label=_("Description"), required=False)
|
||||
description = forms.CharField(max_length=255,
|
||||
widget=forms.Textarea(attrs={'rows': 4}),
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
def handle(self, request, data):
|
||||
volume_id = self.initial['volume_id']
|
||||
|
@ -184,7 +184,7 @@ class CreateSnapshot(VolumePolicyTargetMixin, tables.LinkAction):
|
||||
limits = {}
|
||||
|
||||
snapshots_available = (limits.get('maxTotalSnapshots', float("inf"))
|
||||
- limits.get('totalSnapshotsUsed', 0))
|
||||
- limits.get('totalSnapshotsUsed', 0))
|
||||
|
||||
if snapshots_available <= 0 and "disabled" not in self.classes:
|
||||
self.classes = [c for c in self.classes] + ['disabled']
|
||||
@ -357,12 +357,12 @@ class VolumesTable(VolumesTableBase):
|
||||
verbose_name=_("Type"),
|
||||
empty_value="-")
|
||||
attachments = AttachmentColumn("attachments",
|
||||
verbose_name=_("Attached To"))
|
||||
verbose_name=_("Attached To"))
|
||||
availability_zone = tables.Column("availability_zone",
|
||||
verbose_name=_("Availability Zone"))
|
||||
verbose_name=_("Availability Zone"))
|
||||
bootable = tables.Column('is_bootable',
|
||||
verbose_name=_("Bootable"),
|
||||
filters=(filters.yesno, filters.capfirst))
|
||||
verbose_name=_("Bootable"),
|
||||
filters=(filters.yesno, filters.capfirst))
|
||||
encryption = tables.Column(get_encrypted_value,
|
||||
verbose_name=_("Encrypted"))
|
||||
|
||||
|
@ -67,13 +67,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(usage_limit)
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
|
||||
self.cinder_availability_zones.list())
|
||||
@ -130,13 +131,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(self.volume_types.list())
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.volume_list(IsA(
|
||||
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
|
||||
@ -256,13 +258,14 @@ class VolumeViewTests(test.TestCase):
|
||||
'AvailabilityZones').AndReturn(True)
|
||||
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
|
||||
self.cinder_availability_zones.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
|
||||
cinder.volume_create(IsA(http.HttpRequest),
|
||||
@ -313,13 +316,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(self.volume_types.list())
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.volume_list(IsA(
|
||||
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
|
||||
@ -475,13 +479,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(self.volume_types.list())
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.volume_list(IsA(
|
||||
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
|
||||
@ -638,13 +643,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(usage_limit)
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.volume_list(IsA(
|
||||
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
|
||||
@ -687,13 +693,14 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(usage_limit)
|
||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.cinder_volume_snapshots.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'is_public': True, 'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False, False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
api.glance.image_list_detailed(
|
||||
IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False, False])
|
||||
cinder.volume_list(IsA(
|
||||
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
|
||||
@ -913,8 +920,9 @@ class VolumeViewTests(test.TestCase):
|
||||
"id=\"volumes__row_%s__action_snapshots\">%s</a>" \
|
||||
% (url, " ".join(classes), volume.id, link_name)
|
||||
|
||||
self.assertContains(res, expected_string, html=True,
|
||||
msg_prefix="The create snapshot button is not disabled")
|
||||
self.assertContains(
|
||||
res, expected_string, html=True,
|
||||
msg_prefix="The create snapshot button is not disabled")
|
||||
|
||||
@test.create_stubs({cinder: ('tenant_absolute_limits',
|
||||
'volume_list',
|
||||
|
@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.project.volumes.backups \
|
||||
|
||||
VIEWS_MOD = ('openstack_dashboard.dashboards.project.volumes.volumes.views')
|
||||
|
||||
urlpatterns = patterns(VIEWS_MOD,
|
||||
urlpatterns = patterns(
|
||||
VIEWS_MOD,
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(r'^(?P<volume_id>[^/]+)/extend/$',
|
||||
views.ExtendView.as_view(),
|
||||
|
@ -108,16 +108,17 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
data = {'ikepolicy':
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'auth_algorithm': context['auth_algorithm'],
|
||||
'encryption_algorithm': context['encryption_algorithm'],
|
||||
'ike_version': context['ike_version'],
|
||||
'lifetime': {'units': context['lifetime_units'],
|
||||
'value': context['lifetime_value']},
|
||||
'pfs': context['pfs'],
|
||||
'phase1_negotiation_mode': context['phase1_negotiation_mode'],
|
||||
}}
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'auth_algorithm': context['auth_algorithm'],
|
||||
'encryption_algorithm': context['encryption_algorithm'],
|
||||
'ike_version': context['ike_version'],
|
||||
'lifetime': {'units': context['lifetime_units'],
|
||||
'value': context['lifetime_value']},
|
||||
'pfs': context['pfs'],
|
||||
'phase1_negotiation_mode':
|
||||
context['phase1_negotiation_mode'],
|
||||
}}
|
||||
ikepolicy = api.vpn.ikepolicy_update(
|
||||
request, context['ikepolicy_id'], **data)
|
||||
msg = (_('IKE Policy %s was successfully updated.')
|
||||
@ -179,16 +180,16 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
data = {'ipsecpolicy':
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'auth_algorithm': context['auth_algorithm'],
|
||||
'encapsulation_mode': context['encapsulation_mode'],
|
||||
'encryption_algorithm': context['encryption_algorithm'],
|
||||
'lifetime': {'units': context['lifetime_units'],
|
||||
'value': context['lifetime_value']},
|
||||
'pfs': context['pfs'],
|
||||
'transform_protocol': context['transform_protocol'],
|
||||
}}
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'auth_algorithm': context['auth_algorithm'],
|
||||
'encapsulation_mode': context['encapsulation_mode'],
|
||||
'encryption_algorithm': context['encryption_algorithm'],
|
||||
'lifetime': {'units': context['lifetime_units'],
|
||||
'value': context['lifetime_value']},
|
||||
'pfs': context['pfs'],
|
||||
'transform_protocol': context['transform_protocol'],
|
||||
}}
|
||||
ipsecpolicy = api.vpn.ipsecpolicy_update(
|
||||
request, context['ipsecpolicy_id'], **data)
|
||||
msg = (_('IPSec Policy %s was successfully updated.')
|
||||
@ -205,7 +206,8 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
|
||||
|
||||
class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=80, label=_("Name"), required=False)
|
||||
ipsecsiteconnection_id = forms.CharField(label=_("ID"),
|
||||
ipsecsiteconnection_id = forms.CharField(
|
||||
label=_("ID"),
|
||||
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
|
||||
description = forms.CharField(
|
||||
required=False, max_length=80, label=_("Description"))
|
||||
@ -266,20 +268,20 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
|
||||
context['admin_state_up'] = (context['admin_state_up'] == 'True')
|
||||
try:
|
||||
data = {'ipsec_site_connection':
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'peer_address': context['peer_address'],
|
||||
'peer_id': context['peer_id'],
|
||||
'peer_cidrs': context[
|
||||
'peer_cidrs'].replace(" ", "").split(","),
|
||||
'psk': context['psk'],
|
||||
'mtu': context['mtu'],
|
||||
'dpd': {'action': context['dpd_action'],
|
||||
'interval': context['dpd_interval'],
|
||||
'timeout': context['dpd_timeout']},
|
||||
'initiator': context['initiator'],
|
||||
'admin_state_up': context['admin_state_up'],
|
||||
}}
|
||||
{'name': context['name'],
|
||||
'description': context['description'],
|
||||
'peer_address': context['peer_address'],
|
||||
'peer_id': context['peer_id'],
|
||||
'peer_cidrs': context[
|
||||
'peer_cidrs'].replace(" ", "").split(","),
|
||||
'psk': context['psk'],
|
||||
'mtu': context['mtu'],
|
||||
'dpd': {'action': context['dpd_action'],
|
||||
'interval': context['dpd_interval'],
|
||||
'timeout': context['dpd_timeout']},
|
||||
'initiator': context['initiator'],
|
||||
'admin_state_up': context['admin_state_up'],
|
||||
}}
|
||||
ipsecsiteconnection = api.vpn.ipsecsiteconnection_update(
|
||||
request, context['ipsecsiteconnection_id'], **data)
|
||||
msg = (_('IPSec Site Connection %s was successfully updated.')
|
||||
|
@ -211,7 +211,8 @@ class UpdateIPSecSiteConnectionLink(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, ipsecsiteconnection):
|
||||
return reverse("horizon:project:vpn:update_ipsecsiteconnection",
|
||||
kwargs={'ipsecsiteconnection_id': ipsecsiteconnection.id})
|
||||
kwargs={'ipsecsiteconnection_id':
|
||||
ipsecsiteconnection.id})
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
if datum and datum.status not in forbid_updates:
|
||||
|
@ -35,7 +35,8 @@ class IPSecSiteConnectionsTab(tabs.TableTab):
|
||||
self.tab_group.request, tenant_id=tenant_id)
|
||||
except Exception:
|
||||
ipsecsiteconnections = []
|
||||
exceptions.handle(self.tab_group.request,
|
||||
exceptions.handle(
|
||||
self.tab_group.request,
|
||||
_('Unable to retrieve IPSec Site Connections list.'))
|
||||
for c in ipsecsiteconnections:
|
||||
c.set_id_as_name_if_empty()
|
||||
|
@ -17,7 +17,8 @@ from django.conf.urls import url
|
||||
|
||||
from openstack_dashboard.dashboards.project.vpn import views
|
||||
|
||||
urlpatterns = patterns('openstack_dashboard.dashboards.project.vpn.views',
|
||||
urlpatterns = patterns(
|
||||
'openstack_dashboard.dashboards.project.vpn.views',
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^addikepolicy$',
|
||||
views.AddIKEPolicyView.as_view(), name='addikepolicy'),
|
||||
|
@ -81,7 +81,8 @@ class IndexView(tabs.TabView):
|
||||
_('Deleted IPSec Site Connection %s')
|
||||
% obj_id)
|
||||
except Exception as e:
|
||||
exceptions.handle(request,
|
||||
exceptions.handle(
|
||||
request,
|
||||
_('Unable to delete IPSec Site Connection: %s') % e)
|
||||
|
||||
return self.get(request, *args, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user