FWIW, <i>"open-ports --close-others"</i> feels pretty simple and uncontroversial, even more when it comes from a core developer that apparently would be implementing the feature himself to solve his own pain points. Golden case. <div><br></div><div><br><br><div class="gmail_quote">On Sat Nov 01 2014 at 2:58:42 PM John Meinel <<a href="mailto:john@arbash-meinel.com">john@arbash-meinel.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I believe there is already "opened-ports" to tell you what ports Juju is currently tracking.<div><br></div><div>As for the rest, "open-port" only takes a single port (or range), which means that if you wanted only 80 and 8080 open, you would need a different syntax. (something that lets you specify multiple ports/ranges to be opened).</div><div><br></div><div>I can see a point to it, but we do already have "opened-ports" if you're looking for the behavior you want.</div><div><br></div><div>John</div><div>=:-></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 1, 2014 at 6:13 PM, Aaron Bentley <span dir="ltr"><<a href="mailto:aaron.bentley@canonical.com" target="_blank">aaron.bentley@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Hi all,<br>
<br>
I take a stateful approach to writing charms. That is, my charms<br>
determine what the target state is, then take whatever actions are<br>
needed to get the unit into that state, paying as little attention to<br>
the current state as is possible.<br>
<br>
open-port / close-port require knowledge of the current state; if I<br>
know that I want only port 314 open, then I need to know whether any<br>
other ports are open and close them. In most cases, a charm only<br>
opens specific ports, so I know which ports to close.<br>
<br>
Right now, I'm writing an update to the Apache2 charm that would allow<br>
the user to specify which ports to serve http on, which means that<br>
when a user changes the port, I may need to close the old port and<br>
open the new one. If I want to use close-port / open-port, I need to<br>
track what ports are open. But juju already knows this, so I<br>
shouldn't have to track it separately-- that violates DRY.<br>
<br>
The smallest change would be to provide a way to list the open ports,<br>
so that charms can close any open ports they no longer want open. But<br>
that leaves a bunch of work for a stateful charm author. What they<br>
actually want is a command that ensures specific ports are open and<br>
closes all others.<br>
<br>
ensure-these-and-only-these-ports was the first thing I thought of,<br>
but we could extend open-port instead. open-port would need to accept<br>
multiple ports, not just ranges, and it would need to accept a<br>
- --close-all-others flag, that would close all open ports not listed.<br>
<br>
Does that seem like a sensible change?<br>
<br>
Aaron<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1<br>
<br>
iQEcBAEBAgAGBQJUVOo3AAoJEK84cMOcf+9h2acIAL5ogJIy4O23TKa/RiWUcv0E<br>
wX9NHpNj9r7P8LoEHwUN/0nIeLi0UPQtDMN/w2orKGK01oXsPvvoVy/SPmMH+8G+<br>
yjOWQY1ppjB42vFsdLlP1d6VFutI94hiLEFgfT1ss9JSbPZXteakoKmhG3Og+W4e<br>
pZSrvVjccZPp3IhSsGclfVxVJLD+lMYxXL7NA/x4ji74YMiUE8pH3OCbCeOjderw<br>
oHlDMPClItugqvgAtCiHpr/n79yB75y1FARalsbXelXullgBLpiRxTQHgBq/yfn+<br>
o22d1uCmp+xqIveyUS433RffEzMDDt61UaZTuyui8ZG9n4/Jy9xOpKN9wGDhhvE=<br>
=gzrL<br>
-----END PGP SIGNATURE-----<br>
<span><font color="#888888"><br>
--<br>
Juju-dev mailing list<br>
<a href="mailto:Juju-dev@lists.ubuntu.com" target="_blank">Juju-dev@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju-dev" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju-dev</a><br>
</font></span></blockquote></div><br></div>
--<br>
Juju-dev mailing list<br>
<a href="mailto:Juju-dev@lists.ubuntu.com" target="_blank">Juju-dev@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju-dev" target="_blank">https://lists.ubuntu.com/<u></u>mailman/listinfo/juju-dev</a><br>
</blockquote></div></div>