Merge lp:~negronjl/pyjuju/874801 into lp:pyjuju

Proposed by Juan L. Negron
Status: Rejected
Rejected by: Kapil Thangavelu
Proposed branch: lp:~negronjl/pyjuju/874801
Merge into: lp:pyjuju
Diff against target: 58 lines (+40/-0)
2 files modified
juju/control/status.py (+19/-0)
juju/control/tests/test_status.py (+21/-0)
To merge this branch: bzr merge lp:~negronjl/pyjuju/874801
Reviewer Review Type Date Requested Status
William Reade (community) Approve
Review via email: mp+79473@code.launchpad.net

Description of the change

Capistrano status output renderer for Juju. LP: 874801

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Needs a unit test.

Revision history for this message
Juan L. Negron (negronjl) wrote :

Thanks to ben (bcsaller) for the help.
This should be ready for review now.
-Juan

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

added some discussion to the bug report about this branch as that has a wider subscription.

Revision history for this message
William Reade (fwereade) wrote :

Re: bug report discussion: this is clear and simple; it seems to be genuinely useful to some potential users; it doesn't add any real complexity to juju as it stands. My only worry is that it may be somewhat tedious to maintain (or just become useless) when we allow co-located units, and by including it we are setting up an expectation that it will continue to work; this makes me personally -0 on the proposal, but other people seem to like it a lot so I'm comfortable approving it nonetheless.

review: Approve
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

so based on the discussion on irc, it sounds like we've got consensus to structure this as a separate package from the core.

Unmerged revisions

409. By Juan L. Negron

Merged in bcsaller's changes

408. By Juan L. Negron

Capfile renderer for juju status. LP: 874801

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/control/status.py'
2--- juju/control/status.py 2011-09-30 03:18:49 +0000
3+++ juju/control/status.py 2011-10-17 17:33:23 +0000
4@@ -389,6 +389,25 @@
5
6 filelike.write(dot.create(format=format))
7
8+
9+def render_capistrano(data, filelike, environment):
10+ """capistrano role output
11+
12+ see https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started
13+ """
14+ for service_name, service in data["services"].iteritems():
15+ filelike.write("role :%s, " % service_name)
16+ unit_addresses = []
17+ for unit_name, unit in service["units"].iteritems():
18+ if isinstance(unit.get("public-address"), str):
19+ unit_addresses.append("%r" % unit["public-address"])
20+
21+ if unit_addresses:
22+ filelike.write(", ".join(unit_addresses))
23+
24+ filelike.write("\n")
25+
26 renderers["dot"] = render_dot
27 renderers["svg"] = functools.partial(render_dot, format="svg")
28 renderers["png"] = functools.partial(render_dot, format="png")
29+renderers["capistrano"] = render_capistrano
30
31=== modified file 'juju/control/tests/test_status.py'
32--- juju/control/tests/test_status.py 2011-09-30 03:18:49 +0000
33+++ juju/control/tests/test_status.py 2011-10-17 17:33:23 +0000
34@@ -658,3 +658,24 @@
35
36 # look for a hint the process completed.
37 self.assertIn("</svg>", self.output.getvalue())
38+
39+ @inlineCallbacks
40+ def test_render_capistrano(self):
41+ yield self.build_topology()
42+ self.mock_environment()
43+ self.mocker.replay()
44+
45+ yield status.status(self.environment, [],
46+ status.renderers["capistrano"],
47+ self.output,
48+ None)
49+
50+ expected = """
51+role :varnish, 'varnish-1.example.com', 'varnish-0.example.com'
52+role :memcache, 'memcache-0.example.com', 'memcache-1.example.com'
53+role :wordpress, 'wordpress-0.example.com'
54+role :mysql, 'mysql-0.example.com', 'mysql-1.example.com'
55+"""
56+ self.assertEqual(expected.strip(),
57+ self.output.getvalue().strip())
58+

Subscribers

People subscribed via source and target branches

to status/vote changes: