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: I282bf7fc864f9066596c20ba6175283e934e7c12
This commit is contained in:
Alex Kavanagh 2018-01-19 14:34:51 +00:00
parent 85da01cf72
commit a205b61008
2 changed files with 3 additions and 3 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@ layers
interfaces
trusty
.testrepository
.stestr
__pycache__

View File

@ -25,7 +25,7 @@ import charmhelpers.core.hookenv as hookenv
import charmhelpers.core.templating
import charms_openstack.charm
import charms_openstack.adapters
import charms.reactive
import charms.reactive.relations as relations
# There are no additional packages to install.
PACKAGES = []
@ -199,8 +199,7 @@ class ManilaGenericCharm(charms_openstack.charm.OpenStackCharm):
# TODO this is horrible, and we should have something in
# charms.openstack to do this, but we need a c.r relation to be able to
# add it to the adapters_instance
manila_plugin = charms.reactive.RelationBase.from_state(
'manila-plugin.available')
manila_plugin = relations.endpoint_from_flag('manila-plugin.available')
self.adapters_instance.add_relation(manila_plugin)
rendered_configs = charmhelpers.core.templating.render(
source=os.path.basename(MANILA_CONF),