From e779167bf5dbb0fd20851d5eebe1595cd4b33c6c Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 18 Jan 2018 14:34:56 +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: I0a9ddb5a8870cdf81a553229889f00090e90ab0b --- src/lib/charm/openstack/designate.py | 7 +++---- src/reactive/designate_handlers.py | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/charm/openstack/designate.py b/src/lib/charm/openstack/designate.py index e69e016..dd72275 100644 --- a/src/lib/charm/openstack/designate.py +++ b/src/lib/charm/openstack/designate.py @@ -25,7 +25,7 @@ import charms_openstack.ip as os_ip import charmhelpers.core.decorators as decorators import charmhelpers.core.hookenv as hookenv import charmhelpers.core.host as host -import charms.reactive as reactive +import charms.reactive.relations as relations from charmhelpers.contrib.network import ip as ch_ip @@ -539,9 +539,8 @@ class DesignateCharm(openstack_charm.HAOpenStackCharm): hookenv.config('neutron-domain'))): return 'blocked', ('nameservers must be set when specifying' ' nova-domain or neutron-domain') - dns_backend_available = (reactive - .RelationBase - .from_state('dns-backend.available')) + dns_backend_available = (relations + .endpoint_from_flag('dns-backend.available')) invalid_dns = self.options.invalid_pool_config() if invalid_dns: return 'blocked', invalid_dns diff --git a/src/reactive/designate_handlers.py b/src/reactive/designate_handlers.py index 24be084..24d4466 100644 --- a/src/reactive/designate_handlers.py +++ b/src/reactive/designate_handlers.py @@ -16,6 +16,7 @@ import subprocess import charm.openstack.designate as designate import charms.reactive as reactive +import charms.reactive.relations as relations import charmhelpers.core.hookenv as hookenv import charmhelpers.contrib.network.ip as ip @@ -123,10 +124,10 @@ def expose_rndc_address(cluster): def configure_designate_basic(*args): """Configure the minimum to boostrap designate""" # If cluster relation is available it needs to passed in - cluster = reactive.RelationBase.from_state('cluster.available') + cluster = relations.endpoint_from_flag('cluster.available') if cluster is not None: args = args + (cluster, ) - dns_backend = reactive.RelationBase.from_state('dns-backend.available') + dns_backend = relations.endpoint_from_flag('dns-backend.available') if dns_backend is not None: args = args + (dns_backend, ) with provide_charm_instance() as instance: @@ -159,10 +160,10 @@ def update_peers(cluster): def configure_designate_full(*args): """Write out all designate config include bootstrap domain info""" # If cluster relation is available it needs to passed in - cluster = reactive.RelationBase.from_state('cluster.available') + cluster = relations.endpoint_from_flag('cluster.available') if cluster is not None: args = args + (cluster, ) - dns_backend = reactive.RelationBase.from_state('dns-backend.available') + dns_backend = relations.endpoint_from_flag('dns-backend.available') if dns_backend is not None: args = args + (dns_backend, ) with provide_charm_instance() as instance: