A websocket client should not be responsible for parsing placement directives

Bug #1645480 reported by Pen Gale
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Wishlist
Unassigned

Bug Description

This is somewhat related to https://bugs.launchpad.net/juju/+bug/1645402

Currently, when a client that is talking to Juju through the websocket api wants to deploy a bundle, it first passes a bundle.yaml to the api. In exchange, it gets a plan, detailing the methods it must call and the arguments it must pass to deploy the bundle.

If a bundle contains machine placement directives, the planner will pass back a string representing the directive. The string might be "22", for example, indicating that something should be placed on machine 22. The API will not accept this string, however. That 22 needs to be parsed into a Placement object, with a `directive` of "22" and a `scope` of "#".

To avoid re-implementing placement.go on the client side, it would be preferable if the juju api either accepted the placement string as passed by the planner, or the planner passed back a JSON dict suitable for naively transforming into a Placement object, without needing to know magic strings like "#".

For now, I'm working around this issue in python-libjuju by partially implementing placement.go in Python. This creates maintenance issues going forward that wouldn't exist if this issue were addressed in juju core, though.

Thank you,
~ PeteVG

Tags: libjuju
Changed in juju:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Pen Gale (pengale) wrote :

I've worked around this issue in python-libjuju by partially re-implementing placement.go in Python. I wanted to get to the point where I was passing in something that could be unmarshalled into a Placement object, without worrying about checking for valid machine ids and other things that probably should be handled on the juju core side.

I'd appreciate eyes on https://github.com/juju/python-libjuju/pull/23, to verify that my simplified code is valid.

Thank you,
~ PeteVG

Cory Johns (johnsca)
tags: added: matrix
Cory Johns (johnsca)
tags: added: libjuju
Caner Derici (cderici)
tags: removed: matrix
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.