juju run doesn't work with subordinate units

Bug #1286613 reported by Kapil Thangavelu
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Medium
Marco Ceppi

Bug Description

i was trying to use juju run to debug current settings for a subordinate unit ala

$ juju run --unit=agent/0 "relation-ids ceilometer-service"
ERROR agent/0 is not a principal unit

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

If we're being explicit about which unit we want to target.. i say just let the user do it.. --all can/should nanny filter subordinates, but if a user is specifically interested in running something on a subordinate i don't see the reason not to let them.

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

ie. i can juju ssh/scp into a subordinate unit without issue.. i don't see why run is being restricted.

Curtis Hovey (sinzui)
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
tags: added: run subordinate
Changed in juju-core:
importance: High → Medium
Revision history for this message
Robie Basak (racb) wrote :

Workaround:

"juju ssh service/0" gets me into the machine.
"juju-run service/0 ..." then seems to work.

On 1.20.7.

Revision history for this message
Robie Basak (racb) wrote :

Python workaround:

import subprocess

def remote_run(unit, command):
    subprocess.check_call(['juju', 'ssh', unit] + command)

def remote_run_run(unit1, unit2, command):
    remote_run(unit1, ['juju-run', unit2, "'%s'" % command])

Then I can call, for example:

    remote_run_run('main-service/0', 'subordinate-service/0', '...')

Revision history for this message
Marco Ceppi (marcoceppi) wrote :
Changed in juju-core:
status: Triaged → Fix Committed
assignee: nobody → Marco Ceppi (marcoceppi)
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → 1.21-alpha2
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
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.