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.
Marco On Mon, Oct 23, 2017 at 11:20 AM Andrew Wilkins < andrew.wilk...@canonical.com> wrote: > On Mon, Oct 23, 2017 at 5:12 PM Marco Ceppi <marco.ce...@canonical.com> > wrote: > >> On Mon, Oct 23, 2017, 03:59 Andrew Wilkins <andrew.wilk...@canonical.com> >> wrote: >> >>> On Mon, Oct 23, 2017 at 4:20 AM Akshat Jiwan Sharma < >>> akshatji...@gmail.com> wrote: >>> >>>> HI, >>>> >>>> I'm trying to manually expose a port on a juju machine. According to this >>>> answer >>>> <https://askubuntu.com/questions/808176/how-to-manually-open-a-port-in-juju> >>>> I should be able to do something like this:- >>>> >>>> juju run "open-port 443" --all >>>> >>>> However when I type this in my shell it throws an error >>>> >>>> open-port: command not found >>>> >>> >>> 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. >>> >> >> 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. >> > > `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. > > "--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. > > Cheers, > Andrew >
-- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev