juju / python-libjuju

Python library for the Juju API
Apache License 2.0
59 stars 99 forks source link

Got this error when deploying a juju bundle #287

Closed aliouba closed 5 years ago

aliouba commented 5 years ago

I am still investigating but the same code works on one environment but not another one, which is very weird.

My code

    jujubundle = "jujubundles/mybundle.yaml"
    bundles_dir = Path(__file__).absolute().parent.parent
    bundle_path = "%s/app/%s" % (bundles_dir,jujubundle)
    my_bundle = await m.deploy(
        str(bundle_path)
    )
    await m.disconnect()
    return my_bundle

And I got this error

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/site-packages/openbrokerapi/request_filter.py", line 55, in wrapped
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/openbrokerapi/api.py", line 127, in provision
    result = broker.provision(instance_id, provision_details, accepts_incomplete)
  File "app.py", line 101, in provision
    app = loop.run_until_complete(deployBundle(appname,m))
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
    return future.result()
  File "/usr/src/app/jujuutils.py", line 60, in deployBundle
    str(bundle_path)
  File "/usr/local/lib/python3.7/site-packages/juju/model.py", line 1283, in deploy
    await handler.execute_plan()
  File "/usr/local/lib/python3.7/site-packages/juju/model.py", line 1947, in execute_plan
    result = await method(*step.args)
TypeError: deploy() takes 9 positional arguments but 11 were given
johnsca commented 5 years ago

This should be addressed by #274 (originally reported in #272). Can you confirm that you are using the latest version of the library (0.11.2) and what Juju controller version?

johnsca commented 5 years ago

Comment on #272 issue indicates this can be closed. Glad it is resolved.

aliouba commented 5 years ago

Thanks @johnsca.

But It is important to understand why It was not working anymore. Can you explain why?

Was there a bug? Normally we have the ability to use 0.10.2 than the new version 0.11.2.

johnsca commented 5 years ago

There was a change to the Juju API which was not backwards compatible. Normally, this is handled by the versioning of the API calls (facade versions), but in this case, changes from the unfinalized Juju 2.5 got pulled 0.10.2 due to needing a change from a previous API update (the API hadn't been synced in a while before that). It just so happened that the facade version was updated prior to the change that caused this issue, and libjuju updated in the middle.

We have started integrating the Juju CI with libjuju CI to prevent this from happening, and we also need to make a process change to ensure that a non-stable version of the Juju APIs don't get released as a stable version of libjuju.