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
=== modified file 'juju/control/status.py'
--- juju/control/status.py 2011-09-30 03:18:49 +0000
+++ juju/control/status.py 2011-10-17 17:33:23 +0000
@@ -389,6 +389,25 @@
389389
390 filelike.write(dot.create(format=format))390 filelike.write(dot.create(format=format))
391391
392
393def render_capistrano(data, filelike, environment):
394 """capistrano role output
395
396 see https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started
397 """
398 for service_name, service in data["services"].iteritems():
399 filelike.write("role :%s, " % service_name)
400 unit_addresses = []
401 for unit_name, unit in service["units"].iteritems():
402 if isinstance(unit.get("public-address"), str):
403 unit_addresses.append("%r" % unit["public-address"])
404
405 if unit_addresses:
406 filelike.write(", ".join(unit_addresses))
407
408 filelike.write("\n")
409
392renderers["dot"] = render_dot410renderers["dot"] = render_dot
393renderers["svg"] = functools.partial(render_dot, format="svg")411renderers["svg"] = functools.partial(render_dot, format="svg")
394renderers["png"] = functools.partial(render_dot, format="png")412renderers["png"] = functools.partial(render_dot, format="png")
413renderers["capistrano"] = render_capistrano
395414
=== modified file 'juju/control/tests/test_status.py'
--- juju/control/tests/test_status.py 2011-09-30 03:18:49 +0000
+++ juju/control/tests/test_status.py 2011-10-17 17:33:23 +0000
@@ -658,3 +658,24 @@
658658
659 # look for a hint the process completed.659 # look for a hint the process completed.
660 self.assertIn("</svg>", self.output.getvalue())660 self.assertIn("</svg>", self.output.getvalue())
661
662 @inlineCallbacks
663 def test_render_capistrano(self):
664 yield self.build_topology()
665 self.mock_environment()
666 self.mocker.replay()
667
668 yield status.status(self.environment, [],
669 status.renderers["capistrano"],
670 self.output,
671 None)
672
673 expected = """
674role :varnish, 'varnish-1.example.com', 'varnish-0.example.com'
675role :memcache, 'memcache-0.example.com', 'memcache-1.example.com'
676role :wordpress, 'wordpress-0.example.com'
677role :mysql, 'mysql-0.example.com', 'mysql-1.example.com'
678"""
679 self.assertEqual(expected.strip(),
680 self.output.getvalue().strip())
681

Subscribers

People subscribed via source and target branches

to status/vote changes: