Merge lp://staging/~hazmat/pyjuju/maas-with-tags into lp://staging/pyjuju
Proposed by
Kapil Thangavelu
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 618 | ||||
Proposed branch: | lp://staging/~hazmat/pyjuju/maas-with-tags | ||||
Merge into: | lp://staging/pyjuju | ||||
Diff against target: |
144 lines (+55/-11) 3 files modified
juju/providers/maas/maas.py (+16/-6) juju/providers/maas/tests/test_launch.py (+23/-4) juju/providers/maas/tests/test_maas.py (+16/-1) |
||||
To merge this branch: | bzr merge lp://staging/~hazmat/pyjuju/maas-with-tags | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email:
|
Description of the change
Properly encode maas tags in urls.
Hopefully the last in the sordid history of maas tag support. Revno 616 reverted
attempts to string serialize tags for urls, but which had broken constraint
comparisions. Those string serialization had been attempt in revno 597 and 598
to encode maas tags properly for maas client usage. This branch properly
captures the raw tags string for use by the client, while preserving the
constraint comparisons restored in revno 616.
To post a comment you must log in.
Reviewers: mp+149586_ code.launchpad. net,
Message:
Please take a look.
Description:
Properly encode maas tags in urls.
Hopefully the last in the sordid history of maas tag support. Revno 616
reverted
attempts to string serialize tags for urls, but which had broken
constraint
comparisions. Those string serialization had been attempt in revno 597
and 598
to encode maas tags properly for maas client usage. This branch properly
captures the raw tags string for use by the client, while preserving the
constraint comparisons restored in revno 516.
https:/ /code.launchpad .net/~hazmat/ juju/maas- with-tags/ +merge/ 149586
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7365044/
Affected files: maas/maas. py maas/tests/ test_launch. py maas/tests/ test_maas. py
A [revision details]
M juju/providers/
M juju/providers/
M juju/providers/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: juju/providers/ maas/maas. py /maas/maas. py' maas/maas. py 2012-11-06 16:51:30 +0000 maas/maas. py 2013-02-20 14:40:46 +0000 "system_ id")
=== modified file 'juju/providers
--- juju/providers/
+++ juju/providers/
@@ -47,17 +47,25 @@
return match.group(
-def _int_str(value):
+def _int_str(value, k, c):
"""Convert value to integer then string"""
return str(int(value))
+def _str(value, k, c): MAASOAuthConnec tion):
+ return str(value)
+
+
+def _raw(value, k, c):
+ return c.data.get(k)
+
+
class MAASClient(
_ handled_ constraints = ( constraints:
value = constraints. get(key_ from, None)
if value is not None: "api/1. 0/nodes/ ", params)
- ("maas-name", "name", str),
- ("maas-tags", "tags", str),
- ("arch", "arch", str),
+ ("maas-name", "name", _str),
+ ("maas-tags", "tags", _raw),
+ ("arch", "arch", _str),
("cpu", "cpu_count", _int_str),
("mem", "mem", _int_str),
)
@@ -140,7 +148,7 @@
for key_from, key_to, translate in self._handled_
- params[key_to] = translate(value)
+ params[key_to] = translate(value, key_from,
constraints)
return self.post(
def start_node(self, resource_uri, ubuntu_series, user_data): user_data, str), ( user_data) } user_data) } resource_ uri, params)
@@ -154,7 +162,9 @@
"""
assert isinstance(
"User data must be a byte string.")
- params = {"op": "start", "distro_series":
ubuntu_series, "user_data": b64encode(
+ params = {"op": "start",
+ "distro_series": ubuntu_series,
+ "user_data": b64encode(
return self.post(
def stop_node(self, resource_uri):
Index: juju/providers/ maas/tests/ test_launch. py /maas/tests/ test_launch. py' maas/tests/ test_launch. py 2012-09-28 11:50:35 +0000
=== modified file 'juju/providers
--- juju/providers/
+++ juju/provid...