canonical / operator

Pure Python framework for writing Juju charms
Apache License 2.0
247 stars 119 forks source link

Python Error in Deployment #751

Closed yananthan closed 2 years ago

yananthan commented 2 years ago

Hi Experts, I am new to juju and charm. I am trying to deploy as follows . But getting error during the deployment.

image image

But getting error as follows.

unit-basic-0: 03:49:44 INFO juju.worker.uniter hooks are retried true unit-basic-0: 03:49:44 INFO juju.worker.uniter.storage initial storage attachments ready unit-basic-0: 03:49:44 INFO juju.worker.uniter found queued "install" hook unit-basic-0: 03:49:44 INFO unit.basic/0.juju-log Running legacy hooks/install. unit-basic-0: 03:49:45 INFO unit.basic/0.juju-log Step 1/3: INSTALL unit-basic-0: 03:49:45 ERROR unit.basic/0.juju-log Uncaught exception while in charm code: Traceback (most recent call last): File "./src/charm.py", line 50, in main(BasicCharm) File "/var/lib/juju/agents/unit-basic-0/charm/venv/ops/main.py", line 431, in main _emit_charm_event(charm, dispatcher.event_name) File "/var/lib/juju/agents/unit-basic-0/charm/venv/ops/main.py", line 142, in _emit_charm_event event_to_emit.emit(*args, **kwargs) File "/var/lib/juju/agents/unit-basic-0/charm/venv/ops/framework.py", line 283, in emit framework._emit(event) File "/var/lib/juju/agents/unit-basic-0/charm/venv/ops/framework.py", line 743, in _emit self._reemit(event_path) File "/var/lib/juju/agents/unit-basic-0/charm/venv/ops/framework.py", line 790, in _reemit custom_handler(event) File "./src/charm.py", line 38, in _on_install self.unit.status = MaintenanceStatus("Step 1/3")

Please let me know where i miss. Thank you.

PietroPasotti commented 2 years ago

Hi @yananthan, if you could copy the full stack trace we can probably help you further, but I think the most common beginner mistake given this info is... Did you forget to import MaintenanceStatus?

from ops.model import MaintenanceStatus

Also, to get feedback and help more quickly, instead of opening an issue on github, I'd recommend you to post on https://discourse.charmhub.io/c/getting-started/48

yananthan commented 2 years ago

Hi @yananthan, if you could copy the full stack trace we can probably help you further, but I think the most common beginner mistake given this info is... Did you forget to import MaintenanceStatus?

from ops.model import MaintenanceStatus

Also, to get feedback and help more quickly, instead of opening an issue on github, I'd recommend you to post on https://discourse.charmhub.io/c/getting-started/48

Hi @PietroPasotti Yes I have managed to bringup when I import the python function. Thank you very much for the guidance. Sure I will get touch with that group..