charmed-lma / charm-k8s-grafana

Kubernetes Operator for Grafana
Apache License 2.0
5 stars 3 forks source link

Handle the case where the unit is not (yet) the leader #1

Closed relaxdiego closed 4 years ago

relaxdiego commented 4 years ago
2020-02-20 08:41:26 DEBUG start Traceback (most recent call last):
2020-02-20 08:41:26 DEBUG start   File "/var/lib/juju/agents/unit-charm-k8s-grafana-1/charm/hooks/start", line 67, in <module>
2020-02-20 08:41:26 DEBUG start     main(Charm)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/main.py", line 187, in main
2020-02-20 08:41:26 DEBUG start     _emit_charm_event(charm, juju_event_name)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/main.py", line 118, in _emit_charm_event
2020-02-20 08:41:26 DEBUG start     event_to_emit.emit(*args, **kwargs)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/framework.py", line 192, in emit
2020-02-20 08:41:26 DEBUG start     framework._emit(event)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/framework.py", line 602, in _emit
2020-02-20 08:41:26 DEBUG start     self._reemit(event_path)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/framework.py", line 637, in _reemit
2020-02-20 08:41:26 DEBUG start     custom_handler(event)
2020-02-20 08:41:26 DEBUG start   File "/var/lib/juju/agents/unit-charm-k8s-grafana-1/charm/hooks/start", line 48, in on_start_delegator
2020-02-20 08:41:26 DEBUG start     self.adapter.set_pod_spec(output.spec)
2020-02-20 08:41:26 DEBUG start   File "/var/lib/juju/agents/application-charm-k8s-grafana/charm/src/adapters.py", line 28, in set_pod_spec
2020-02-20 08:41:26 DEBUG start     self._framework.model.pod.set_spec(spec_obj)
2020-02-20 08:41:26 DEBUG start   File "lib/ops/model.py", line 452, in set_spec
2020-02-20 08:41:26 DEBUG start     raise ModelError('cannot set a pod spec as this unit is not a leader')
2020-02-20 08:41:26 DEBUG start ops.model.ModelError: cannot set a pod spec as this unit is not a leader
2020-02-20 08:41:27 ERROR juju.worker.uniter.operation runhook.go:132 hook "start" failed: exit status 1
2020-02-20 08:41:37 DEBUG start Traceback (most recent call last):
2020-02-20 08:41:37 DEBUG start   File "/var/lib/juju/agents/unit-charm-k8s-grafana-1/charm/hooks/start", line 67, in <module>
2020-02-20 08:41:37 DEBUG start     main(Charm)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/main.py", line 187, in main
2020-02-20 08:41:37 DEBUG start     _emit_charm_event(charm, juju_event_name)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/main.py", line 118, in _emit_charm_event
2020-02-20 08:41:37 DEBUG start     event_to_emit.emit(*args, **kwargs)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/framework.py", line 192, in emit
2020-02-20 08:41:37 DEBUG start     framework._emit(event)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/framework.py", line 602, in _emit
2020-02-20 08:41:37 DEBUG start     self._reemit(event_path)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/framework.py", line 637, in _reemit
2020-02-20 08:41:37 DEBUG start     custom_handler(event)
2020-02-20 08:41:37 DEBUG start   File "/var/lib/juju/agents/unit-charm-k8s-grafana-1/charm/hooks/start", line 48, in on_start_delegator
2020-02-20 08:41:37 DEBUG start     self.adapter.set_pod_spec(output.spec)
2020-02-20 08:41:37 DEBUG start   File "/var/lib/juju/agents/application-charm-k8s-grafana/charm/src/adapters.py", line 28, in set_pod_spec
2020-02-20 08:41:37 DEBUG start     self._framework.model.pod.set_spec(spec_obj)
2020-02-20 08:41:37 DEBUG start   File "lib/ops/model.py", line 452, in set_spec
2020-02-20 08:41:37 DEBUG start     raise ModelError('cannot set a pod spec as this unit is not a leader')
2020-02-20 08:41:37 DEBUG start ops.model.ModelError: cannot set a pod spec as this unit is not a leader
2020-02-20 08:41:37 ERROR juju.worker.uniter.operation runhook.go:132 hook "start" failed: exit status 1