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
This commit is contained in:
Alex Kavanagh 2018-01-19 15:05:00 +00:00
parent 083e2442af
commit 41b1a69f54
2 changed files with 3 additions and 3 deletions

View File

@ -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(

View File

@ -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 = []