<div dir="ltr">Thanks Marco and Andrew for the great discussion. I admit that I was a bit confused while running the `open-port` command. <div><br></div><div>>"<span style="font-size:12.8px">Different machines will run different applications" </span></div><div><br></div><div>This is exactly what confused me. I'm actually running two applications on a single machine (wordpress and mysql). So when I wanted to open the port for that machine it was with the understanding  that it would in turn make it available to any service running on that machine. Where as the open-port command understood the context in terms of units or applications as Andrew pointed out. </div><div><br></div><div>Besides Marco's suggestion if we could update the docs to indicate what commands are run in what context that would be really helpful. For example if you look at <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens">nginx's documentation</a> taking a random directive like server_tokens you can see that command can run in http, server and location blocks. </div><div><br></div><div><br></div><table cellspacing="0" style="color:rgb(0,0,0);font-family:sans-serif;font-size:medium"><tbody><tr><th style="padding-left:0px;padding-right:0.5em;vertical-align:baseline;text-align:left;font-weight:normal">> Syntax:</th><td style="vertical-align:baseline"><code><strong>server_tokens</strong> <code>on</code> | <code>off</code> | <code>build</code> | <code><i>string</i></code>;</code><br></td></tr><tr><th style="padding-left:0px;padding-right:0.5em;vertical-align:baseline;text-align:left;font-weight:normal">Default:</th><td style="vertical-align:baseline"><pre style="padding:0px;margin-top:0px;margin-bottom:0px">server_tokens on;</pre></td></tr><tr><th style="padding-left:0px;padding-right:0.5em;vertical-align:baseline;text-align:left;font-weight:normal">Context:</th><td style="vertical-align:baseline"><code>http</code>, <code>server</code>, <code>location</code></td></tr></tbody></table><div><br></div><div>Would it make sense to do something like that in juju's documentation as well?   </div><div><br></div><div>Thanks,</div><div>Akshat</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 26, 2017 at 3:59 PM, 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">I think the use case is pretty apparent from the start of this thread, it's opaque to a user that --all does not result in the same execution environment as --unit or --application. It seems --all should be disambiguated to --all-machines and possibly an --all-units feature. I could see wanting to collect information from hook tools of all units in a deploy, network-get for example, or other commands.<span class="HOEnZb"><font color="#888888"><div><br></div></font></span><div><span class="HOEnZb"><font color="#888888">Marco</font></span><div><div class="h5"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 23, 2017 at 11:20 AM Andrew Wilkins <<a href="mailto:andrew.wilkins@canonical.com" target="_blank">andrew.wilkins@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 23, 2017 at 5:12 PM Marco Ceppi <<a href="mailto:marco.ceppi@canonical.com" target="_blank">marco.ceppi@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 23, 2017, 03:59 Andrew Wilkins <<a href="mailto:andrew.wilkins@canonical.com" target="_blank">andrew.wilkins@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 23, 2017 at 4:20 AM Akshat Jiwan Sharma <<a href="mailto:akshatjiwan@gmail.com" target="_blank">akshatjiwan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">HI,<div><br></div><div>I'm trying to manually expose a port on a juju machine. According to <a href="https://askubuntu.com/questions/808176/how-to-manually-open-a-port-in-juju" target="_blank">this answer</a> I should be able to do something like this:- </div><div><br></div><div> juju run  "open-port 443" --all <br></div><div><br></div><div>However when I type this in my shell it throws an error </div><div><br></div><div>open-port: command not found</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>The different between the command you're running, and the one on AskUbuntu, is that you're not passing --unit. When you pass --unit, it runs the command in the context of a unit on the machine. You must be running in the context of a unit to use "hook tools", such as open-port.</div></div></div></blockquote></div><div><br></div><div>It seems weird that `juju run` behaves differently when using --unit and --all, is there a particular reason for that? I wouldn't expect the above command to fail.</div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>`juju run` supports running commands in either a machine or unit context. Only if you run within a unit context do you get access to hook tools. Hooks require a unit context.</div><div><br></div><div>"--all" means "all machines", so the command runs in a machine context, for each machine. You could have multiple units on a machine, so we can't automatically choose a unit. Even if we could, what would be the use case for doing that? Different machines will run different applications, which will each have their own firewall requirements.<br></div><div><br></div><div>Cheers,</div><div>Andrew</div></div></div>
</blockquote></div></div></div></div></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/<wbr>mailman/listinfo/juju</a><br>
<br></blockquote></div><br></div>