Update deprecated methods 94/6294/1
authorAdam Israel <adam.israel@canonical.com>
Thu, 21 Jun 2018 19:57:00 +0000 (15:57 -0400)
committerAdam Israel <adam.israel@canonical.com>
Thu, 21 Jun 2018 19:57:00 +0000 (15:57 -0400)
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
juju-charms/layers/simple/reactive/simple.py

index d85d3fa..7e30af4 100755 (executable)
 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()
index 2a55a5c..8355bf3 100644 (file)
@@ -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')