Add --all-units flag to `juju exec`

Bug #1714791 reported by Dmitrii Shcherbakov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Expired
Wishlist
Unassigned

Bug Description

I have noticed it in older versions as well but I haven't reported it until now.

When --all is used instead of --application or --unit no context is added and one cannot use hook tools.

juju version
2.2.3-xenial-amd64

juju run --all 'leader-get'
- MachineId: "0"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec423897953/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "1"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec855188809/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "2"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec879909396/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "3"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec086721957/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "4"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec844669457/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "5"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec445768926/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "6"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec544412598/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "7"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec826609010/script.sh: line 1: leader-get: command not found
  Stdout: ""
- MachineId: "8"
  ReturnCode: 127
  Stderr: |
    /tmp/juju-exec623228081/script.sh: line 1: leader-get: command not found
  Stdout: ""

juju run --all 'env'
http://paste.ubuntu.com/25458703/

Same for --unit yields expected results:

juju run --unit kubernetes-worker/0 'leader-get'
{}

juju run --unit kubernetes-worker/0 'env'
JUJU_API_ADDRESSES=10.232.5.91:17070
JUJU_UNIT_NAME=kubernetes-worker/0
CHARM_DIR=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
JUJU_ACTION_TAG=action-b0cdfa87-bafa-466a-83d6-44f532a4dcff
JUJU_METER_INFO=
JUJU_CHARM_DIR=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
NO_PROXY=127.0.0.1,::1,localhost
JUJU_SLA=unsupported
PATH=/var/lib/juju/tools/unit-kubernetes-worker-0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
JUJU_ACTION_UUID=b0cdfa87-bafa-466a-83d6-44f532a4dcff
JUJU_ACTION_NAME=juju-run
JUJU_MACHINE_ID=6
PWD=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
JUJU_PRINCIPAL_UNIT=
JUJU_CONTEXT_ID=kubernetes-worker/0-juju-run-1899650935921258530
SHLVL=1
JUJU_AVAILABILITY_ZONE=Valravn
JUJU_MODEL_UUID=aee3ef84-6bd7-42bc-8bad-0269f4920148
no_proxy=127.0.0.1,::1,localhost
DEBIAN_FRONTEND=noninteractive
APT_LISTCHANGES_FRONTEND=none
JUJU_METER_STATUS=RED
JUJU_MODEL_NAME=default
JUJU_AGENT_SOCKET=@/var/lib/juju/agents/unit-kubernetes-worker-0/agent.socket
_=/usr/bin/env

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1714791] [NEW] no context added for commands executed via juju run --all
Download full text (3.4 KiB)

--all means all machines not all units. And there is no hook context for a
machine.

On Sep 3, 2017 19:50, "Dmitrii Shcherbakov" <email address hidden>
wrote:

> Public bug reported:
>
> I have noticed it in older versions as well but I haven't reported it
> until now.
>
> When --all is used instead of --application or --unit no context is
> added and one cannot use hook tools.
>
> juju version
> 2.2.3-xenial-amd64
>
> juju run --all 'leader-get'
> - MachineId: "0"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec423897953/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "1"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec855188809/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "2"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec879909396/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "3"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec086721957/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "4"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec844669457/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "5"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec445768926/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "6"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec544412598/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "7"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec826609010/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
> - MachineId: "8"
> ReturnCode: 127
> Stderr: |
> /tmp/juju-exec623228081/script.sh: line 1: leader-get: command not
> found
> Stdout: ""
>
> juju run --all 'env'
> http://paste.ubuntu.com/25458703/
>
>
> Same for --unit yields expected results:
>
> juju run --unit kubernetes-worker/0 'leader-get'
> {}
>
> juju run --unit kubernetes-worker/0 'env'
> JUJU_API_ADDRESSES=10.232.5.91:17070
> JUJU_UNIT_NAME=kubernetes-worker/0
> CHARM_DIR=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
> JUJU_ACTION_TAG=action-b0cdfa87-bafa-466a-83d6-44f532a4dcff
> JUJU_METER_INFO=
> JUJU_CHARM_DIR=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
> NO_PROXY=127.0.0.1,::1,localhost
> JUJU_SLA=unsupported
> PATH=/var/lib/juju/tools/unit-kubernetes-worker-0:/usr/
> local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> JUJU_ACTION_UUID=b0cdfa87-bafa-466a-83d6-44f532a4dcff
> JUJU_ACTION_NAME=juju-run
> JUJU_MACHINE_ID=6
> PWD=/var/lib/juju/agents/unit-kubernetes-worker-0/charm
> JUJU_PRINCIPAL_UNIT=
> JUJU_CONTEXT_ID=kubernetes-worker/0-juju-run-1899650935921258530
> SHLVL=1
> JUJU_AVAILABILITY_ZONE=Valravn
> JUJU_MODEL_UUID=aee3ef84-6bd7-42bc-8bad-0269f4920148
> no_proxy=127.0.0.1,::1,localhost
> DEBIAN_FRONTEND=noninteractive
> APT_LISTCHANGES_FRONTEND=none
> JUJU_METER_STATUS=RED
> JUJU_MODEL_NAME=default
> JUJU_AGENT_SOCKET=@/var/lib/juju/agents/unit-kubernetes-
> worker-0/agent.socket
> _=/usr/bin/env
>
> ** Affects: juju
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because y...

Read more...

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote : Re: no context added for commands executed via juju run --all

Makes sense.

It may not be as frequently used but maybe it's a candidate for something like: juju run --all-units

summary: - no context added for commands executed via juju run --all
+ juju run --all-units
Changed in juju:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote : Re: juju run --all-units

This bug has not been updated in 5 years, so we're marking it Expired. If you believe this is incorrect, please update the status.

Changed in juju:
status: Triaged → Expired
tags: added: expirebugs-bot
Revision history for this message
Jordan Barrett (barrettj12) wrote :

A similar proposal for `juju run`: https://bugs.launchpad.net/juju/+bug/1831260

summary: - juju run --all-units
+ Add --all-units flag to juju exec
summary: - Add --all-units flag to juju exec
+ Add --all-units flag to `juju exec`
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.