Skip to content

Cannot use the consume function without having the controllers information locally #436

@davigar15

Description

@davigar15

Hello,

I have experienced the following error when consuming an endpoint from libjuju:

Traceback (most recent call last):
  File "test.py", line 37, in <module>
    loop.run_until_complete(libjuju.consume("admin/prometheus.grafana-source", "8f87f1bf-07cc-49fd-a80a-537197392c5c"))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/app/N2VC/n2vc/libjuju.py", line 771, in consume
    await model.consume(offer_url)
  File "/usr/local/lib/python3.6/dist-packages/juju/model.py", line 2017, in consume
    source = await self._get_source_api(offer, controller_name=controller_name)
  File "/usr/local/lib/python3.6/dist-packages/juju/model.py", line 2082, in _get_source_api
    await controller.connect(controller_name=controller_name)
  File "/usr/local/lib/python3.6/dist-packages/juju/controller.py", line 114, in connect
    await self._connector.connect_controller(controller_name, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/juju/client/connector.py", line 84, in connect_controller
    controller_name = self.jujudata.current_controller()
  File "/usr/local/lib/python3.6/dist-packages/juju/client/jujudata.py", line 137, in current_controller
    return self._load_yaml('controllers.yaml', 'current-controller')
  File "/usr/local/lib/python3.6/dist-packages/juju/client/jujudata.py", line 206, in _load_yaml
    with io.open(filepath, 'rt') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/share/juju/controllers.yaml'

This is happening because I'm running libjuju in a kubernetes pod that has neither bootstrapped the juju controller nor stored the information about it in the file-system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions