launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #13556
[Merge] lp:~rvb/maas/doris-number-1234 into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/doris-number-1234 into lp:maas.
Commit message:
More lint…
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rvb/maas/doris-number-1234/+merge/130541
More lint…
--
https://code.launchpad.net/~rvb/maas/doris-number-1234/+merge/130541
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/doris-number-1234 into lp:maas.
=== modified file 'src/apiclient/maas_client.py'
--- src/apiclient/maas_client.py 2012-10-18 12:53:11 +0000
+++ src/apiclient/maas_client.py 2012-10-19 13:00:28 +0000
@@ -98,8 +98,11 @@
req = urllib2.Request(request_url, data, headers)
res = urllib2.urlopen(req)
# If we set the Accept-encoding header, then we decode the header for
- # the caller
- if set_accept_encoding and res.info().get('Content-Encoding') == 'gzip':
+ # the caller.
+ is_gzip = (
+ set_accept_encoding
+ and res.info().get('Content-Encoding') == 'gzip')
+ if is_gzip:
# Workaround python's gzip failure, gzip.GzipFile wants to be able
# to seek the file object.
res_content_io = BytesIO(res.read())
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-10-18 16:50:50 +0000
+++ src/maasserver/api.py 2012-10-19 13:00:28 +0000
@@ -87,7 +87,6 @@
from functools import partial
import httplib
from inspect import getdoc
-import simplejson as json
import sys
from textwrap import dedent
@@ -175,6 +174,7 @@
from piston.utils import rc
from provisioningserver.enum import POWER_TYPE
from provisioningserver.kernel_opts import KernelParameters
+import simplejson as json
class OperationsResource(Resource):
@@ -846,9 +846,8 @@
raise NodeStateViolation(
"Node(s) cannot be released in their current state: %s."
% ', '.join(failed))
-
return released_ids
-
+
@operation(idempotent=True)
def list(self, request):
"""List Nodes visible to the user, optionally filtered by criteria.
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-10-19 07:56:19 +0000
+++ src/maasserver/tests/test_api.py 2012-10-19 13:00:28 +0000
@@ -2153,7 +2153,7 @@
})
# Awkward parsing, but the order may vary and it's not JSON
s = response.content
- returned_ids = s[s.find(':')+2:s.rfind('.')].split(', ')
+ returned_ids = s[s.find(':') + 2:s.rfind('.')].split(', ')
self.assertEqual(httplib.BAD_REQUEST, response.status_code)
self.assertIn("Unknown node(s): ", response.content)
self.assertItemsEqual(node_ids, returned_ids)
@@ -2169,7 +2169,6 @@
# And one with no owner
another_node = factory.make_node(status=NODE_STATUS.RESERVED)
node_ids.add(another_node.system_id)
-
response = self.client.post(
self.get_uri('nodes/'), {
'op': 'release',
@@ -2180,7 +2179,7 @@
"You don't have the required permission to release the "
"following node(s): %s." % another_node.system_id),
(response.status_code, response.content))
-
+
def test_POST_release_rejects_impossible_state_changes(self):
acceptable_states = {
NODE_STATUS.ALLOCATED,
@@ -2204,7 +2203,7 @@
for node in nodes
if node.status not in acceptable_states]
s = response.content
- returned = s[s.rfind(':')+2:s.rfind('.')].split(', ')
+ returned = s[s.rfind(':') + 2:s.rfind('.')].split(', ')
self.assertEqual(httplib.CONFLICT, response.status_code)
self.assertIn(
"Node(s) cannot be released in their current state:",
@@ -2233,7 +2232,7 @@
self.assertItemsEqual(
[nodes[1].system_id, nodes[2].system_id],
parsed_result)
-
+
class MACAddressAPITest(APITestCase):
=== modified file 'src/maastesting/httpd.py'
--- src/maastesting/httpd.py 2012-10-18 12:50:24 +0000
+++ src/maastesting/httpd.py 2012-10-19 13:00:28 +0000
@@ -39,7 +39,7 @@
gz = gzip.GzipFile(mode='wb', fileobj=gz_out)
gz.write(f.read())
gz.flush()
- gz_content = gz_out.getvalue()
+ gz_out.getvalue()
return gz_out
def is_gzip_accepted(self):