TypeError when calling render_with_interfaces

Bug #1623917 reported by Liam Young
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Tempest Charm (Deprecated)
Invalid
Undecided
Unassigned
charms.openstack
Fix Released
High
Liam Young

Bug Description

Rebuilding the Barbican charm and deploying it results in an Exception when the charm renders its config. This is also true of AODH and probably any other charm that used render_with_interfaces from charms.openstack.

This issue has appeared since https://review.openstack.org/#/c/366776/ landed.

The issue appears to be that charms have created child classes of OpenStackRelationAdapter or OpenStackAPIRelationAdapters to implement bespoke relation adapters. These child classes do not have the 'charm_instance' keyword arg so when render_with_interfaces calls the adapter class with 'charm_instance=self' it explodes.

Example stack trace is:
2016-09-15 11:34:08 INFO shared-db-relation-changed Traceback (most recent call last):
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-barbican-3/charm/hooks/shared-db-relation-changed", line 19, in <module>
2016-09-15 11:34:08 INFO shared-db-relation-changed main()
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/usr/local/lib/python3.5/dist-packages/charms/reactive/__init__.py", line 78, in main
2016-09-15 11:34:08 INFO shared-db-relation-changed bus.dispatch()
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 434, in dispatch
2016-09-15 11:34:08 INFO shared-db-relation-changed _invoke(other_handlers)
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 417, in _invoke
2016-09-15 11:34:08 INFO shared-db-relation-changed handler.invoke()
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 291, in invoke
2016-09-15 11:34:08 INFO shared-db-relation-changed self._action(*args)
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-barbican-3/charm/reactive/barbican_handlers.py", line 75, in render_stuff
2016-09-15 11:34:08 INFO shared-db-relation-changed barbican.render_configs(args)
2016-09-15 11:34:08 INFO shared-db-relation-changed File "lib/charm/openstack/barbican.py", line 72, in render_configs
2016-09-15 11:34:08 INFO shared-db-relation-changed BarbicanCharm.singleton.render_with_interfaces(interfaces_list)
2016-09-15 11:34:08 INFO shared-db-relation-changed File "/usr/local/lib/python3.5/dist-packages/charms_openstack/charm.py", line 737, in render_with_interfaces
2016-09-15 11:34:08 INFO shared-db-relation-changed charm_instance=self))
2016-09-15 11:34:08 INFO shared-db-relation-changed TypeError: __init__() got an unexpected keyword argument 'charm_instance'
2016-09-15 11:34:08 ERROR juju.worker.uniter.operation runhook.go:107 hook "shared-db-relation-changed" failed: exit status 1

Liam Young (gnuoy)
Changed in charms.openstack:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Liam Young (gnuoy)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charms.openstack (master)

Reviewed: https://review.openstack.org/370793
Committed: https://git.openstack.org/cgit/openstack/charms.openstack/commit/?id=832e0b3b873f5d2f4d1ce55557f849264f02d1c7
Submitter: Jenkins
Branch: master

commit 832e0b3b873f5d2f4d1ce55557f849264f02d1c7
Author: Liam Young <email address hidden>
Date: Thu Sep 15 13:00:08 2016 +0000

    Fix TypeError when calling render_with_interfaces

    The issue appears to be that charms have created child classes of
    OpenStackRelationAdapter or OpenStackAPIRelationAdapters to implement
    bespoke relation adapters. These child classes do not have the
    'charm_instance' keyword arg in their init method. So when
    render_with_interfaces calls the adapter class with
    'charm_instance=self' it explodes.

    This issue wat introduced in https://review.openstack.org/#/c/366776/

    Change-Id: I50e0dfcb37b26a86ead6e2318e945d7efa0875fc
    Closes-Bug: #1623917

Changed in charms.openstack:
status: Confirmed → Fix Released
Revision history for this message
Ryan Beisner (1chb1n) wrote :

The tempest charm fails the identity-admin-relation-changed fails on xenial-newton with:

TypeError: __init__() got an unexpected keyword argument 'charm_instance'

See attached for more detail.

Revision history for this message
Liam Young (gnuoy) wrote :

I think the issue your hitting with the tempest charm is a different issue. The fix that landed for the original bug was to catch TypeError if render_configs was called with charm_instance and the child class didn't support charm_instance. If this happens render_configs was called without the charm_instance kw arg. It looks that in the tempest charm the TypeError is correctly being caught and render_configs is then called with the correct args but there is then an auth error when trying to render the config. The stacktrace then displays

...
2016-10-08 05:15:59 INFO identity-admin-relation-changed TypeError: __init__() got an unexpected keyword argument 'charm_instance'
2016-10-08 05:15:59 INFO identity-admin-relation-changed
2016-10-08 05:15:59 INFO identity-admin-relation-changed During handling of the above exception, another exception occurred:
2016-10-08 05:15:59 INFO identity-admin-relation-changed
2016-10-08 05:15:59 INFO identity-admin-relation-changed Traceback (most recent call last):
...
2016-10-08 05:15:59 INFO identity-admin-relation-changed keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication.

Ryan Beisner (1chb1n)
Changed in charm-tempest:
status: New → Invalid
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.