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: I6e025438bacd17dfb2a6f61fb8ca274187009c57
This commit is contained in:
parent
10e3532842
commit
b902df7e0e
|
@ -19,6 +19,7 @@ import charmhelpers.contrib.openstack.utils as os_utils
|
|||
import charmhelpers.core.host as ch_host
|
||||
|
||||
import charms.reactive
|
||||
import charms.reactive.relations as relations
|
||||
import charms_openstack.charm
|
||||
|
||||
# This charm's library contains all of the handler code associated with
|
||||
|
@ -105,8 +106,7 @@ def render_stuff(*args):
|
|||
manila_charm.render_with_interfaces(args)
|
||||
manila_charm.assess_status()
|
||||
charms.reactive.set_state('manila.config.rendered')
|
||||
manila_plugin = charms.reactive.RelationBase.from_state(
|
||||
'manila-plugin.changed')
|
||||
manila_plugin = relations.endpoint_from_flag('manila-plugin.changed')
|
||||
if manila_plugin:
|
||||
manila_plugin.clear_changed()
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ class TestRenderStuff(test_utils.PatchHelper):
|
|||
self.patch('charms.reactive.set_state', name='set_state')
|
||||
|
||||
manila_plugin = mock.MagicMock()
|
||||
self.patch('charms.reactive.RelationBase.from_state',
|
||||
name='from_state',
|
||||
self.patch('charms.reactive.relations.endpoint_from_flag',
|
||||
name='endpoint_from_flag',
|
||||
return_value=manila_plugin)
|
||||
handlers.render_stuff('arg1', 'arg2')
|
||||
manila_charm.render_with_interfaces.assert_called_once_with(
|
||||
|
|
Loading…
Reference in New Issue