Merge lp:~salvatore-orlando/neutron/bug834486_798262 into lp:neutron/diablo

Proposed by Salvatore Orlando
Status: Work in progress
Proposed branch: lp:~salvatore-orlando/neutron/bug834486_798262
Merge into: lp:neutron/diablo
Diff against target: 65 lines (+17/-5)
2 files modified
quantum/cli.py (+2/-2)
quantum/client.py (+15/-3)
To merge this branch: bzr merge lp:~salvatore-orlando/neutron/bug834486_798262
Reviewer Review Type Date Requested Status
Netstack Core Developers Pending
Review via email: mp+73042@code.launchpad.net

Description of the change

Fixes CLI for API v1

Fixes client lib for XML deserialization

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTE: THIS MERGE PROPOSAL IS ON HOLD AND HOPEFULLY WILL BE REJECTED
It will be resumed only if the merge proposal for the CLI enhancement will not be approved by the end of Friday August 26
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To post a comment you must log in.

Unmerged revisions

54. By Salvatore Orlando

Fix broken CLI
Fix XML deserialization in client

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quantum/cli.py'
2--- quantum/cli.py 2011-08-24 11:54:53 +0000
3+++ quantum/cli.py 2011-08-26 13:08:23 +0000
4@@ -64,7 +64,7 @@
5
6 def api_create_net(client, *args):
7 tid, name = args
8- data = {'network': {'net-name': '%s' % name}}
9+ data = {'network': {'name': '%s' % name}}
10 res = client.create_network(data)
11 LOG.debug(res)
12 nid = None
13@@ -221,7 +221,7 @@
14 return
15
16 id = port['id']
17- interface_id = att['id']
18+ interface_id = att['attachment'].get('id', None)
19 LOG.debug(port)
20 print "Virtual Port:%s on Virtual Network:%s " \
21 "contains remote interface:%s" % (pid, nid, interface_id)
22
23=== modified file 'quantum/client.py'
24--- quantum/client.py 2011-08-24 11:54:53 +0000
25+++ quantum/client.py 2011-08-26 13:08:23 +0000
26@@ -60,6 +60,17 @@
27
28 """A base client class - derived from Glance.BaseClient"""
29
30+ #Metadata for deserializing xml
31+ _serialization_metadata = {
32+ "application/xml": {
33+ "attributes": {
34+ "network": ["id", "name"],
35+ "port": ["id", "state"],
36+ "attachment": ["id"]},
37+ "plurals": {"networks": "network",
38+ "ports": "port"}},
39+ }
40+
41 # Action query strings
42 networks_path = "/networks"
43 network_path = "/networks/%s"
44@@ -172,7 +183,7 @@
45 else:
46 if res.status in EXCEPTIONS:
47 raise EXCEPTIONS[res.status]()
48- raise Exception("Server returned error: %s" % res.read())
49+ raise Exception("Server returned error: %s" % res.status)
50
51 except (socket.error, IOError), e:
52 raise Exception("Unable to connect to "
53@@ -205,9 +216,10 @@
54 """
55 Deserializes a an xml or json string into a dictionary
56 """
57- if status_code == 202:
58+ if status_code in (202, 204):
59 return data
60- return Serializer().deserialize(data, self.content_type())
61+ return Serializer(self._serialization_metadata).\
62+ deserialize(data, self.content_type())
63
64 def content_type(self, format=None):
65 """

Subscribers

People subscribed via source and target branches