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.
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()
status_set,
)
from charms.reactive import (
- remove_state as remove_flag,
- set_state as set_flag,
+ clear_flag,
+ set_flag,
when,
when_not,
)
else:
action_set({'outout': result})
finally:
- remove_flag('actions.touch')
+ clear_flag('actions.touch')