canonical / serialized-data-interface

Serialized Data Interface LIbrary for Juju Operators
Apache License 2.0
0 stars 2 forks source link

SDI library throws exception when relation is broken #17

Closed knkski closed 3 years ago

knkski commented 3 years ago

I deployed a bundle that had istio-pilot and istio-ingressgateway, with a relation between them. I then ran juju remove-relation istio-pilot istio-ingressgateway, and got this error:

unit-istio-ingressgateway-0: 13:09:21 ERROR juju.worker.uniter.operation hook "istio-pilot-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
unit-istio-ingressgateway-0: 13:09:21 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-istio-ingressgateway-0: 13:09:31 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-istio-ingressgateway-0: 13:09:32 ERROR unit.istio-ingressgateway/0.juju-log istio-pilot:3: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 1284, in _run
    result = run(args, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('/var/lib/juju/tools/unit-istio-ingressgateway-0/relation-get', '-r', '3', '-', '', '--app', '--format=json')' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./src/charm.py", line 67, in <module>
    main(Operator)
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/main.py", line 394, in main
    charm = charm_class(framework)
  File "./src/charm.py", line 24, in __init__
    self.interfaces = get_interfaces(self)
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/serialized_data_interface/__init__.py", line 172, in get_interfaces
    requires = {
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/serialized_data_interface/__init__.py", line 173, in <dictcomp>
    name: SerializedDataInterface(
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/serialized_data_interface/__init__.py", line 67, in __init__
    others = {
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/serialized_data_interface/__init__.py", line 68, in <dictcomp>
    app.name: bag.get("_supported_versions")
  File "/usr/lib/python3.8/_collections_abc.py", line 660, in get
    return self[key]
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 400, in __getitem__
    return self._data[key]
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 384, in _data
    data = self._lazy_data = self._load()
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 748, in _load
    return self._backend.relation_get(self.relation.id, self._entity.name, self._is_app)
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 1351, in relation_get
    return self._run(*args, return_output=True, use_json=True)
  File "/var/lib/juju/agents/unit-istio-ingressgateway-0/charm/venv/ops/model.py", line 1286, in _run
    raise ModelError(e.stderr)
ops.model.ModelError: b'ERROR "" is not a valid unit or application\n'
knkski commented 3 years ago

Closing this, as it appears to be fixed with ops==1.2.0. Related issue that was also closed for the same reason:

https://github.com/canonical/operator/issues/642