removing relation results in hook error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Keystone SAML Mellon Charm |
Triaged
|
Low
|
Unassigned |
Bug Description
We've also noticed that removing the mellon relations puts the charm in error state with this error logged:
2019-06-26 10:56:35 DEBUG worker.uniter.jujuc server.go:182 running hook tool "juju-log"
2019-06-26 10:56:35 INFO juju-log keystone-
2019-06-26 10:56:35 DEBUG worker.uniter.jujuc server.go:182 running hook tool "juju-log"
2019-06-26 10:56:35 ERROR juju-log keystone-
Traceback (most recent call last):
File "/var/lib/
bus.dispatch(
File "/var/lib/
_invoke(
File "/var/lib/
handler.invoke()
File "/var/lib/
self._action(*args)
File "/var/lib/
charm_instance.
File "/var/lib/
rel = self.relations[0]
File "/var/lib/
return super()
IndexError: list index out of range
tags: | added: scaleback |
The bug still exists in the charm-interface -keystone- fid-service- provider interface in provides.py at line 78:
def publish(self, protocol_name, remote_ id_attribute) : relation_ set work on a per-relation basis
rel.to_ publish[ 'protocol- name'] = protocol_name
rel.to_ publish[ 'remote- id-attribute' ] = remote_id_attribute
# get the first relation object as we only have one relation
# to a primary as a subordinate
rel = self.relations[0]
# can have multiple dashboard charms in general, therefore,
# all relation objects and all units must be handled
# to_publish/
Easiest fix is just to check that self.relations has at least one element or wrap it in a try: except: