Merge "PEP8 E126 has been resolved"
This commit is contained in:
commit
d1afd53a92
@ -33,7 +33,7 @@ class Breadcrumb(html.HTMLElement):
|
|||||||
def get_subfolders(self):
|
def get_subfolders(self):
|
||||||
if self.subfolder_path and not self._subfolders:
|
if self.subfolder_path and not self._subfolders:
|
||||||
(parent, slash, folder) = self.subfolder_path.strip('/') \
|
(parent, slash, folder) = self.subfolder_path.strip('/') \
|
||||||
.rpartition('/')
|
.rpartition('/')
|
||||||
while folder:
|
while folder:
|
||||||
path = "%s%s%s/" % (parent, slash, folder)
|
path = "%s%s%s/" % (parent, slash, folder)
|
||||||
self._subfolders.insert(0, (folder, path))
|
self._subfolders.insert(0, (folder, path))
|
||||||
|
@ -63,7 +63,7 @@ class HorizonMiddleware(object):
|
|||||||
if last_activity and (timestamp - last_activity).seconds > timeout:
|
if last_activity and (timestamp - last_activity).seconds > timeout:
|
||||||
request.session.pop('last_activity')
|
request.session.pop('last_activity')
|
||||||
response = HttpResponseRedirect(
|
response = HttpResponseRedirect(
|
||||||
'%s?next=%s' % (settings.LOGOUT_URL, request.path))
|
'%s?next=%s' % (settings.LOGOUT_URL, request.path))
|
||||||
reason = _("Session timed out.")
|
reason = _("Session timed out.")
|
||||||
utils.add_logout_reason(request, response, reason)
|
utils.add_logout_reason(request, response, reason)
|
||||||
return response
|
return response
|
||||||
|
@ -50,16 +50,16 @@ def filesizeformat(bytes, filesize_number_format):
|
|||||||
"%(size)d", bytes) % {'size': bytes}
|
"%(size)d", bytes) % {'size': bytes}
|
||||||
if bytes < 1024 * 1024:
|
if bytes < 1024 * 1024:
|
||||||
return translation.ugettext_lazy("%s KB") % \
|
return translation.ugettext_lazy("%s KB") % \
|
||||||
filesize_number_format(bytes / 1024)
|
filesize_number_format(bytes / 1024)
|
||||||
if bytes < 1024 * 1024 * 1024:
|
if bytes < 1024 * 1024 * 1024:
|
||||||
return translation.ugettext_lazy("%s MB") % \
|
return translation.ugettext_lazy("%s MB") % \
|
||||||
filesize_number_format(bytes / (1024 * 1024))
|
filesize_number_format(bytes / (1024 * 1024))
|
||||||
if bytes < 1024 * 1024 * 1024 * 1024:
|
if bytes < 1024 * 1024 * 1024 * 1024:
|
||||||
return translation.ugettext_lazy("%s GB") % \
|
return translation.ugettext_lazy("%s GB") % \
|
||||||
filesize_number_format(bytes / (1024 * 1024 * 1024))
|
filesize_number_format(bytes / (1024 * 1024 * 1024))
|
||||||
if bytes < 1024 * 1024 * 1024 * 1024 * 1024:
|
if bytes < 1024 * 1024 * 1024 * 1024 * 1024:
|
||||||
return translation.ugettext_lazy("%s TB") % \
|
return translation.ugettext_lazy("%s TB") % \
|
||||||
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024))
|
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024))
|
||||||
return translation.ugettext_lazy("%s PB") % \
|
return translation.ugettext_lazy("%s PB") % \
|
||||||
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024))
|
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024))
|
||||||
|
|
||||||
|
@ -119,12 +119,12 @@ class SelectWidget(widgets.Select):
|
|||||||
if not isinstance(option_label, (basestring, Promise)):
|
if not isinstance(option_label, (basestring, Promise)):
|
||||||
for data_attr in self.data_attrs:
|
for data_attr in self.data_attrs:
|
||||||
data_value = conditional_escape(
|
data_value = conditional_escape(
|
||||||
force_unicode(getattr(option_label,
|
force_unicode(getattr(option_label,
|
||||||
data_attr, "")))
|
data_attr, "")))
|
||||||
other_html += ' data-%s="%s"' % (data_attr, data_value)
|
other_html += ' data-%s="%s"' % (data_attr, data_value)
|
||||||
|
|
||||||
if self.transform:
|
if self.transform:
|
||||||
option_label = self.transform(option_label)
|
option_label = self.transform(option_label)
|
||||||
return u'<option value="%s"%s>%s</option>' % (
|
return u'<option value="%s"%s>%s</option>' % (
|
||||||
escape(option_value), other_html,
|
escape(option_value), other_html,
|
||||||
conditional_escape(force_unicode(option_label)))
|
conditional_escape(force_unicode(option_label)))
|
||||||
|
@ -775,8 +775,8 @@ class Workflow(html.HTMLElement):
|
|||||||
missing = self.depends_on - set(self.context.keys())
|
missing = self.depends_on - set(self.context.keys())
|
||||||
if missing:
|
if missing:
|
||||||
raise exceptions.WorkflowValidationError(
|
raise exceptions.WorkflowValidationError(
|
||||||
"Unable to complete the workflow. The values %s are "
|
"Unable to complete the workflow. The values %s are "
|
||||||
"required but not present." % ", ".join(missing))
|
"required but not present." % ", ".join(missing))
|
||||||
|
|
||||||
# Validate each step. Cycle through all of them to catch all errors
|
# Validate each step. Cycle through all of them to catch all errors
|
||||||
# in one pass before returning.
|
# in one pass before returning.
|
||||||
|
@ -115,7 +115,7 @@ def volume_snapshot_list(request):
|
|||||||
|
|
||||||
def volume_snapshot_create(request, volume_id, name, description):
|
def volume_snapshot_create(request, volume_id, name, description):
|
||||||
return cinderclient(request).volume_snapshots.create(
|
return cinderclient(request).volume_snapshots.create(
|
||||||
volume_id, display_name=name, display_description=description)
|
volume_id, display_name=name, display_description=description)
|
||||||
|
|
||||||
|
|
||||||
def volume_snapshot_delete(request, snapshot_id):
|
def volume_snapshot_delete(request, snapshot_id):
|
||||||
|
@ -232,9 +232,10 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
|
|||||||
% instance_id)
|
% instance_id)
|
||||||
if body:
|
if body:
|
||||||
# Wrap data in SG objects as novaclient would.
|
# Wrap data in SG objects as novaclient would.
|
||||||
sg_objs = [nova_security_groups.SecurityGroup(
|
sg_objs = [
|
||||||
nclient.security_groups, sg, loaded=True)
|
nova_security_groups.SecurityGroup(
|
||||||
for sg in body.get('security_groups', [])]
|
nclient.security_groups, sg, loaded=True)
|
||||||
|
for sg in body.get('security_groups', [])]
|
||||||
# Then wrap novaclient's object with our own. Yes, sadly wrapping
|
# Then wrap novaclient's object with our own. Yes, sadly wrapping
|
||||||
# with two layers of objects is necessary.
|
# with two layers of objects is necessary.
|
||||||
security_groups = [SecurityGroup(sg) for sg in sg_objs]
|
security_groups = [SecurityGroup(sg) for sg in sg_objs]
|
||||||
@ -365,7 +366,7 @@ def server_vnc_console(request, instance_id, console_type='novnc'):
|
|||||||
|
|
||||||
def server_spice_console(request, instance_id, console_type='spice-html5'):
|
def server_spice_console(request, instance_id, console_type='spice-html5'):
|
||||||
return SPICEConsole(novaclient(request).servers.get_spice_console(
|
return SPICEConsole(novaclient(request).servers.get_spice_console(
|
||||||
instance_id, console_type)['console'])
|
instance_id, console_type)['console'])
|
||||||
|
|
||||||
|
|
||||||
def flavor_create(request, name, memory, vcpu, disk, flavorid='auto',
|
def flavor_create(request, name, memory, vcpu, disk, flavorid='auto',
|
||||||
@ -402,13 +403,13 @@ def flavor_access_list(request, flavor=None):
|
|||||||
def add_tenant_to_flavor(request, flavor, tenant):
|
def add_tenant_to_flavor(request, flavor, tenant):
|
||||||
"""Add a tenant to the given flavor access list."""
|
"""Add a tenant to the given flavor access list."""
|
||||||
return novaclient(request).flavor_access.add_tenant_access(
|
return novaclient(request).flavor_access.add_tenant_access(
|
||||||
flavor=flavor, tenant=tenant)
|
flavor=flavor, tenant=tenant)
|
||||||
|
|
||||||
|
|
||||||
def remove_tenant_from_flavor(request, flavor, tenant):
|
def remove_tenant_from_flavor(request, flavor, tenant):
|
||||||
"""Remove a tenant from the given flavor access list."""
|
"""Remove a tenant from the given flavor access list."""
|
||||||
return novaclient(request).flavor_access.remove_tenant_access(
|
return novaclient(request).flavor_access.remove_tenant_access(
|
||||||
flavor=flavor, tenant=tenant)
|
flavor=flavor, tenant=tenant)
|
||||||
|
|
||||||
|
|
||||||
def flavor_get_extras(request, flavor_id, raw=False):
|
def flavor_get_extras(request, flavor_id, raw=False):
|
||||||
@ -460,12 +461,12 @@ def server_create(request, name, image, flavor, key_name, user_data,
|
|||||||
block_device_mapping_v2=None, nics=None,
|
block_device_mapping_v2=None, nics=None,
|
||||||
availability_zone=None, instance_count=1, admin_pass=None):
|
availability_zone=None, instance_count=1, admin_pass=None):
|
||||||
return Server(novaclient(request).servers.create(
|
return Server(novaclient(request).servers.create(
|
||||||
name, image, flavor, userdata=user_data,
|
name, image, flavor, userdata=user_data,
|
||||||
security_groups=security_groups,
|
security_groups=security_groups,
|
||||||
key_name=key_name, block_device_mapping=block_device_mapping,
|
key_name=key_name, block_device_mapping=block_device_mapping,
|
||||||
block_device_mapping_v2=block_device_mapping_v2,
|
block_device_mapping_v2=block_device_mapping_v2,
|
||||||
nics=nics, availability_zone=availability_zone,
|
nics=nics, availability_zone=availability_zone,
|
||||||
min_count=instance_count, admin_pass=admin_pass), request)
|
min_count=instance_count, admin_pass=admin_pass), request)
|
||||||
|
|
||||||
|
|
||||||
def server_delete(request, instance):
|
def server_delete(request, instance):
|
||||||
|
@ -136,12 +136,12 @@ def vpnservice_create(request, **kwargs):
|
|||||||
:param router_id: router id for router of VPNService
|
:param router_id: router id for router of VPNService
|
||||||
:param subnet_id: subnet id for subnet of VPNService
|
:param subnet_id: subnet id for subnet of VPNService
|
||||||
"""
|
"""
|
||||||
body = {'vpnservice': {
|
body = {'vpnservice':
|
||||||
'admin_state_up': kwargs['admin_state_up'],
|
{'admin_state_up': kwargs['admin_state_up'],
|
||||||
'name': kwargs['name'],
|
'name': kwargs['name'],
|
||||||
'description': kwargs['description'],
|
'description': kwargs['description'],
|
||||||
'router_id': kwargs['router_id'],
|
'router_id': kwargs['router_id'],
|
||||||
'subnet_id': kwargs['subnet_id']}
|
'subnet_id': kwargs['subnet_id']}
|
||||||
}
|
}
|
||||||
vpnservice = neutronclient(request).create_vpnservice(body).get(
|
vpnservice = neutronclient(request).create_vpnservice(body).get(
|
||||||
'vpnservice')
|
'vpnservice')
|
||||||
@ -182,17 +182,15 @@ def ikepolicy_create(request, **kwargs):
|
|||||||
:param pfs: Perfect Forward Secrecy for IKEPolicy
|
:param pfs: Perfect Forward Secrecy for IKEPolicy
|
||||||
:param phase1_negotiation_mode: IKE Phase1 negotiation mode for IKEPolicy
|
:param phase1_negotiation_mode: IKE Phase1 negotiation mode for IKEPolicy
|
||||||
"""
|
"""
|
||||||
body = {'ikepolicy': {
|
body = {'ikepolicy':
|
||||||
'name': kwargs['name'],
|
{'name': kwargs['name'],
|
||||||
'description': kwargs['description'],
|
'description': kwargs['description'],
|
||||||
'auth_algorithm': kwargs['auth_algorithm'],
|
'auth_algorithm': kwargs['auth_algorithm'],
|
||||||
'encryption_algorithm': kwargs[
|
'encryption_algorithm': kwargs['encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'ike_version': kwargs['ike_version'],
|
||||||
'ike_version': kwargs['ike_version'],
|
'lifetime': kwargs['lifetime'],
|
||||||
'lifetime': kwargs['lifetime'],
|
'pfs': kwargs['pfs'],
|
||||||
'pfs': kwargs['pfs'],
|
'phase1_negotiation_mode': kwargs['phase1_negotiation_mode']}
|
||||||
'phase1_negotiation_mode': kwargs[
|
|
||||||
'phase1_negotiation_mode']}
|
|
||||||
}
|
}
|
||||||
ikepolicy = neutronclient(request).create_ikepolicy(body).get(
|
ikepolicy = neutronclient(request).create_ikepolicy(body).get(
|
||||||
'ikepolicy')
|
'ikepolicy')
|
||||||
@ -233,15 +231,15 @@ def ipsecpolicy_create(request, **kwargs):
|
|||||||
:param pfs: Perfect Forward Secrecy for IPSecPolicy
|
:param pfs: Perfect Forward Secrecy for IPSecPolicy
|
||||||
:param transform_protocol: Transform Protocol for IPSecPolicy
|
:param transform_protocol: Transform Protocol for IPSecPolicy
|
||||||
"""
|
"""
|
||||||
body = {'ipsecpolicy': {
|
body = {'ipsecpolicy':
|
||||||
'name': kwargs['name'],
|
{'name': kwargs['name'],
|
||||||
'description': kwargs['description'],
|
'description': kwargs['description'],
|
||||||
'auth_algorithm': kwargs['auth_algorithm'],
|
'auth_algorithm': kwargs['auth_algorithm'],
|
||||||
'encapsulation_mode': kwargs['encapsulation_mode'],
|
'encapsulation_mode': kwargs['encapsulation_mode'],
|
||||||
'encryption_algorithm': kwargs['encryption_algorithm'],
|
'encryption_algorithm': kwargs['encryption_algorithm'],
|
||||||
'lifetime': kwargs['lifetime'],
|
'lifetime': kwargs['lifetime'],
|
||||||
'pfs': kwargs['pfs'],
|
'pfs': kwargs['pfs'],
|
||||||
'transform_protocol': kwargs['transform_protocol']}
|
'transform_protocol': kwargs['transform_protocol']}
|
||||||
}
|
}
|
||||||
ipsecpolicy = neutronclient(request).create_ipsecpolicy(body).get(
|
ipsecpolicy = neutronclient(request).create_ipsecpolicy(body).get(
|
||||||
'ipsecpolicy')
|
'ipsecpolicy')
|
||||||
@ -288,20 +286,20 @@ def ipsecsiteconnection_create(request, **kwargs):
|
|||||||
:param vpnservice_id: VPNService associated with this connection
|
:param vpnservice_id: VPNService associated with this connection
|
||||||
:param admin_state_up: admin state (default on)
|
:param admin_state_up: admin state (default on)
|
||||||
"""
|
"""
|
||||||
body = {'ipsec_site_connection': {
|
body = {'ipsec_site_connection':
|
||||||
'name': kwargs['name'],
|
{'name': kwargs['name'],
|
||||||
'description': kwargs['description'],
|
'description': kwargs['description'],
|
||||||
'dpd': kwargs['dpd'],
|
'dpd': kwargs['dpd'],
|
||||||
'ikepolicy_id': kwargs['ikepolicy_id'],
|
'ikepolicy_id': kwargs['ikepolicy_id'],
|
||||||
'initiator': kwargs['initiator'],
|
'initiator': kwargs['initiator'],
|
||||||
'ipsecpolicy_id': kwargs['ipsecpolicy_id'],
|
'ipsecpolicy_id': kwargs['ipsecpolicy_id'],
|
||||||
'mtu': kwargs['mtu'],
|
'mtu': kwargs['mtu'],
|
||||||
'peer_address': kwargs['peer_address'],
|
'peer_address': kwargs['peer_address'],
|
||||||
'peer_cidrs': kwargs['peer_cidrs'],
|
'peer_cidrs': kwargs['peer_cidrs'],
|
||||||
'peer_id': kwargs['peer_id'],
|
'peer_id': kwargs['peer_id'],
|
||||||
'psk': kwargs['psk'],
|
'psk': kwargs['psk'],
|
||||||
'vpnservice_id': kwargs['vpnservice_id'],
|
'vpnservice_id': kwargs['vpnservice_id'],
|
||||||
'admin_state_up': kwargs['admin_state_up']}
|
'admin_state_up': kwargs['admin_state_up']}
|
||||||
}
|
}
|
||||||
ipsecsiteconnection = neutronclient(request).create_ipsec_site_connection(
|
ipsecsiteconnection = neutronclient(request).create_ipsec_site_connection(
|
||||||
body).get('ipsec_site_connection')
|
body).get('ipsec_site_connection')
|
||||||
|
@ -23,7 +23,7 @@ from horizon import workflows
|
|||||||
|
|
||||||
from openstack_dashboard.dashboards.admin.defaults import tabs as project_tabs
|
from openstack_dashboard.dashboards.admin.defaults import tabs as project_tabs
|
||||||
from openstack_dashboard.dashboards.admin.defaults import workflows as \
|
from openstack_dashboard.dashboards.admin.defaults import workflows as \
|
||||||
project_workflows
|
project_workflows
|
||||||
from openstack_dashboard.usage import quotas
|
from openstack_dashboard.usage import quotas
|
||||||
|
|
||||||
|
|
||||||
|
@ -238,8 +238,8 @@ class UpdateFlavorInfoAction(CreateFlavorInfoAction):
|
|||||||
for flavor in flavors:
|
for flavor in flavors:
|
||||||
if flavor.name == name and flavor.id != flavor_id:
|
if flavor.name == name and flavor.id != flavor_id:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_('The name "%s" is already used by another '
|
_('The name "%s" is already used by another '
|
||||||
'flavor.') % name)
|
'flavor.') % name)
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from openstack_dashboard.dashboards.project.images_and_snapshots \
|
from openstack_dashboard.dashboards.project.images_and_snapshots \
|
||||||
.images import forms
|
.images import forms
|
||||||
|
|
||||||
|
|
||||||
class AdminCreateImageForm(forms.CreateImageForm):
|
class AdminCreateImageForm(forms.CreateImageForm):
|
||||||
|
@ -40,12 +40,12 @@ class ImagesViewTest(test.BaseAdminViewTests):
|
|||||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||||
marker=None,
|
marker=None,
|
||||||
paginate=True) \
|
paginate=True) \
|
||||||
.AndReturn([self.images.list(),
|
.AndReturn([self.images.list(),
|
||||||
False])
|
False])
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
res = self.client.get(
|
res = self.client.get(
|
||||||
reverse('horizon:admin:images:index'))
|
reverse('horizon:admin:images:index'))
|
||||||
self.assertTemplateUsed(res, 'admin/images/index.html')
|
self.assertTemplateUsed(res, 'admin/images/index.html')
|
||||||
self.assertEqual(len(res.context['images_table'].data),
|
self.assertEqual(len(res.context['images_table'].data),
|
||||||
len(self.images.list()))
|
len(self.images.list()))
|
||||||
|
@ -28,7 +28,7 @@ from horizon import tables
|
|||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.dashboards.project \
|
from openstack_dashboard.dashboards.project \
|
||||||
.images_and_snapshots.images import views
|
.images_and_snapshots.images import views
|
||||||
|
|
||||||
from openstack_dashboard.dashboards.admin.images import forms
|
from openstack_dashboard.dashboards.admin.images import forms
|
||||||
from openstack_dashboard.dashboards.admin.images \
|
from openstack_dashboard.dashboards.admin.images \
|
||||||
|
@ -71,7 +71,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
AndReturn([tenants, False])
|
AndReturn([tenants, False])
|
||||||
for server in servers:
|
for server in servers:
|
||||||
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
||||||
AndReturn(full_flavors[server.flavor["id"]])
|
AndReturn(full_flavors[server.flavor["id"]])
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
AndReturn([tenants, False])
|
AndReturn([tenants, False])
|
||||||
for server in servers:
|
for server in servers:
|
||||||
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
||||||
AndRaise(self.exceptions.nova)
|
AndRaise(self.exceptions.nova)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
res = self.client.get(reverse('horizon:admin:instances:index'))
|
res = self.client.get(reverse('horizon:admin:instances:index'))
|
||||||
|
@ -69,10 +69,10 @@ class AdminIndexView(tables.DataTableView):
|
|||||||
project_tables.AdminInstancesTable._meta.pagination_param, None)
|
project_tables.AdminInstancesTable._meta.pagination_param, None)
|
||||||
try:
|
try:
|
||||||
instances, self._more = api.nova.server_list(
|
instances, self._more = api.nova.server_list(
|
||||||
self.request,
|
self.request,
|
||||||
search_opts={'marker': marker,
|
search_opts={'marker': marker,
|
||||||
'paginate': True},
|
'paginate': True},
|
||||||
all_tenants=True)
|
all_tenants=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
self._more = False
|
self._more = False
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
@ -105,7 +105,7 @@ class AdminIndexView(tables.DataTableView):
|
|||||||
# If the flavor_id is not in full_flavors list,
|
# If the flavor_id is not in full_flavors list,
|
||||||
# gets it via nova api.
|
# gets it via nova api.
|
||||||
inst.full_flavor = api.nova.flavor_get(
|
inst.full_flavor = api.nova.flavor_get(
|
||||||
self.request, flavor_id)
|
self.request, flavor_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = _('Unable to retrieve instance size information.')
|
msg = _('Unable to retrieve instance size information.')
|
||||||
exceptions.handle(self.request, msg)
|
exceptions.handle(self.request, msg)
|
||||||
|
@ -28,10 +28,10 @@ from openstack_dashboard.dashboards.admin.metering import tables
|
|||||||
def make_tenant_queries(request, days_before=30):
|
def make_tenant_queries(request, days_before=30):
|
||||||
try:
|
try:
|
||||||
tenants, more = api.keystone.tenant_list(
|
tenants, more = api.keystone.tenant_list(
|
||||||
request,
|
request,
|
||||||
domain=None,
|
domain=None,
|
||||||
paginate=True,
|
paginate=True,
|
||||||
marker="tenant_marker")
|
marker="tenant_marker")
|
||||||
except Exception:
|
except Exception:
|
||||||
tenants = []
|
tenants = []
|
||||||
exceptions.handle(request,
|
exceptions.handle(request,
|
||||||
@ -39,9 +39,9 @@ def make_tenant_queries(request, days_before=30):
|
|||||||
queries = {}
|
queries = {}
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
tenant_query = [{
|
tenant_query = [{
|
||||||
"field": "project_id",
|
"field": "project_id",
|
||||||
"op": "eq",
|
"op": "eq",
|
||||||
"value": tenant.id}]
|
"value": tenant.id}]
|
||||||
|
|
||||||
queries[tenant.name] = tenant_query
|
queries[tenant.name] = tenant_query
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ class SamplesView(TemplateView):
|
|||||||
queries = {}
|
queries = {}
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
tenant_query = [{
|
tenant_query = [{
|
||||||
"field": "project_id",
|
"field": "project_id",
|
||||||
"op": "eq",
|
"op": "eq",
|
||||||
"value": tenant.id}]
|
"value": tenant.id}]
|
||||||
|
|
||||||
queries[tenant.name] = tenant_query
|
queries[tenant.name] = tenant_query
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
def test_network_create_get(self):
|
def test_network_create_get(self):
|
||||||
tenants = self.tenants.list()
|
tenants = self.tenants.list()
|
||||||
api.keystone.tenant_list(IsA(
|
api.keystone.tenant_list(IsA(
|
||||||
http.HttpRequest)).AndReturn([tenants, False])
|
http.HttpRequest)).AndReturn([tenants, False])
|
||||||
# TODO(absubram): Remove if clause and create separate
|
# TODO(absubram): Remove if clause and create separate
|
||||||
# test stubs for when profile_support is being used.
|
# test stubs for when profile_support is being used.
|
||||||
# Additionally ensure those are always run even in default setting
|
# Additionally ensure those are always run even in default setting
|
||||||
|
@ -78,7 +78,7 @@ class IndexView(tables.DataTableView):
|
|||||||
def get_data(self):
|
def get_data(self):
|
||||||
tenants = []
|
tenants = []
|
||||||
marker = self.request.GET.get(
|
marker = self.request.GET.get(
|
||||||
project_tables.TenantsTable._meta.pagination_param, None)
|
project_tables.TenantsTable._meta.pagination_param, None)
|
||||||
domain_context = self.request.session.get('domain_context', None)
|
domain_context = self.request.session.get('domain_context', None)
|
||||||
try:
|
try:
|
||||||
tenants, self._more = api.keystone.tenant_list(
|
tenants, self._more = api.keystone.tenant_list(
|
||||||
|
@ -522,11 +522,11 @@ class UpdateProject(workflows.Workflow):
|
|||||||
# update project info
|
# update project info
|
||||||
try:
|
try:
|
||||||
project = api.keystone.tenant_update(
|
project = api.keystone.tenant_update(
|
||||||
request,
|
request,
|
||||||
project_id,
|
project_id,
|
||||||
name=data['name'],
|
name=data['name'],
|
||||||
description=data['description'],
|
description=data['description'],
|
||||||
enabled=data['enabled'])
|
enabled=data['enabled'])
|
||||||
# Use the domain_id from the project if available
|
# Use the domain_id from the project if available
|
||||||
domain_id = getattr(project, "domain_id", None)
|
domain_id = getattr(project, "domain_id", None)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -329,8 +329,8 @@ class UsersViewTests(test.BaseAdminViewTests):
|
|||||||
res = self.client.post(USER_UPDATE_URL, formData)
|
res = self.client.post(USER_UPDATE_URL, formData)
|
||||||
|
|
||||||
self.assertFormError(
|
self.assertFormError(
|
||||||
res, "form", 'password',
|
res, "form", 'password',
|
||||||
['Password must be between 8 and 18 characters.'])
|
['Password must be between 8 and 18 characters.'])
|
||||||
|
|
||||||
@test.create_stubs({api.keystone: ('domain_get',
|
@test.create_stubs({api.keystone: ('domain_get',
|
||||||
'user_get',
|
'user_get',
|
||||||
@ -360,8 +360,8 @@ class UsersViewTests(test.BaseAdminViewTests):
|
|||||||
res = self.client.post(USER_UPDATE_URL, formData)
|
res = self.client.post(USER_UPDATE_URL, formData)
|
||||||
|
|
||||||
self.assertFormError(
|
self.assertFormError(
|
||||||
res, "form", 'password',
|
res, "form", 'password',
|
||||||
['Password must be between 8 and 18 characters.'])
|
['Password must be between 8 and 18 characters.'])
|
||||||
|
|
||||||
@test.create_stubs({api.keystone: ('user_update_enabled', 'user_list')})
|
@test.create_stubs({api.keystone: ('user_update_enabled', 'user_list')})
|
||||||
def test_enable_user(self):
|
def test_enable_user(self):
|
||||||
|
@ -63,7 +63,7 @@ class KeyPairViewTests(test.TestCase):
|
|||||||
|
|
||||||
def test_create_keypair_get(self):
|
def test_create_keypair_get(self):
|
||||||
res = self.client.get(
|
res = self.client.get(
|
||||||
reverse('horizon:project:access_and_security:keypairs:create'))
|
reverse('horizon:project:access_and_security:keypairs:create'))
|
||||||
self.assertTemplateUsed(res,
|
self.assertTemplateUsed(res,
|
||||||
'project/access_and_security/keypairs/create.html')
|
'project/access_and_security/keypairs/create.html')
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class KeyPairViewTests(test.TestCase):
|
|||||||
kwargs={'keypair_name': keypair_name})
|
kwargs={'keypair_name': keypair_name})
|
||||||
res = self.client.get(url, context)
|
res = self.client.get(url, context)
|
||||||
self.assertTemplateUsed(
|
self.assertTemplateUsed(
|
||||||
res, 'project/access_and_security/keypairs/download.html')
|
res, 'project/access_and_security/keypairs/download.html')
|
||||||
|
|
||||||
def test_generate_keypair_get(self):
|
def test_generate_keypair_get(self):
|
||||||
keypair = self.keypairs.first()
|
keypair = self.keypairs.first()
|
||||||
@ -141,4 +141,4 @@ class KeyPairViewTests(test.TestCase):
|
|||||||
res = self.client.get(url, context)
|
res = self.client.get(url, context)
|
||||||
|
|
||||||
self.assertRedirectsNoFollow(
|
self.assertRedirectsNoFollow(
|
||||||
res, reverse('horizon:project:access_and_security:index'))
|
res, reverse('horizon:project:access_and_security:index'))
|
||||||
|
@ -97,8 +97,8 @@ class AddRule(forms.SelfHandlingForm):
|
|||||||
id = forms.CharField(widget=forms.HiddenInput())
|
id = forms.CharField(widget=forms.HiddenInput())
|
||||||
rule_menu = forms.ChoiceField(label=_('Rule'),
|
rule_menu = forms.ChoiceField(label=_('Rule'),
|
||||||
widget=forms.Select(attrs={
|
widget=forms.Select(attrs={
|
||||||
'class': 'switchable',
|
'class': 'switchable',
|
||||||
'data-slug': 'rule_menu'}))
|
'data-slug': 'rule_menu'}))
|
||||||
|
|
||||||
# "direction" field is enabled only when custom mode.
|
# "direction" field is enabled only when custom mode.
|
||||||
# It is because most common rules in local_settings.py is meaningful
|
# It is because most common rules in local_settings.py is meaningful
|
||||||
@ -365,15 +365,15 @@ class AddRule(forms.SelfHandlingForm):
|
|||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
rule = api.network.security_group_rule_create(
|
rule = api.network.security_group_rule_create(
|
||||||
request,
|
request,
|
||||||
filters.get_int_or_uuid(data['id']),
|
filters.get_int_or_uuid(data['id']),
|
||||||
data['direction'],
|
data['direction'],
|
||||||
data['ethertype'],
|
data['ethertype'],
|
||||||
data['ip_protocol'],
|
data['ip_protocol'],
|
||||||
data['from_port'],
|
data['from_port'],
|
||||||
data['to_port'],
|
data['to_port'],
|
||||||
data['cidr'],
|
data['cidr'],
|
||||||
data['security_group'])
|
data['security_group'])
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Successfully added rule: %s') % unicode(rule))
|
_('Successfully added rule: %s') % unicode(rule))
|
||||||
return rule
|
return rule
|
||||||
|
@ -187,7 +187,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||||||
rule.ip_range['cidr'],
|
rule.ip_range['cidr'],
|
||||||
None).AndReturn(rule)
|
None).AndReturn(rule)
|
||||||
api.network.security_group_list(
|
api.network.security_group_list(
|
||||||
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
formData = {'method': 'AddRule',
|
formData = {'method': 'AddRule',
|
||||||
@ -219,7 +219,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||||||
rule.ip_range['cidr'],
|
rule.ip_range['cidr'],
|
||||||
None).AndReturn(rule)
|
None).AndReturn(rule)
|
||||||
api.network.security_group_list(
|
api.network.security_group_list(
|
||||||
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
formData = {'method': 'AddRule',
|
formData = {'method': 'AddRule',
|
||||||
@ -620,7 +620,7 @@ class SecurityGroupsNeutronTests(SecurityGroupsViewTests):
|
|||||||
37, None, None, 'fe80::/48',
|
37, None, None, 'fe80::/48',
|
||||||
None).AndReturn(rule)
|
None).AndReturn(rule)
|
||||||
api.network.security_group_list(
|
api.network.security_group_list(
|
||||||
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
formData = {'method': 'AddRule',
|
formData = {'method': 'AddRule',
|
||||||
@ -649,7 +649,7 @@ class SecurityGroupsNeutronTests(SecurityGroupsViewTests):
|
|||||||
'udp', 80, 80, '10.1.1.0/24',
|
'udp', 80, 80, '10.1.1.0/24',
|
||||||
None).AndReturn(rule)
|
None).AndReturn(rule)
|
||||||
api.network.security_group_list(
|
api.network.security_group_list(
|
||||||
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
IsA(http.HttpRequest)).AndReturn(sec_group_list)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
formData = {'method': 'AddRule',
|
formData = {'method': 'AddRule',
|
||||||
|
@ -127,7 +127,7 @@ class AddRuleView(forms.ModalFormView):
|
|||||||
security_groups = []
|
security_groups = []
|
||||||
for group in groups:
|
for group in groups:
|
||||||
if group.id == filters.get_int_or_uuid(
|
if group.id == filters.get_int_or_uuid(
|
||||||
self.kwargs['security_group_id']):
|
self.kwargs['security_group_id']):
|
||||||
security_groups.append((group.id,
|
security_groups.append((group.id,
|
||||||
_("%s (current)") % group.name))
|
_("%s (current)") % group.name))
|
||||||
else:
|
else:
|
||||||
|
@ -143,7 +143,7 @@ class CreateImageForm(forms.SelfHandlingForm):
|
|||||||
image = api.glance.image_create(request, **meta)
|
image = api.glance.image_create(request, **meta)
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Your image %s has been queued for creation.') %
|
_('Your image %s has been queued for creation.') %
|
||||||
data['name'])
|
data['name'])
|
||||||
return image
|
return image
|
||||||
except Exception:
|
except Exception:
|
||||||
exceptions.handle(request, _('Unable to create new image.'))
|
exceptions.handle(request, _('Unable to create new image.'))
|
||||||
|
@ -85,8 +85,8 @@ class ImageViewTests(test.TestCase):
|
|||||||
'description': u'Login with admin/admin',
|
'description': u'Login with admin/admin',
|
||||||
'source_type': u'url',
|
'source_type': u'url',
|
||||||
'copy_from': u'http://cloud-images.ubuntu.com/releases/'
|
'copy_from': u'http://cloud-images.ubuntu.com/releases/'
|
||||||
u'oneiric/release/ubuntu-11.10-server-cloudimg'
|
u'oneiric/release/ubuntu-11.10-server-cloudimg'
|
||||||
u'-amd64-disk1.img',
|
u'-amd64-disk1.img',
|
||||||
'disk_format': u'qcow2',
|
'disk_format': u'qcow2',
|
||||||
'minimum_disk': 15,
|
'minimum_disk': 15,
|
||||||
'minimum_ram': 512,
|
'minimum_ram': 512,
|
||||||
@ -161,8 +161,8 @@ class ImageViewTests(test.TestCase):
|
|||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
res = self.client.get(
|
res = self.client.get(
|
||||||
reverse('horizon:project:images_and_snapshots:images:detail',
|
reverse('horizon:project:images_and_snapshots:images:detail',
|
||||||
args=[image.id]))
|
args=[image.id]))
|
||||||
self.assertTemplateUsed(res,
|
self.assertTemplateUsed(res,
|
||||||
'project/images_and_snapshots/images/detail.html')
|
'project/images_and_snapshots/images/detail.html')
|
||||||
self.assertEqual(res.context['image'].name, image.name)
|
self.assertEqual(res.context['image'].name, image.name)
|
||||||
@ -177,8 +177,8 @@ class ImageViewTests(test.TestCase):
|
|||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
res = self.client.get(
|
res = self.client.get(
|
||||||
reverse('horizon:project:images_and_snapshots:images:detail',
|
reverse('horizon:project:images_and_snapshots:images:detail',
|
||||||
args=[image.id]))
|
args=[image.id]))
|
||||||
self.assertTemplateUsed(res,
|
self.assertTemplateUsed(res,
|
||||||
'project/images_and_snapshots/images/detail.html')
|
'project/images_and_snapshots/images/detail.html')
|
||||||
self.assertEqual(res.context['image'].protected, image.protected)
|
self.assertEqual(res.context['image'].protected, image.protected)
|
||||||
|
@ -108,7 +108,7 @@ class InstanceTests(test.TestCase):
|
|||||||
.AndRaise(self.exceptions.nova)
|
.AndRaise(self.exceptions.nova)
|
||||||
for server in servers:
|
for server in servers:
|
||||||
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
||||||
AndReturn(full_flavors[server.flavor["id"]])
|
AndReturn(full_flavors[server.flavor["id"]])
|
||||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||||
.MultipleTimes().AndReturn(self.limits['absolute'])
|
.MultipleTimes().AndReturn(self.limits['absolute'])
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class InstanceTests(test.TestCase):
|
|||||||
api.nova.flavor_list(IsA(http.HttpRequest)).AndReturn(flavors)
|
api.nova.flavor_list(IsA(http.HttpRequest)).AndReturn(flavors)
|
||||||
for server in servers:
|
for server in servers:
|
||||||
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"]). \
|
||||||
AndRaise(self.exceptions.nova)
|
AndRaise(self.exceptions.nova)
|
||||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||||
.MultipleTimes().AndReturn(self.limits['absolute'])
|
.MultipleTimes().AndReturn(self.limits['absolute'])
|
||||||
|
|
||||||
@ -1328,9 +1328,9 @@ class InstanceTests(test.TestCase):
|
|||||||
'availability_zone_list',)})
|
'availability_zone_list',)})
|
||||||
def test_launch_flavorlist_error(self):
|
def test_launch_flavorlist_error(self):
|
||||||
cinder.volume_list(IsA(http.HttpRequest)) \
|
cinder.volume_list(IsA(http.HttpRequest)) \
|
||||||
.AndReturn(self.volumes.list())
|
.AndReturn(self.volumes.list())
|
||||||
cinder.volume_snapshot_list(IsA(http.HttpRequest)) \
|
cinder.volume_snapshot_list(IsA(http.HttpRequest)) \
|
||||||
.AndReturn(self.volumes.list())
|
.AndReturn(self.volumes.list())
|
||||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||||
filters={'is_public': True,
|
filters={'is_public': True,
|
||||||
'status': 'active'}) \
|
'status': 'active'}) \
|
||||||
|
@ -63,9 +63,9 @@ class IndexView(tables.DataTableView):
|
|||||||
# Gather our instances
|
# Gather our instances
|
||||||
try:
|
try:
|
||||||
instances, self._more = api.nova.server_list(
|
instances, self._more = api.nova.server_list(
|
||||||
self.request,
|
self.request,
|
||||||
search_opts={'marker': marker,
|
search_opts={'marker': marker,
|
||||||
'paginate': True})
|
'paginate': True})
|
||||||
except Exception:
|
except Exception:
|
||||||
self._more = False
|
self._more = False
|
||||||
instances = []
|
instances = []
|
||||||
|
@ -382,15 +382,15 @@ class SetAccessControlsAction(workflows.Action):
|
|||||||
"authentication."),
|
"authentication."),
|
||||||
add_item_link=KEYPAIR_IMPORT_URL)
|
add_item_link=KEYPAIR_IMPORT_URL)
|
||||||
admin_pass = forms.RegexField(
|
admin_pass = forms.RegexField(
|
||||||
label=_("Admin Pass"),
|
label=_("Admin Pass"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.PasswordInput(render_value=False),
|
widget=forms.PasswordInput(render_value=False),
|
||||||
regex=validators.password_validator(),
|
regex=validators.password_validator(),
|
||||||
error_messages={'invalid': validators.password_validator_msg()})
|
error_messages={'invalid': validators.password_validator_msg()})
|
||||||
confirm_admin_pass = forms.CharField(
|
confirm_admin_pass = forms.CharField(
|
||||||
label=_("Confirm Admin Pass"),
|
label=_("Confirm Admin Pass"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.PasswordInput(render_value=False))
|
widget=forms.PasswordInput(render_value=False))
|
||||||
groups = forms.MultipleChoiceField(label=_("Security Groups"),
|
groups = forms.MultipleChoiceField(label=_("Security Groups"),
|
||||||
required=True,
|
required=True,
|
||||||
initial=["default"],
|
initial=["default"],
|
||||||
|
@ -777,5 +777,5 @@ class LoadBalancerTests(test.TestCase):
|
|||||||
self.assertEqual(workflow.name, workflows.DeletePMAssociation.name)
|
self.assertEqual(workflow.name, workflows.DeletePMAssociation.name)
|
||||||
|
|
||||||
expected_objs = [
|
expected_objs = [
|
||||||
'<DeletePMAssociationStep: deletepmassociationaction>', ]
|
'<DeletePMAssociationStep: deletepmassociationaction>', ]
|
||||||
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
||||||
|
@ -272,7 +272,7 @@ class UpdateMonitorView(forms.ModalFormView):
|
|||||||
monitor_id = self.kwargs['monitor_id']
|
monitor_id = self.kwargs['monitor_id']
|
||||||
try:
|
try:
|
||||||
self._object = api.lbaas.pool_health_monitor_get(
|
self._object = api.lbaas.pool_health_monitor_get(
|
||||||
self.request, monitor_id)
|
self.request, monitor_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
redirect = self.success_url
|
redirect = self.success_url
|
||||||
msg = _('Unable to retrieve health monitor details. %s') % e
|
msg = _('Unable to retrieve health monitor details. %s') % e
|
||||||
|
@ -555,7 +555,7 @@ class DeletePMAssociationAction(workflows.Action):
|
|||||||
|
|
||||||
def __init__(self, request, *args, **kwargs):
|
def __init__(self, request, *args, **kwargs):
|
||||||
super(DeletePMAssociationAction, self).__init__(
|
super(DeletePMAssociationAction, self).__init__(
|
||||||
request, *args, **kwargs)
|
request, *args, **kwargs)
|
||||||
|
|
||||||
def populate_monitor_id_choices(self, request, context):
|
def populate_monitor_id_choices(self, request, context):
|
||||||
self.fields['monitor_id'].label = (_("Select a health monitor of %s") %
|
self.fields['monitor_id'].label = (_("Select a health monitor of %s") %
|
||||||
@ -585,7 +585,7 @@ class DeletePMAssociationStep(workflows.Step):
|
|||||||
|
|
||||||
def contribute(self, data, context):
|
def contribute(self, data, context):
|
||||||
context = super(DeletePMAssociationStep, self).contribute(
|
context = super(DeletePMAssociationStep, self).contribute(
|
||||||
data, context)
|
data, context)
|
||||||
if data:
|
if data:
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -104,16 +104,16 @@ class UpdateSubnetInfoAction(CreateSubnetInfoAction):
|
|||||||
label=_("IP Version"))
|
label=_("IP Version"))
|
||||||
|
|
||||||
gateway_ip = fields.IPField(
|
gateway_ip = fields.IPField(
|
||||||
label=_("Gateway IP (optional)"),
|
label=_("Gateway IP (optional)"),
|
||||||
required=False,
|
required=False,
|
||||||
initial="",
|
initial="",
|
||||||
help_text=_("IP address of Gateway (e.g. 192.168.0.254). "
|
help_text=_("IP address of Gateway (e.g. 192.168.0.254). "
|
||||||
"You need to specify an explicit address "
|
"You need to specify an explicit address "
|
||||||
"to set the gateway. "
|
"to set the gateway. "
|
||||||
"If you want to use no gateway, "
|
"If you want to use no gateway, "
|
||||||
"check 'Disable Gateway' below."),
|
"check 'Disable Gateway' below."),
|
||||||
version=fields.IPv4 | fields.IPv6,
|
version=fields.IPv4 | fields.IPv6,
|
||||||
mask=False)
|
mask=False)
|
||||||
no_gateway = forms.BooleanField(label=_("Disable Gateway"),
|
no_gateway = forms.BooleanField(label=_("Disable Gateway"),
|
||||||
initial=False, required=False)
|
initial=False, required=False)
|
||||||
|
|
||||||
|
@ -97,18 +97,18 @@ class CreateSubnetInfoAction(workflows.Action):
|
|||||||
ip_version = forms.ChoiceField(choices=[(4, 'IPv4'), (6, 'IPv6')],
|
ip_version = forms.ChoiceField(choices=[(4, 'IPv4'), (6, 'IPv6')],
|
||||||
label=_("IP Version"))
|
label=_("IP Version"))
|
||||||
gateway_ip = fields.IPField(
|
gateway_ip = fields.IPField(
|
||||||
label=_("Gateway IP"),
|
label=_("Gateway IP"),
|
||||||
required=False,
|
required=False,
|
||||||
initial="",
|
initial="",
|
||||||
help_text=_("IP address of Gateway (e.g. 192.168.0.254) "
|
help_text=_("IP address of Gateway (e.g. 192.168.0.254) "
|
||||||
"The default value is the first IP of the "
|
"The default value is the first IP of the "
|
||||||
"network address (e.g. 192.168.0.1 for "
|
"network address (e.g. 192.168.0.1 for "
|
||||||
"192.168.0.0/24). "
|
"192.168.0.0/24). "
|
||||||
"If you use the default, leave blank. "
|
"If you use the default, leave blank. "
|
||||||
"If you want to use no gateway, "
|
"If you want to use no gateway, "
|
||||||
"check 'Disable Gateway' below."),
|
"check 'Disable Gateway' below."),
|
||||||
version=fields.IPv4 | fields.IPv6,
|
version=fields.IPv4 | fields.IPv6,
|
||||||
mask=False)
|
mask=False)
|
||||||
no_gateway = forms.BooleanField(label=_("Disable Gateway"),
|
no_gateway = forms.BooleanField(label=_("Disable Gateway"),
|
||||||
initial=False, required=False)
|
initial=False, required=False)
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class DetailView(tables.MultiTableView):
|
|||||||
router.set_id_as_name_if_empty(length=0)
|
router.set_id_as_name_if_empty(length=0)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = _('Unable to retrieve details for router "%s".') \
|
msg = _('Unable to retrieve details for router "%s".') \
|
||||||
% (router_id)
|
% (router_id)
|
||||||
exceptions.handle(self.request, msg, redirect=self.failure_url)
|
exceptions.handle(self.request, msg, redirect=self.failure_url)
|
||||||
|
|
||||||
if router.external_gateway_info:
|
if router.external_gateway_info:
|
||||||
|
@ -52,10 +52,10 @@ def d3_data(request, stack_id=''):
|
|||||||
if resources:
|
if resources:
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
resource_image = mappings.get_resource_image(
|
resource_image = mappings.get_resource_image(
|
||||||
resource.resource_status,
|
resource.resource_status,
|
||||||
resource.resource_type)
|
resource.resource_type)
|
||||||
resource_status = mappings.get_resource_status(
|
resource_status = mappings.get_resource_status(
|
||||||
resource.resource_status)
|
resource.resource_status)
|
||||||
if resource_status in ('IN_PROGRESS', 'INIT'):
|
if resource_status in ('IN_PROGRESS', 'INIT'):
|
||||||
in_progress = True
|
in_progress = True
|
||||||
else:
|
else:
|
||||||
|
@ -41,19 +41,14 @@ class CreateForm(forms.SelfHandlingForm):
|
|||||||
widget=fields.SelectWidget(
|
widget=fields.SelectWidget(
|
||||||
attrs={'class': 'snapshot-selector'},
|
attrs={'class': 'snapshot-selector'},
|
||||||
data_attrs=('size', 'display_name'),
|
data_attrs=('size', 'display_name'),
|
||||||
transform=lambda x:
|
transform=lambda x: "%s (%sGB)" % (x.display_name, x.size)),
|
||||||
("%s (%sGB)" % (x.display_name,
|
|
||||||
x.size))),
|
|
||||||
required=False)
|
required=False)
|
||||||
image_source = forms.ChoiceField(
|
image_source = forms.ChoiceField(
|
||||||
label=_("Use image as a source"),
|
label=_("Use image as a source"),
|
||||||
widget=fields.SelectWidget(
|
widget=fields.SelectWidget(
|
||||||
attrs={'class': 'image-selector'},
|
attrs={'class': 'image-selector'},
|
||||||
data_attrs=('size', 'name'),
|
data_attrs=('size', 'name'),
|
||||||
transform=lambda x:
|
transform=lambda x: "%s (%s)" % (x.name, filesizeformat(x.bytes))),
|
||||||
("%s (%s)" %
|
|
||||||
(x.name,
|
|
||||||
filesizeformat(x.bytes)))),
|
|
||||||
required=False)
|
required=False)
|
||||||
|
|
||||||
def __init__(self, request, *args, **kwargs):
|
def __init__(self, request, *args, **kwargs):
|
||||||
@ -258,8 +253,8 @@ class AttachForm(forms.SelfHandlingForm):
|
|||||||
instances = []
|
instances = []
|
||||||
for instance in instance_list:
|
for instance in instance_list:
|
||||||
if instance.status in tables.ACTIVE_STATES and \
|
if instance.status in tables.ACTIVE_STATES and \
|
||||||
not any(instance.id == att["server_id"]
|
not any(instance.id == att["server_id"]
|
||||||
for att in volume.attachments):
|
for att in volume.attachments):
|
||||||
instances.append((instance.id, '%s (%s)' % (instance.name,
|
instances.append((instance.id, '%s (%s)' % (instance.name,
|
||||||
instance.id)))
|
instance.id)))
|
||||||
if instances:
|
if instances:
|
||||||
|
@ -150,8 +150,8 @@ class IKEPoliciesTable(tables.DataTable):
|
|||||||
auth_algorithm = tables.Column('auth_algorithm',
|
auth_algorithm = tables.Column('auth_algorithm',
|
||||||
verbose_name=_('Authorization algorithm'))
|
verbose_name=_('Authorization algorithm'))
|
||||||
encryption_algorithm = tables.Column(
|
encryption_algorithm = tables.Column(
|
||||||
'encryption_algorithm',
|
'encryption_algorithm',
|
||||||
verbose_name=_('Encryption algorithm'))
|
verbose_name=_('Encryption algorithm'))
|
||||||
pfs = tables.Column("pfs", verbose_name=_('PFS'))
|
pfs = tables.Column("pfs", verbose_name=_('PFS'))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -168,8 +168,8 @@ class IPSecPoliciesTable(tables.DataTable):
|
|||||||
auth_algorithm = tables.Column('auth_algorithm',
|
auth_algorithm = tables.Column('auth_algorithm',
|
||||||
verbose_name=_('Authorization algorithm'))
|
verbose_name=_('Authorization algorithm'))
|
||||||
encryption_algorithm = tables.Column(
|
encryption_algorithm = tables.Column(
|
||||||
'encryption_algorithm',
|
'encryption_algorithm',
|
||||||
verbose_name=_('Encryption algorithm'))
|
verbose_name=_('Encryption algorithm'))
|
||||||
pfs = tables.Column("pfs", verbose_name=_('PFS'))
|
pfs = tables.Column("pfs", verbose_name=_('PFS'))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -293,12 +293,11 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': vpnservice['name'],
|
||||||
'name': vpnservice['name'],
|
'description': vpnservice['description'],
|
||||||
'description': vpnservice['description'],
|
'subnet_id': vpnservice['subnet_id'],
|
||||||
'subnet_id': vpnservice['subnet_id'],
|
'router_id': vpnservice['router_id'],
|
||||||
'router_id': vpnservice['router_id'],
|
'admin_state_up': vpnservice['admin_state_up']}
|
||||||
'admin_state_up': vpnservice['admin_state_up']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDVPNSERVICE_PATH), form_data)
|
res = self.client.post(reverse(self.ADDVPNSERVICE_PATH), form_data)
|
||||||
|
|
||||||
@ -323,12 +322,11 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': vpnservice['name'],
|
||||||
'name': vpnservice['name'],
|
'description': vpnservice['description'],
|
||||||
'description': vpnservice['description'],
|
'subnet_id': '',
|
||||||
'subnet_id': '',
|
'router_id': '',
|
||||||
'router_id': '',
|
'admin_state_up': vpnservice['admin_state_up']}
|
||||||
'admin_state_up': vpnservice['admin_state_up']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDVPNSERVICE_PATH), form_data)
|
res = self.client.post(reverse(self.ADDVPNSERVICE_PATH), form_data)
|
||||||
|
|
||||||
@ -362,18 +360,17 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ikepolicy['name'],
|
||||||
'name': ikepolicy['name'],
|
'description': ikepolicy['description'],
|
||||||
'description': ikepolicy['description'],
|
'auth_algorithm': ikepolicy['auth_algorithm'],
|
||||||
'auth_algorithm': ikepolicy['auth_algorithm'],
|
'encryption_algorithm': ikepolicy[
|
||||||
'encryption_algorithm': ikepolicy[
|
'encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'ike_version': ikepolicy['ike_version'],
|
||||||
'ike_version': ikepolicy['ike_version'],
|
'lifetime_units': ikepolicy['lifetime']['units'],
|
||||||
'lifetime_units': ikepolicy['lifetime']['units'],
|
'lifetime_value': ikepolicy['lifetime']['value'],
|
||||||
'lifetime_value': ikepolicy['lifetime']['value'],
|
'phase1_negotiation_mode': ikepolicy[
|
||||||
'phase1_negotiation_mode': ikepolicy[
|
'phase1_negotiation_mode'],
|
||||||
'phase1_negotiation_mode'],
|
'pfs': ikepolicy['pfs']}
|
||||||
'pfs': ikepolicy['pfs']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDIKEPOLICY_PATH), form_data)
|
res = self.client.post(reverse(self.ADDIKEPOLICY_PATH), form_data)
|
||||||
|
|
||||||
@ -383,18 +380,17 @@ class VPNTests(test.TestCase):
|
|||||||
def test_add_ikepolicy_post_error(self):
|
def test_add_ikepolicy_post_error(self):
|
||||||
ikepolicy = self.ikepolicies.first()
|
ikepolicy = self.ikepolicies.first()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ikepolicy['name'],
|
||||||
'name': ikepolicy['name'],
|
'description': ikepolicy['description'],
|
||||||
'description': ikepolicy['description'],
|
'auth_algorithm': ikepolicy['auth_algorithm'],
|
||||||
'auth_algorithm': ikepolicy['auth_algorithm'],
|
'encryption_algorithm': ikepolicy[
|
||||||
'encryption_algorithm': ikepolicy[
|
'encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'ike_version': ikepolicy['ike_version'],
|
||||||
'ike_version': ikepolicy['ike_version'],
|
'lifetime_units': ikepolicy['lifetime']['units'],
|
||||||
'lifetime_units': ikepolicy['lifetime']['units'],
|
'lifetime_value': 10,
|
||||||
'lifetime_value': 10,
|
'phase1_negotiation_mode': ikepolicy[
|
||||||
'phase1_negotiation_mode': ikepolicy[
|
'phase1_negotiation_mode'],
|
||||||
'phase1_negotiation_mode'],
|
'pfs': ikepolicy['pfs']}
|
||||||
'pfs': ikepolicy['pfs']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDIKEPOLICY_PATH), form_data)
|
res = self.client.post(reverse(self.ADDIKEPOLICY_PATH), form_data)
|
||||||
|
|
||||||
@ -428,19 +424,18 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ipsecpolicy['name'],
|
||||||
'name': ipsecpolicy['name'],
|
'description': ipsecpolicy['description'],
|
||||||
'description': ipsecpolicy['description'],
|
'auth_algorithm': ipsecpolicy['auth_algorithm'],
|
||||||
'auth_algorithm': ipsecpolicy['auth_algorithm'],
|
'encryption_algorithm': ipsecpolicy[
|
||||||
'encryption_algorithm': ipsecpolicy[
|
'encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'encapsulation_mode': ipsecpolicy[
|
||||||
'encapsulation_mode': ipsecpolicy[
|
'encapsulation_mode'],
|
||||||
'encapsulation_mode'],
|
'lifetime_units': ipsecpolicy['lifetime']['units'],
|
||||||
'lifetime_units': ipsecpolicy['lifetime']['units'],
|
'lifetime_value': ipsecpolicy['lifetime']['value'],
|
||||||
'lifetime_value': ipsecpolicy['lifetime']['value'],
|
'pfs': ipsecpolicy['pfs'],
|
||||||
'pfs': ipsecpolicy['pfs'],
|
'transform_protocol': ipsecpolicy[
|
||||||
'transform_protocol': ipsecpolicy[
|
'transform_protocol']}
|
||||||
'transform_protocol']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDIPSECPOLICY_PATH), form_data)
|
res = self.client.post(reverse(self.ADDIPSECPOLICY_PATH), form_data)
|
||||||
|
|
||||||
@ -450,19 +445,18 @@ class VPNTests(test.TestCase):
|
|||||||
def test_add_ipsecpolicy_post_error(self):
|
def test_add_ipsecpolicy_post_error(self):
|
||||||
ipsecpolicy = self.ipsecpolicies.first()
|
ipsecpolicy = self.ipsecpolicies.first()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ipsecpolicy['name'],
|
||||||
'name': ipsecpolicy['name'],
|
'description': ipsecpolicy['description'],
|
||||||
'description': ipsecpolicy['description'],
|
'auth_algorithm': ipsecpolicy['auth_algorithm'],
|
||||||
'auth_algorithm': ipsecpolicy['auth_algorithm'],
|
'encryption_algorithm': ipsecpolicy[
|
||||||
'encryption_algorithm': ipsecpolicy[
|
'encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'encapsulation_mode': ipsecpolicy[
|
||||||
'encapsulation_mode': ipsecpolicy[
|
'encapsulation_mode'],
|
||||||
'encapsulation_mode'],
|
'lifetime_units': ipsecpolicy['lifetime']['units'],
|
||||||
'lifetime_units': ipsecpolicy['lifetime']['units'],
|
'lifetime_value': 10,
|
||||||
'lifetime_value': 10,
|
'pfs': ipsecpolicy['pfs'],
|
||||||
'pfs': ipsecpolicy['pfs'],
|
'transform_protocol': ipsecpolicy[
|
||||||
'transform_protocol': ipsecpolicy[
|
'transform_protocol']}
|
||||||
'transform_protocol']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDIPSECPOLICY_PATH), form_data)
|
res = self.client.post(reverse(self.ADDIPSECPOLICY_PATH), form_data)
|
||||||
|
|
||||||
@ -540,24 +534,23 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ipsecsiteconnection['name'],
|
||||||
'name': ipsecsiteconnection['name'],
|
'description': ipsecsiteconnection['description'],
|
||||||
'description': ipsecsiteconnection['description'],
|
'dpd_action': ipsecsiteconnection['dpd']['action'],
|
||||||
'dpd_action': ipsecsiteconnection['dpd']['action'],
|
'dpd_interval': ipsecsiteconnection['dpd']['interval'],
|
||||||
'dpd_interval': ipsecsiteconnection['dpd']['interval'],
|
'dpd_timeout': ipsecsiteconnection['dpd']['timeout'],
|
||||||
'dpd_timeout': ipsecsiteconnection['dpd']['timeout'],
|
'ikepolicy_id': ipsecsiteconnection['ikepolicy_id'],
|
||||||
'ikepolicy_id': ipsecsiteconnection['ikepolicy_id'],
|
'initiator': ipsecsiteconnection['initiator'],
|
||||||
'initiator': ipsecsiteconnection['initiator'],
|
'ipsecpolicy_id': ipsecsiteconnection[
|
||||||
'ipsecpolicy_id': ipsecsiteconnection[
|
'ipsecpolicy_id'],
|
||||||
'ipsecpolicy_id'],
|
'mtu': ipsecsiteconnection['mtu'],
|
||||||
'mtu': ipsecsiteconnection['mtu'],
|
'peer_address': ipsecsiteconnection['peer_address'],
|
||||||
'peer_address': ipsecsiteconnection['peer_address'],
|
'peer_cidrs': ipsecsiteconnection['peer_cidrs'],
|
||||||
'peer_cidrs': ipsecsiteconnection['peer_cidrs'],
|
'peer_id': ipsecsiteconnection['peer_id'],
|
||||||
'peer_id': ipsecsiteconnection['peer_id'],
|
'psk': ipsecsiteconnection['psk'],
|
||||||
'psk': ipsecsiteconnection['psk'],
|
'vpnservice_id': ipsecsiteconnection['vpnservice_id'],
|
||||||
'vpnservice_id': ipsecsiteconnection['vpnservice_id'],
|
'admin_state_up': ipsecsiteconnection[
|
||||||
'admin_state_up': ipsecsiteconnection[
|
'admin_state_up']}
|
||||||
'admin_state_up']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDVPNCONNECTION_PATH), form_data)
|
res = self.client.post(reverse(self.ADDVPNCONNECTION_PATH), form_data)
|
||||||
|
|
||||||
@ -587,23 +580,22 @@ class VPNTests(test.TestCase):
|
|||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
form_data = {
|
form_data = {'name': ipsecsiteconnection['name'],
|
||||||
'name': ipsecsiteconnection['name'],
|
'description': ipsecsiteconnection['description'],
|
||||||
'description': ipsecsiteconnection['description'],
|
'dpd_action': ipsecsiteconnection['dpd']['action'],
|
||||||
'dpd_action': ipsecsiteconnection['dpd']['action'],
|
'dpd_interval': ipsecsiteconnection['dpd']['interval'],
|
||||||
'dpd_interval': ipsecsiteconnection['dpd']['interval'],
|
'dpd_timeout': ipsecsiteconnection['dpd']['timeout'],
|
||||||
'dpd_timeout': ipsecsiteconnection['dpd']['timeout'],
|
'ikepolicy_id': '',
|
||||||
'ikepolicy_id': '',
|
'initiator': ipsecsiteconnection['initiator'],
|
||||||
'initiator': ipsecsiteconnection['initiator'],
|
'ipsecpolicy_id': '',
|
||||||
'ipsecpolicy_id': '',
|
'mtu': ipsecsiteconnection['mtu'],
|
||||||
'mtu': ipsecsiteconnection['mtu'],
|
'peer_address': ipsecsiteconnection['peer_address'],
|
||||||
'peer_address': ipsecsiteconnection['peer_address'],
|
'peer_cidrs': ipsecsiteconnection['peer_cidrs'],
|
||||||
'peer_cidrs': ipsecsiteconnection['peer_cidrs'],
|
'peer_id': ipsecsiteconnection['peer_id'],
|
||||||
'peer_id': ipsecsiteconnection['peer_id'],
|
'psk': ipsecsiteconnection['psk'],
|
||||||
'psk': ipsecsiteconnection['psk'],
|
'vpnservice_id': '',
|
||||||
'vpnservice_id': '',
|
'admin_state_up': ipsecsiteconnection[
|
||||||
'admin_state_up': ipsecsiteconnection[
|
'admin_state_up']}
|
||||||
'admin_state_up']}
|
|
||||||
|
|
||||||
res = self.client.post(reverse(self.ADDVPNCONNECTION_PATH), form_data)
|
res = self.client.post(reverse(self.ADDVPNCONNECTION_PATH), form_data)
|
||||||
|
|
||||||
|
@ -25,19 +25,20 @@ class UserSettingsView(forms.ModalFormView):
|
|||||||
template_name = 'settings/user/settings.html'
|
template_name = 'settings/user/settings.html'
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
return {'language': self.request.session.get(
|
return {
|
||||||
settings.LANGUAGE_COOKIE_NAME,
|
'language': self.request.session.get(
|
||||||
self.request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME,
|
settings.LANGUAGE_COOKIE_NAME,
|
||||||
self.request.LANGUAGE_CODE)),
|
self.request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME,
|
||||||
'timezone': self.request.session.get(
|
self.request.LANGUAGE_CODE)),
|
||||||
'django_timezone',
|
'timezone': self.request.session.get(
|
||||||
self.request.COOKIES.get('django_timezone', 'UTC')),
|
'django_timezone',
|
||||||
'pagesize': self.request.session.get(
|
self.request.COOKIES.get('django_timezone', 'UTC')),
|
||||||
'horizon_pagesize',
|
'pagesize': self.request.session.get(
|
||||||
self.request.COOKIES.get(
|
'horizon_pagesize',
|
||||||
'horizon_pagesize',
|
self.request.COOKIES.get(
|
||||||
getattr(settings,
|
'horizon_pagesize',
|
||||||
'API_RESULT_PAGE_SIZE', 20)))}
|
getattr(settings,
|
||||||
|
'API_RESULT_PAGE_SIZE', 20)))}
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
return form.handle(self.request, form.cleaned_data)
|
return form.handle(self.request, form.cleaned_data)
|
||||||
|
@ -28,7 +28,7 @@ from django.utils.translation import ugettext_lazy as _ # noqa
|
|||||||
from openstack_dashboard import exceptions
|
from openstack_dashboard import exceptions
|
||||||
|
|
||||||
warnings.formatwarning = lambda message, category, *args, **kwargs: \
|
warnings.formatwarning = lambda message, category, *args, **kwargs: \
|
||||||
'%s: %s' % (category.__name__, message)
|
'%s: %s' % (category.__name__, message)
|
||||||
|
|
||||||
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
|
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin'))
|
BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin'))
|
||||||
|
@ -142,13 +142,13 @@ class LbaasApiTests(test.APITestCase):
|
|||||||
@test.create_stubs({neutronclient: ('list_pools',)})
|
@test.create_stubs({neutronclient: ('list_pools',)})
|
||||||
def test_pools_get(self):
|
def test_pools_get(self):
|
||||||
pools = {'pools': [{
|
pools = {'pools': [{
|
||||||
'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||||
'name': 'pool1name',
|
'name': 'pool1name',
|
||||||
'description': 'pool1description',
|
'description': 'pool1description',
|
||||||
'subnet_id': '12381d38-c3eb-4fee-9763-12de3338041e',
|
'subnet_id': '12381d38-c3eb-4fee-9763-12de3338041e',
|
||||||
'protocol': 'HTTP',
|
'protocol': 'HTTP',
|
||||||
'lb_method': 'ROUND_ROBIN',
|
'lb_method': 'ROUND_ROBIN',
|
||||||
'admin_state_up': True}, ]}
|
'admin_state_up': True}, ]}
|
||||||
neutronclient.list_pools().AndReturn(pools)
|
neutronclient.list_pools().AndReturn(pools)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
@ -207,14 +207,14 @@ class LbaasApiTests(test.APITestCase):
|
|||||||
'admin_state_up': True
|
'admin_state_up': True
|
||||||
}
|
}
|
||||||
monitor = {'health_monitor': {
|
monitor = {'health_monitor': {
|
||||||
'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||||
'type': 'PING',
|
'type': 'PING',
|
||||||
'delay': '10',
|
'delay': '10',
|
||||||
'timeout': '10',
|
'timeout': '10',
|
||||||
'max_retries': '10',
|
'max_retries': '10',
|
||||||
'admin_state_up': True}}
|
'admin_state_up': True}}
|
||||||
neutronclient.create_health_monitor({
|
neutronclient.create_health_monitor({
|
||||||
'health_monitor': form_data}).AndReturn(monitor)
|
'health_monitor': form_data}).AndReturn(monitor)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
ret_val = api.lbaas.pool_health_monitor_create(
|
ret_val = api.lbaas.pool_health_monitor_create(
|
||||||
@ -224,15 +224,15 @@ class LbaasApiTests(test.APITestCase):
|
|||||||
@test.create_stubs({neutronclient: ('list_health_monitors',)})
|
@test.create_stubs({neutronclient: ('list_health_monitors',)})
|
||||||
def test_pool_health_monitors_get(self):
|
def test_pool_health_monitors_get(self):
|
||||||
monitors = {'health_monitors': [
|
monitors = {'health_monitors': [
|
||||||
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||||
'type': 'PING',
|
'type': 'PING',
|
||||||
'delay': '10',
|
'delay': '10',
|
||||||
'timeout': '10',
|
'timeout': '10',
|
||||||
'max_retries': '10',
|
'max_retries': '10',
|
||||||
'http_method': 'GET',
|
'http_method': 'GET',
|
||||||
'url_path': '/monitor',
|
'url_path': '/monitor',
|
||||||
'expected_codes': '200',
|
'expected_codes': '200',
|
||||||
'admin_state_up': True}, ]}
|
'admin_state_up': True}, ]}
|
||||||
|
|
||||||
neutronclient.list_health_monitors().AndReturn(monitors)
|
neutronclient.list_health_monitors().AndReturn(monitors)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@ -287,13 +287,13 @@ class LbaasApiTests(test.APITestCase):
|
|||||||
@test.create_stubs({neutronclient: ('list_members',)})
|
@test.create_stubs({neutronclient: ('list_members',)})
|
||||||
def test_members_get(self):
|
def test_members_get(self):
|
||||||
members = {'members': [
|
members = {'members': [
|
||||||
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||||
'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||||
'address': '10.0.1.2',
|
'address': '10.0.1.2',
|
||||||
'protocol_port': '80',
|
'protocol_port': '80',
|
||||||
'weight': '10',
|
'weight': '10',
|
||||||
'admin_state_up': True
|
'admin_state_up': True
|
||||||
}, ]}
|
}, ]}
|
||||||
neutronclient.list_members().AndReturn(members)
|
neutronclient.list_members().AndReturn(members)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
|
@ -29,11 +29,12 @@ class VPNaasApiTests(test.APITestCase):
|
|||||||
def test_vpnservice_create(self):
|
def test_vpnservice_create(self):
|
||||||
vpnservice1 = self.api_vpnservices.first()
|
vpnservice1 = self.api_vpnservices.first()
|
||||||
form_data = {
|
form_data = {
|
||||||
'name': vpnservice1['name'],
|
'name': vpnservice1['name'],
|
||||||
'description': vpnservice1['description'],
|
'description': vpnservice1['description'],
|
||||||
'subnet_id': vpnservice1['subnet_id'],
|
'subnet_id': vpnservice1['subnet_id'],
|
||||||
'router_id': vpnservice1['router_id'],
|
'router_id': vpnservice1['router_id'],
|
||||||
'admin_state_up': vpnservice1['admin_state_up']}
|
'admin_state_up': vpnservice1['admin_state_up']
|
||||||
|
}
|
||||||
|
|
||||||
vpnservice = {'vpnservice': self.api_vpnservices.first()}
|
vpnservice = {'vpnservice': self.api_vpnservices.first()}
|
||||||
neutronclient.create_vpnservice(
|
neutronclient.create_vpnservice(
|
||||||
@ -76,16 +77,15 @@ class VPNaasApiTests(test.APITestCase):
|
|||||||
def test_ikepolicy_create(self):
|
def test_ikepolicy_create(self):
|
||||||
ikepolicy1 = self.api_ikepolicies.first()
|
ikepolicy1 = self.api_ikepolicies.first()
|
||||||
form_data = {
|
form_data = {
|
||||||
'name': ikepolicy1['name'],
|
'name': ikepolicy1['name'],
|
||||||
'description': ikepolicy1['description'],
|
'description': ikepolicy1['description'],
|
||||||
'auth_algorithm': ikepolicy1['auth_algorithm'],
|
'auth_algorithm': ikepolicy1['auth_algorithm'],
|
||||||
'encryption_algorithm': ikepolicy1[
|
'encryption_algorithm': ikepolicy1['encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'ike_version': ikepolicy1['ike_version'],
|
||||||
'ike_version': ikepolicy1['ike_version'],
|
'lifetime': ikepolicy1['lifetime'],
|
||||||
'lifetime': ikepolicy1['lifetime'],
|
'phase1_negotiation_mode': ikepolicy1['phase1_negotiation_mode'],
|
||||||
'phase1_negotiation_mode': ikepolicy1[
|
'pfs': ikepolicy1['pfs']
|
||||||
'phase1_negotiation_mode'],
|
}
|
||||||
'pfs': ikepolicy1['pfs']}
|
|
||||||
|
|
||||||
ikepolicy = {'ikepolicy': self.api_ikepolicies.first()}
|
ikepolicy = {'ikepolicy': self.api_ikepolicies.first()}
|
||||||
neutronclient.create_ikepolicy(
|
neutronclient.create_ikepolicy(
|
||||||
@ -128,17 +128,15 @@ class VPNaasApiTests(test.APITestCase):
|
|||||||
def test_ipsecpolicy_create(self):
|
def test_ipsecpolicy_create(self):
|
||||||
ipsecpolicy1 = self.api_ipsecpolicies.first()
|
ipsecpolicy1 = self.api_ipsecpolicies.first()
|
||||||
form_data = {
|
form_data = {
|
||||||
'name': ipsecpolicy1['name'],
|
'name': ipsecpolicy1['name'],
|
||||||
'description': ipsecpolicy1['description'],
|
'description': ipsecpolicy1['description'],
|
||||||
'auth_algorithm': ipsecpolicy1['auth_algorithm'],
|
'auth_algorithm': ipsecpolicy1['auth_algorithm'],
|
||||||
'encryption_algorithm': ipsecpolicy1[
|
'encryption_algorithm': ipsecpolicy1['encryption_algorithm'],
|
||||||
'encryption_algorithm'],
|
'encapsulation_mode': ipsecpolicy1['encapsulation_mode'],
|
||||||
'encapsulation_mode': ipsecpolicy1[
|
'lifetime': ipsecpolicy1['lifetime'],
|
||||||
'encapsulation_mode'],
|
'pfs': ipsecpolicy1['pfs'],
|
||||||
'lifetime': ipsecpolicy1['lifetime'],
|
'transform_protocol': ipsecpolicy1['transform_protocol']
|
||||||
'pfs': ipsecpolicy1['pfs'],
|
}
|
||||||
'transform_protocol': ipsecpolicy1[
|
|
||||||
'transform_protocol']}
|
|
||||||
|
|
||||||
ipsecpolicy = {'ipsecpolicy': self.api_ipsecpolicies.first()}
|
ipsecpolicy = {'ipsecpolicy': self.api_ipsecpolicies.first()}
|
||||||
neutronclient.create_ipsecpolicy(
|
neutronclient.create_ipsecpolicy(
|
||||||
@ -181,21 +179,20 @@ class VPNaasApiTests(test.APITestCase):
|
|||||||
def test_ipsecsiteconnection_create(self):
|
def test_ipsecsiteconnection_create(self):
|
||||||
ipsecsiteconnection1 = self.api_ipsecsiteconnections.first()
|
ipsecsiteconnection1 = self.api_ipsecsiteconnections.first()
|
||||||
form_data = {
|
form_data = {
|
||||||
'name': ipsecsiteconnection1['name'],
|
'name': ipsecsiteconnection1['name'],
|
||||||
'description': ipsecsiteconnection1['description'],
|
'description': ipsecsiteconnection1['description'],
|
||||||
'dpd': ipsecsiteconnection1['dpd'],
|
'dpd': ipsecsiteconnection1['dpd'],
|
||||||
'ikepolicy_id': ipsecsiteconnection1['ikepolicy_id'],
|
'ikepolicy_id': ipsecsiteconnection1['ikepolicy_id'],
|
||||||
'initiator': ipsecsiteconnection1['initiator'],
|
'initiator': ipsecsiteconnection1['initiator'],
|
||||||
'ipsecpolicy_id': ipsecsiteconnection1[
|
'ipsecpolicy_id': ipsecsiteconnection1['ipsecpolicy_id'],
|
||||||
'ipsecpolicy_id'],
|
'mtu': ipsecsiteconnection1['mtu'],
|
||||||
'mtu': ipsecsiteconnection1['mtu'],
|
'peer_address': ipsecsiteconnection1['peer_address'],
|
||||||
'peer_address': ipsecsiteconnection1['peer_address'],
|
'peer_cidrs': ipsecsiteconnection1['peer_cidrs'],
|
||||||
'peer_cidrs': ipsecsiteconnection1['peer_cidrs'],
|
'peer_id': ipsecsiteconnection1['peer_id'],
|
||||||
'peer_id': ipsecsiteconnection1['peer_id'],
|
'psk': ipsecsiteconnection1['psk'],
|
||||||
'psk': ipsecsiteconnection1['psk'],
|
'vpnservice_id': ipsecsiteconnection1['vpnservice_id'],
|
||||||
'vpnservice_id': ipsecsiteconnection1['vpnservice_id'],
|
'admin_state_up': ipsecsiteconnection1['admin_state_up']
|
||||||
'admin_state_up': ipsecsiteconnection1[
|
}
|
||||||
'admin_state_up']}
|
|
||||||
|
|
||||||
ipsecsiteconnection = {'ipsec_site_connection':
|
ipsecsiteconnection = {'ipsec_site_connection':
|
||||||
self.api_ipsecsiteconnections.first()}
|
self.api_ipsecsiteconnections.first()}
|
||||||
|
@ -136,7 +136,7 @@ def data(TEST):
|
|||||||
|
|
||||||
TEST.api_network_profile_binding.add(network_profile_binding_dict)
|
TEST.api_network_profile_binding.add(network_profile_binding_dict)
|
||||||
TEST.network_profile_binding.add(neutron.Profile(
|
TEST.network_profile_binding.add(neutron.Profile(
|
||||||
network_profile_binding_dict))
|
network_profile_binding_dict))
|
||||||
|
|
||||||
# policy profile binding
|
# policy profile binding
|
||||||
policy_profile_binding_dict = {'profile_id':
|
policy_profile_binding_dict = {'profile_id':
|
||||||
@ -145,7 +145,7 @@ def data(TEST):
|
|||||||
|
|
||||||
TEST.api_policy_profile_binding.add(policy_profile_binding_dict)
|
TEST.api_policy_profile_binding.add(policy_profile_binding_dict)
|
||||||
TEST.policy_profile_binding.add(neutron.Profile(
|
TEST.policy_profile_binding.add(neutron.Profile(
|
||||||
policy_profile_binding_dict))
|
policy_profile_binding_dict))
|
||||||
|
|
||||||
# ports on 1st network
|
# ports on 1st network
|
||||||
port_dict = {'admin_state_up': True,
|
port_dict = {'admin_state_up': True,
|
||||||
|
@ -143,10 +143,10 @@ class QuotaTests(test.APITestCase):
|
|||||||
expected_output = self.get_usages(with_volume=False)
|
expected_output = self.get_usages(with_volume=False)
|
||||||
|
|
||||||
expected_output.update({
|
expected_output.update({
|
||||||
'ram': {'available': 10000, 'used': 0, 'quota': 10000},
|
'ram': {'available': 10000, 'used': 0, 'quota': 10000},
|
||||||
'floating_ips': {'available': 1, 'used': 0, 'quota': 1},
|
'floating_ips': {'available': 1, 'used': 0, 'quota': 1},
|
||||||
'instances': {'available': 10, 'used': 0, 'quota': 10},
|
'instances': {'available': 10, 'used': 0, 'quota': 10},
|
||||||
'cores': {'available': 10, 'used': 0, 'quota': 10}})
|
'cores': {'available': 10, 'used': 0, 'quota': 10}})
|
||||||
|
|
||||||
# Compare internal structure of usages to expected.
|
# Compare internal structure of usages to expected.
|
||||||
self.assertEqual(quota_usages.usages, expected_output)
|
self.assertEqual(quota_usages.usages, expected_output)
|
||||||
|
@ -34,9 +34,9 @@ class TemplateRenderTest(test.TestCase):
|
|||||||
"auth_url": "http://tests.com",
|
"auth_url": "http://tests.com",
|
||||||
"tenant_name": "ENG Perf R&D"}
|
"tenant_name": "ENG Perf R&D"}
|
||||||
out = loader.render_to_string(
|
out = loader.render_to_string(
|
||||||
'project/access_and_security/api_access/openrc.sh.template',
|
'project/access_and_security/api_access/openrc.sh.template',
|
||||||
context,
|
context,
|
||||||
template.Context(context))
|
template.Context(context))
|
||||||
|
|
||||||
self.assertFalse("&" in out)
|
self.assertFalse("&" in out)
|
||||||
self.assertTrue("ENG Perf R&D" in out)
|
self.assertTrue("ENG Perf R&D" in out)
|
||||||
@ -48,9 +48,9 @@ class TemplateRenderTest(test.TestCase):
|
|||||||
"auth_url": "http://tests.com",
|
"auth_url": "http://tests.com",
|
||||||
"tenant_name": 'o"; sudo rm -rf /'}
|
"tenant_name": 'o"; sudo rm -rf /'}
|
||||||
out = loader.render_to_string(
|
out = loader.render_to_string(
|
||||||
'project/access_and_security/api_access/openrc.sh.template',
|
'project/access_and_security/api_access/openrc.sh.template',
|
||||||
context,
|
context,
|
||||||
template.Context(context))
|
template.Context(context))
|
||||||
|
|
||||||
self.assertFalse('o"' in out)
|
self.assertFalse('o"' in out)
|
||||||
self.assertTrue('\"' in out)
|
self.assertTrue('\"' in out)
|
||||||
@ -62,9 +62,9 @@ class TemplateRenderTest(test.TestCase):
|
|||||||
"auth_url": "http://tests.com",
|
"auth_url": "http://tests.com",
|
||||||
"tenant_name": 'o\"; sudo rm -rf /'}
|
"tenant_name": 'o\"; sudo rm -rf /'}
|
||||||
out = loader.render_to_string(
|
out = loader.render_to_string(
|
||||||
'project/access_and_security/api_access/openrc.sh.template',
|
'project/access_and_security/api_access/openrc.sh.template',
|
||||||
context,
|
context,
|
||||||
template.Context(context))
|
template.Context(context))
|
||||||
|
|
||||||
self.assertFalse('o\"' in out)
|
self.assertFalse('o\"' in out)
|
||||||
self.assertFalse('o"' in out)
|
self.assertFalse('o"' in out)
|
||||||
|
3
tox.ini
3
tox.ini
@ -32,11 +32,10 @@ downloadcache = ~/cache/pip
|
|||||||
[flake8]
|
[flake8]
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py
|
||||||
# E126 continuation line over-indented for hanging indent
|
|
||||||
# E127 continuation line over-indented for visual indent
|
# E127 continuation line over-indented for visual indent
|
||||||
# E128 continuation line under-indented for visual indent
|
# E128 continuation line under-indented for visual indent
|
||||||
# H102 Apache 2.0 license header not found
|
# H102 Apache 2.0 license header not found
|
||||||
# H4xx docstrings
|
# H4xx docstrings
|
||||||
# H701 empty localization string
|
# H701 empty localization string
|
||||||
# H702 Formatting operation should be outside of localization method call
|
# H702 Formatting operation should be outside of localization method call
|
||||||
ignore = E126,E127,E128,H102,H4,H701,H702
|
ignore = E127,E128,H102,H4,H701,H702
|
||||||
|
Loading…
x
Reference in New Issue
Block a user