Skip to content

Commit

Permalink
Bug #1013967 - Quantum is breaking on tests with pep 1.3
Browse files Browse the repository at this point in the history
Fixing files

93/93 files fixed

Change-Id: Ia30f2e2253806fa5f447d44208d13d2c0beba9cd
  • Loading branch information
ncode committed Jun 16, 2012
1 parent 7b9a0b7 commit 2fcb3ec
Show file tree
Hide file tree
Showing 93 changed files with 909 additions and 936 deletions.
12 changes: 6 additions & 6 deletions quantum/agent/linux/ovs_lib.py
Expand Up @@ -58,7 +58,7 @@ def reset_bridge(self):

def delete_port(self, port_name):
self.run_vsctl(["--", "--if-exists", "del-port", self.br_name,
port_name])
port_name])

def set_db_attribute(self, table_name, record, column, value):
args = ["set", table_name, record, "%s=%s" % (column, value)]
Expand Down Expand Up @@ -87,10 +87,10 @@ def _build_flow_expr_arr(self, **kwargs):
is_delete_expr = kwargs.get('delete', False)
print "kwargs = %s" % kwargs
if not is_delete_expr:
prefix = ("hard_timeout=%s,idle_timeout=%s,priority=%s"
% (kwargs.get('hard_timeout', '0'),
kwargs.get('idle_timeout', '0'),
kwargs.get('priority', '1')))
prefix = ("hard_timeout=%s,idle_timeout=%s,priority=%s" %
(kwargs.get('hard_timeout', '0'),
kwargs.get('idle_timeout', '0'),
kwargs.get('priority', '1')))
flow_expr_arr.append(prefix)
elif 'priority' in kwargs:
raise Exception("Cannot match priority on flow deletion")
Expand Down Expand Up @@ -179,7 +179,7 @@ def get_xapi_iface_id(self, xs_vif_uuid):
return utils.execute(["xe", "vif-param-get", "param-name=other-config",
"param-key=nicira-iface-id",
"uuid=%s" % xs_vif_uuid],
root_helper=self.root_helper).strip()
root_helper=self.root_helper).strip()

# returns a VIF object for each VIF port
def get_vif_ports(self):
Expand Down
10 changes: 5 additions & 5 deletions quantum/api/attachments.py
Expand Up @@ -31,7 +31,7 @@ def create_resource(plugin, version):
'1.1': [ControllerV11(plugin),
ControllerV11._serialization_metadata,
common.XML_NS_V11],
}
}
return common.create_resource(version, controller_dict)


Expand All @@ -44,16 +44,16 @@ class Controller(common.QuantumController):
{
'param-name': 'id',
'required': True,
},
]
},
]

_serialization_metadata = {
"application/xml": {
"attributes": {
"attachment": ["id"],
},
},
}
},
}

@common.APIFaultWrapper([exception.NetworkNotFound,
exception.PortNotFound])
Expand Down
150 changes: 75 additions & 75 deletions quantum/api/faults.py
Expand Up @@ -47,8 +47,8 @@ def fault_body_function_v10(wrapped_exc):
'code': code,
'message': wrapped_exc.explanation,
'detail': str(wrapped_exc.detail),
},
}
},
}
metadata = {'attributes': {fault_name: ['code']}}
return fault_data, metadata

Expand All @@ -71,8 +71,8 @@ def fault_body_function_v11(wrapped_exc):
'type': fault_name,
'message': wrapped_exc.explanation,
'detail': str(wrapped_exc.detail),
},
}
},
}
# Metadata not required for v11
return fault_data, None

Expand All @@ -90,41 +90,41 @@ def fault_body_function(version):
class Quantum10HTTPError(webob.exc.HTTPClientError):

_fault_dict = {
exceptions.NetworkNotFound: {
'code': 420,
'title': 'networkNotFound',
'explanation': _NETNOTFOUND_EXPL
},
exceptions.NetworkInUse: {
'code': 421,
'title': 'networkInUse',
'explanation': _NETINUSE_EXPL
},
exceptions.PortNotFound: {
'code': 430,
'title': 'portNotFound',
'explanation': _PORTNOTFOUND_EXPL
},
exceptions.StateInvalid: {
'code': 431,
'title': 'requestedStateInvalid',
'explanation': _STATEINVALID_EXPL
},
exceptions.PortInUse: {
'code': 432,
'title': 'portInUse',
'explanation': _PORTINUSE_EXPL
},
exceptions.AlreadyAttached: {
'code': 440,
'title': 'alreadyAttached',
'explanation': _ALREADYATTACHED_EXPL
},
exceptions.NotImplementedError: {
'code': 501,
'title': 'notImplemented',
'explanation': _NOTIMPLEMENTED_EXPL
}
exceptions.NetworkNotFound: {
'code': 420,
'title': 'networkNotFound',
'explanation': _NETNOTFOUND_EXPL
},
exceptions.NetworkInUse: {
'code': 421,
'title': 'networkInUse',
'explanation': _NETINUSE_EXPL
},
exceptions.PortNotFound: {
'code': 430,
'title': 'portNotFound',
'explanation': _PORTNOTFOUND_EXPL
},
exceptions.StateInvalid: {
'code': 431,
'title': 'requestedStateInvalid',
'explanation': _STATEINVALID_EXPL
},
exceptions.PortInUse: {
'code': 432,
'title': 'portInUse',
'explanation': _PORTINUSE_EXPL
},
exceptions.AlreadyAttached: {
'code': 440,
'title': 'alreadyAttached',
'explanation': _ALREADYATTACHED_EXPL
},
exceptions.NotImplementedError: {
'code': 501,
'title': 'notImplemented',
'explanation': _NOTIMPLEMENTED_EXPL
}
}

def __init__(self, inner_exc):
Expand All @@ -139,42 +139,42 @@ def __init__(self, inner_exc):
class Quantum11HTTPError(webob.exc.HTTPClientError):

_fault_dict = {
exceptions.NetworkNotFound: {
'code': webob.exc.HTTPNotFound.code,
'title': webob.exc.HTTPNotFound.title,
'type': 'NetworkNotFound',
'explanation': _NETNOTFOUND_EXPL
},
exceptions.NetworkInUse: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'NetworkInUse',
'explanation': _NETINUSE_EXPL
},
exceptions.PortNotFound: {
'code': webob.exc.HTTPNotFound.code,
'title': webob.exc.HTTPNotFound.title,
'type': 'PortNotFound',
'explanation': _PORTNOTFOUND_EXPL
},
exceptions.StateInvalid: {
'code': webob.exc.HTTPBadRequest.code,
'title': webob.exc.HTTPBadRequest.title,
'type': 'RequestedStateInvalid',
'explanation': _STATEINVALID_EXPL
},
exceptions.PortInUse: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'PortInUse',
'explanation': _PORTINUSE_EXPL
},
exceptions.AlreadyAttached: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'AlreadyAttached',
'explanation': _ALREADYATTACHED_EXPL
}
exceptions.NetworkNotFound: {
'code': webob.exc.HTTPNotFound.code,
'title': webob.exc.HTTPNotFound.title,
'type': 'NetworkNotFound',
'explanation': _NETNOTFOUND_EXPL
},
exceptions.NetworkInUse: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'NetworkInUse',
'explanation': _NETINUSE_EXPL
},
exceptions.PortNotFound: {
'code': webob.exc.HTTPNotFound.code,
'title': webob.exc.HTTPNotFound.title,
'type': 'PortNotFound',
'explanation': _PORTNOTFOUND_EXPL
},
exceptions.StateInvalid: {
'code': webob.exc.HTTPBadRequest.code,
'title': webob.exc.HTTPBadRequest.title,
'type': 'RequestedStateInvalid',
'explanation': _STATEINVALID_EXPL
},
exceptions.PortInUse: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'PortInUse',
'explanation': _PORTINUSE_EXPL
},
exceptions.AlreadyAttached: {
'code': webob.exc.HTTPConflict.code,
'title': webob.exc.HTTPConflict.title,
'type': 'AlreadyAttached',
'explanation': _ALREADYATTACHED_EXPL
}
}

def __init__(self, inner_exc):
Expand Down
16 changes: 8 additions & 8 deletions quantum/api/networks.py
Expand Up @@ -33,7 +33,7 @@ def create_resource(plugin, version):
'1.1': [ControllerV11(plugin),
ControllerV11._serialization_metadata,
common.XML_NS_V11],
}
}
return common.create_resource(version, controller_dict)


Expand All @@ -44,7 +44,7 @@ class Controller(common.QuantumController):
version = None
_network_ops_param_list = [
{'param-name': 'name', 'required': True},
]
]

def _item(self, request, tenant_id, network_id,
net_details=True, port_details=False):
Expand Down Expand Up @@ -154,12 +154,12 @@ class ControllerV10(Controller):
"network": ["id", "name"],
"port": ["id", "state"],
"attachment": ["id"],
},
},
"plurals": {
"networks": "network",
"ports": "port",
},
}
},
}

version = "1.0"

Expand All @@ -178,11 +178,11 @@ class ControllerV11(Controller):
"network": ["id", "name", "op-status"],
"port": ["id", "state", "op-status"],
"attachment": ["id"],
},
},
"plurals": {
"networks": "network",
"ports": "port",
},
}
},
}

version = "1.1"
16 changes: 8 additions & 8 deletions quantum/api/ports.py
Expand Up @@ -32,7 +32,7 @@ def create_resource(plugin, version):
'1.1': [ControllerV11(plugin),
ControllerV11._serialization_metadata,
common.XML_NS_V11],
}
}
return common.create_resource(version, controller_dict)


Expand All @@ -43,7 +43,7 @@ class Controller(common.QuantumController):
version = None
_port_ops_param_list = [
{'param-name': 'state', 'default-value': 'DOWN', 'required': False},
]
]

def _items(self, request, tenant_id, network_id,
port_details=False):
Expand Down Expand Up @@ -160,11 +160,11 @@ class ControllerV10(Controller):
"attributes": {
"port": ["id", "state"],
"attachment": ["id"],
},
},
"plurals": {
"ports": "port",
},
}
},
}

version = "1.0"

Expand All @@ -176,10 +176,10 @@ class ControllerV11(Controller):
"attributes": {
"port": ["id", "state", "op-status"],
"attachment": ["id"],
},
},
"plurals": {
"ports": "port",
},
}
},
}

version = "1.1"
14 changes: 6 additions & 8 deletions quantum/api/v2/base.py
Expand Up @@ -158,9 +158,9 @@ def _populate_tenant_id(self, context, res_dict, is_create):
if self._resource not in ['network', 'port']:
return

if ('tenant_id' in res_dict and
res_dict['tenant_id'] != context.tenant_id and
not context.is_admin):
if (('tenant_id' in res_dict and
res_dict['tenant_id'] != context.tenant_id and
not context.is_admin)):
msg = _("Specifying 'tenant_id' other than authenticated"
"tenant in request requires admin privileges")
raise webob.exc.HTTPBadRequest(msg)
Expand All @@ -170,7 +170,7 @@ def _populate_tenant_id(self, context, res_dict, is_create):
res_dict['tenant_id'] = context.tenant_id
else:
msg = _("Running without keystyone AuthN requires "
" that tenant_id is specified")
" that tenant_id is specified")
raise webob.exc.HTTPBadRequest(msg)

def _prepare_request_body(self, context, body, is_create,
Expand Down Expand Up @@ -242,13 +242,11 @@ def create_resource(collection, resource, plugin, conf, params):

# NOTE(jkoelker) To anyone wishing to add "proper" xml support
# this is where you do it
serializers = {
serializers = {}
# 'application/xml': wsgi.XMLDictSerializer(metadata, XML_NS_V20),
}

deserializers = {
deserializers = {}
# 'application/xml': wsgi.XMLDeserializer(metadata),
}

return wsgi_resource.Resource(controller, FAULT_MAP, deserializers,
serializers)
12 changes: 4 additions & 8 deletions quantum/api/v2/router.py
Expand Up @@ -95,13 +95,9 @@ def __init__(self, resources):

@webob.dec.wsgify(RequestClass=wsgi.Request)
def __call__(self, req):
metadata = {'application/xml': {
'attributes': {
'resource': ['name', 'collection'],
'link': ['href', 'rel'],
}
}
}
metadata = {'application/xml': {'attributes': {
'resource': ['name', 'collection'],
'link': ['href', 'rel']}}}

layout = []
for name, collection in self.resources.iteritems():
Expand Down Expand Up @@ -153,6 +149,6 @@ def _map_resource(collection, resource, params):
for resource in resources:
_map_resource(resources[resource], resource,
RESOURCE_ATTRIBUTE_MAP.get(resources[resource],
dict()))
dict()))

super(APIRouter, self).__init__(mapper)

0 comments on commit 2fcb3ec

Please sign in to comment.