X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=charms%2Flayers%2Fpingpong%2Factions%2Fstop-traffic;fp=charms%2Flayers%2Fpingpong%2Factions%2Fstop-traffic;h=9352b331594f2502b26e55236a071839d2a28d5f;hb=5c78e636753044e1cd39b06fb154556e090591a3;hp=0000000000000000000000000000000000000000;hpb=f52f42c54c8c4b9d249401a22648e8660c587750;p=osm%2Fdevops.git diff --git a/charms/layers/pingpong/actions/stop-traffic b/charms/layers/pingpong/actions/stop-traffic new file mode 100755 index 00000000..9352b331 --- /dev/null +++ b/charms/layers/pingpong/actions/stop-traffic @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import sys +sys.path.append('lib') + +from charms.reactive import main +from charms.reactive import set_state +from charmhelpers.core.hookenv import action_fail + +""" +`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.stop-traffic') + +try: + main() +except Exception as e: + action_fail(repr(e))