Bundles with resources fail to deploy #35

Closed
petevg opened this Issue Dec 14, 2016 · 2 comments

Comments

Projects
None yet
2 participants
Collaborator

petevg commented Dec 14, 2016

To reproduce:

  1. Attempt to deploy a bundle containing resources.
  2. Get this traceback:

(from matrix, trying to deploy landscape)

Traceback for <Task finished coro=<RuleEngine.rule_runner() done, defined at /home/petevg/Code/matrix/matrix/rules.py:175> exception=JSONDecodeError('Expecting value: line 1 column 1 (char 0)',)> (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 292, in _step
    self = None  # Needed to break cycles when an exception occurs.
  File "/home/petevg/Code/matrix/matrix/rules.py", line 263, in rule_runner
    break
  File "/home/petevg/Code/matrix/matrix/model.py", line 344, in execute
    result = await self.task.execute(context, self)
  File "/home/petevg/Code/matrix/matrix/model.py", line 171, in execute
    raise
  File "/home/petevg/Code/matrix/matrix/model.py", line 181, in execute_plugin
    result = await cmd(context, rule, self, event)
  File "/home/petevg/Code/matrix/matrix/tasks/deploy.py", line 5, in deploy
    await context.juju_model.deploy(str(context.config.path))
  File "/home/petevg/Code/matrix/.tox/py35/lib/python3.5/site-packages/juju/model.py", line 880, in deploy
    await handler.execute_plan()
  File "/home/petevg/Code/matrix/.tox/py35/lib/python3.5/site-packages/juju/model.py", line 1314, in execute_plan
    result = await method(*step.args)
  File "/home/petevg/Code/matrix/.tox/py35/lib/python3.5/site-packages/juju/model.py", line 1442, in deploy
    resources=resources,
  File "/home/petevg/Code/matrix/.tox/py35/lib/python3.5/site-packages/juju/client/_client.py", line 620, in __init__
    self.constraints = Value.from_json(constraints) if constraints else None
  File "/home/petevg/Code/matrix/.tox/py35/lib/python3.5/site-packages/juju/client/facade.py", line 442, in from_json
    data = json.loads(data)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This is related to translating stuff from the Planner yaml into Value objects that can be packaged up in JSON for the core API. Apparently, we need to translate Resources in a way similar to the way that we translate constraints. (see constraints.py)

sparkiegeek commented Dec 14, 2016

I don't believe this error has anything to do with resources. Neither the charms nor the bundle use resources.

By adding some debugging to ApplicationDeploy I can see that it falls over thinking that the constraints are JSON.

File "/usr/local/lib/python3.5/dist-packages/juju/client/_client.py", line 623, in __init__
assert False, "Unable to de-JSONify {}".format(constraints)
AssertionError: Unable to de-JSONify mem=2048

Collaborator

petevg commented Dec 14, 2016

I'm wrong on this one. My eyes go line numbers crossed. Will open an accurate bug (we're missing a call to parse_constraints, I think.)

@petevg petevg closed this Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment