<div dir="ltr">Nice, I like this. +1 Marco<div><br></div><div>If we have a "tips and tricks" page or charmer snippets, this should live there.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><br></div><div>Charles Butler <<a href="mailto:charles.butler@canonical.com" target="_blank">charles.butler@canonical.com</a>> - Juju Charmer</div><div><span style="font-size:small">Come see the future of modeling your datacenter: </span><a href="http://jujucharms.com/" style="color:rgb(17,85,204);font-size:small" target="_blank">http://jujucharms.com</a><br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Mar 2, 2016 at 6:45 AM, Marco Ceppi <span dir="ltr"><<a href="mailto:marco.ceppi@canonical.com" target="_blank">marco.ceppi@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">To answer your question anyways, you can do this with the peers relation:<div><br></div><div>``` metadata.yaml</div><div>peers:</div><div> cluster:</div><div> interface: my-service-cluster</div><div>```</div><div><br></div><div>So, at anytime, in any hook you can do the following:</div><div><br></div><div>``` bash</div><div>rid=$(relation-ids cluster)</div><div>for unit in $(relation-list -r $rid); do</div><div> echo "It's a peer and confidant $unit"</div><div>done</div><div>```</div><div><br></div><div>However, since Juju gives unique numbers for each unit, you could use a units number to enumerate a port. You wouldn't need the peer relationship for this directly. As an example</div><div><br></div><div>``` bash</div><div>port_start=4000</div><div>port=$(expr $port_start + ${JUJU_UNIT_NAME##*/})</div><div>```</div><div><br></div><div>So if it's unit/0 you'll get 4000, if it's unit/10 you'll get 4010, etc. Since unit numbers are unique in Juju you'll never get a conflict.</div><div><br></div><div>Marco Ceppi</div></div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Wed, Mar 2, 2016 at 6:29 AM Tom Barber <<a href="mailto:tom@analytical-labs.com" target="_blank">tom@analytical-labs.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Scrap that, I have an alternative solution!</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr">--------------<div><br></div><div><div style="font-size:small"><font color="#999999">Director Meteorite.bi - Saiku Analytics Founder</font></div><div style="font-size:small"><font color="#999999">Tel: <a href="tel:%2B44%280%295603641316" value="+445603641316" target="_blank">+44(0)5603641316</a> </font></div><div style="font-size:small"><font color="#999999"><br></font></div><div style="font-size:small"><font color="#999999">(Thanks to the Saiku community we reached our <a href="http://kickstarter.com/projects/2117053714/saiku-reporting-interactive-report-designer/" target="_blank">Kickstart</a> goal, but you can always help by <a href="http://www.meteorite.bi/products/saiku/sponsorship" target="_blank">sponsoring the project</a>)</font></div></div></div></div></div></div></div></div><div class="gmail_extra">
<br><div class="gmail_quote">On 2 March 2016 at 11:22, Tom Barber <span dir="ltr"><<a href="mailto:tom@analytical-labs.com" target="_blank">tom@analytical-labs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Morning
<div><br></div><div>I need to open an extra port for each unit in my charm, can I ask juju for a count of running units in a service?</div><div><br></div><div>Thanks</div><span><font color="#888888"><div><br></div><div>Tom</div></font></span></div>
</blockquote></div><br></div></div></div><span class="HOEnZb"><font color="#888888">
--<br>
Juju mailing list<br>
<a href="mailto:Juju@lists.ubuntu.com" target="_blank">Juju@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju</a><br>
</font></span></blockquote></div>
<br>--<br>
Juju mailing list<br>
<a href="mailto:Juju@lists.ubuntu.com">Juju@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju</a><br>
<br></blockquote></div><br></div>