From 41b1a69f54d5b29670444daf4be2d9da9a8819a8 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 19 Jan 2018 15:05:00 +0000 Subject: [PATCH] Fix up to work with 0.6.0 of charms.reactive charms.reactive deprecates the RelationBase.from_state() class method. This is an internal method in charms.reactive and shouldn't really have been used. This patch changes to charms.relations.endpoint_from_flag(...) which essentially does the same thing and will be a more stable API moving forwards. Note that from this point on, the library will ONLY work with charms.reactive 0.6.0 onwards and the modified charms.openstack library. Change-Id: I704d1bfe7c51880c38482667a6e1fcccb8059357 --- src/actions/run-tempest.py | 4 ++-- src/lib/charm/openstack/tempest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/actions/run-tempest.py b/src/actions/run-tempest.py index 148afe1..e73172c 100755 --- a/src/actions/run-tempest.py +++ b/src/actions/run-tempest.py @@ -3,7 +3,7 @@ import sys sys.path.append('lib') import charm.openstack.tempest as tempest -import charms.reactive as reactive +import charms.reactive.relations as relations import charmhelpers.core.hookenv as hookenv # Make sure that reactive is bootstrapped and all the states are setup @@ -13,7 +13,7 @@ basic.bootstrap_charm_deps() basic.init_config_states() if __name__ == '__main__': - identity_int = reactive.RelationBase.from_state('identity-admin.available') + identity_int = relations.endpoint_from_flag('identity-admin.available') if identity_int is None: # The interface isn't connected, so we can't do this yet hookenv.action_fail( diff --git a/src/lib/charm/openstack/tempest.py b/src/lib/charm/openstack/tempest.py index ebae0cb..271a23d 100644 --- a/src/lib/charm/openstack/tempest.py +++ b/src/lib/charm/openstack/tempest.py @@ -328,7 +328,7 @@ class TempestAdminAdapter(adapters.OpenStackRelationAdapter): # If not running in an action context asssume auto mode try: action_args = hookenv.action_get() - except Exception as e: + except Exception: action_args = {'service-whitelist': 'auto'} if action_args['service-whitelist'] == 'auto': white_list = []