From 7a5344c988e3a9c11a2db896fd080659e16d3f59 Mon Sep 17 00:00:00 2001 From: Adam Israel Date: Thu, 21 Jun 2018 15:57:00 -0400 Subject: [PATCH] Update deprecated methods The `set_state` and `remove_state` methods have been deprecated in favour of `set_flag` and `clear_flag`. This updates the references to those methods. --- juju-charms/layers/simple/actions/touch | 5 ++--- juju-charms/layers/simple/reactive/simple.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/juju-charms/layers/simple/actions/touch b/juju-charms/layers/simple/actions/touch index d85d3fac..7e30af4c 100755 --- a/juju-charms/layers/simple/actions/touch +++ b/juju-charms/layers/simple/actions/touch @@ -18,15 +18,14 @@ import sys sys.path.append('lib') -from charms.reactive import main -from charms.reactive import set_state +from charms.reactive import main, set_flag from charmhelpers.core.hookenv import action_fail, action_name """ `set_state` only works here because it's flushed to disk inside the `main()` loop. remove_state will need to be called inside the action method. """ -set_state('actions.{}'.format(action_name())) +set_flag('actions.{}'.format(action_name())) try: main() diff --git a/juju-charms/layers/simple/reactive/simple.py b/juju-charms/layers/simple/reactive/simple.py index 2a55a5c7..8355bf30 100644 --- a/juju-charms/layers/simple/reactive/simple.py +++ b/juju-charms/layers/simple/reactive/simple.py @@ -5,8 +5,8 @@ from charmhelpers.core.hookenv import ( status_set, ) from charms.reactive import ( - remove_state as remove_flag, - set_state as set_flag, + clear_flag, + set_flag, when, when_not, ) @@ -41,4 +41,4 @@ def touch(): else: action_set({'outout': result}) finally: - remove_flag('actions.touch') + clear_flag('actions.touch') -- 2.25.1