Unable to add_machine with 'tags' as constraints
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-jujuclient |
In Progress
|
Undecided
|
Felipe Reyes |
Bug Description
Calling add_machine with 'tags' as constraints fails as follows:
>>> from jujuclient.juju2 import environment
>>> juju = environment.
>>> juju.add_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
return self.client.
File "/usr/local/
return self.add_
File "/usr/local/
"params": machines}})
File "/usr/local/
return self.env.
File "/usr/local/
raise EnvError(result)
jujuclient.
{ u'error': u'json: cannot unmarshal string into Go value of type []string',
u'request-id': 2,
u'response': { }}
This is because of the fact that the current implementation of the _prepare_
53 def _prepare_
54 for k in ['cpu-cores', 'cpu-power', 'mem']:
55 if constraints.get(k):
56 constraints[k] = int(constraints[k])
57 return constraints
On providers such as MAAS, I think it is normal that constraints such as 'tags' to be supported.
Related branches
Changed in python-jujuclient: | |
assignee: | nobody → Felipe Reyes (freyes) |
status: | New → In Progress |
tags (and spaces) constraints are expected to be a list, if you use {'tags': ['test']} the request will be properly formatted.
Although It will be nice if jujuclient could deal with strings like the ones are used in the CLI "--constraints tags=t1,t2"