[20.05] keystone-fid-service-provider-relation-joined failed: AttributeError: 'NoneType' object has no attribute 'strip'

Bug #1882084 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Keystone Charm
Fix Released
High
Dmitrii Shcherbakov

Bug Description

charm-keystone tries to use .strip on a value returned for 'protocol-name' without checking if it is None or not first.

https://review.opendev.org/#/c/690597/13
https://openstack-ci-reports.ubuntu.com/artifacts/test_charm_pipeline_func_full/openstack/charm-keystone-saml-mellon/690597/13/5928/index.html
https://openstack-ci-reports.ubuntu.com/artifacts/test_charm_pipeline_func_full/openstack/charm-keystone-saml-mellon/690597/13/5928/test_charm_func_full_9069/juju-crashdump-27d1cfea-67a4-4f21-943e-e017cec479a1.tar.xz

2020-06-03 20:23:17 DEBUG keystone-fid-service-provider-relation-joined _ctxt = context()
2020-06-03 20:23:17 DEBUG keystone-fid-service-provider-relation-joined File "/var/lib/juju/agents/unit-keystone-1/charm/hooks/keystone_context.py", line 445, in __call__
2020-06-03 20:23:17 DEBUG keystone-fid-service-provider-relation-joined _protocol_name = rdata.get('protocol-name').strip('"')
2020-06-03 20:23:17 DEBUG keystone-fid-service-provider-relation-joined AttributeError: 'NoneType' object has no attribute 'strip'
2020-06-03 20:23:17 ERROR juju.worker.uniter.operation runhook.go:132 hook "keystone-fid-service-provider-relation-joined" failed: exit status 1

hooks/keystone_context.py:
                rdata = relation_get(unit=unit, rid=rid)
                _protocol_name = rdata.get('protocol-name').strip('"')
                if _protocol_name and _protocol_name not in self.auth_methods:
                    self.auth_methods.append(_protocol_name)
                    # We are federated so remove the external method
                    if _external in self.auth_methods:
                        self.auth_methods.remove(_external)

Changed in charm-keystone:
assignee: nobody → Dmitrii Shcherbakov (dmitriis)
milestone: none → 20.08
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-keystone (master)

Reviewed: https://review.opendev.org/733635
Committed: https://git.openstack.org/cgit/openstack/charm-keystone/commit/?id=4eb640ab56a48f49f354fd4c4ae929c763e72f61
Submitter: Zuul
Branch: master

commit 4eb640ab56a48f49f354fd4c4ae929c763e72f61
Author: Dmitrii Shcherbakov <email address hidden>
Date: Thu Jun 4 17:46:36 2020 +0300

    Return an empty string if relation data is missing

    None is returned for a relation data value if a key isn't present -
    assuming that it's a string is not correct. This change fixes that by
    returning an empty string if protocol-name is not present.

    Change-Id: I2bab6a69f9f663edee0738ff35b804d81736cb5c
    Closes-Bug: #1882084

Changed in charm-keystone:
status: In Progress → Fix Committed
Changed in charm-keystone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.