Action doesn't correctly translate unit name into tag if hyphen present

Bug #1486297 reported by Ali
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Won't Fix
Undecided
Unassigned
python-jujuclient
Confirmed
Undecided
Unassigned

Bug Description

The Action.enqueue_units() function takes a unit ID and translates it into a unit tag, if it doesn't begin with unit. This translation appends unit- to the name, but it doesn't covert the machine separator ('/') into a hypen as well. This results in the following code working:

enqueue_units('mymachine/0', 'myaction', None)

However this fails:

enqueue_units('my-machine/0', 'myaction', None)

In the latter case, I think the name ends up being converted by unitTagSuffixToId() as my/machine/0. In addition perhaps the unitSTagSuffixToId function (names/unit.go) should have a check that a / doesn't already exist in the tag?

I believe the proper fix is to replace the '/' with a '-' in enqueue_units() whet the unit- is appended.

Marco Ceppi (marcoceppi)
Changed in juju-core:
status: New → Won't Fix
Changed in python-jujuclient:
status: New → Confirmed
Revision history for this message
Dimiter Naydenov (dimitern) wrote :

This is not a juju-core issue, but it's caused by this line in python-jujuclient:

http://bazaar.launchpad.net/~juju-deployers/python-jujuclient/trunk/view/head:/jujuclient.py#L1890

The client assumes any unit passed to enqueue_units should be a unit tag (unit-my-unit-0), not a name (my-unit/0).
The conversion from a name to a tag is handled correctly in juju-core, but when using the API tags are expected instead of names.

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.