X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=tests%2Fcharms%2Flayers%2Fsimple%2Freactive%2Fsimple.py;h=af6644bdd6ae44847f319abfc348faaab173d0c0;hp=802d60cba2b2f1c1c082bd78245c2e3e6e8638e7;hb=b2a07f566be558a8b59b8b5dedfe8da5ae1b0132;hpb=d420a8b6f1fecde3983369b131da1f042c7c8a14 diff --git a/tests/charms/layers/simple/reactive/simple.py b/tests/charms/layers/simple/reactive/simple.py index 802d60c..af6644b 100644 --- a/tests/charms/layers/simple/reactive/simple.py +++ b/tests/charms/layers/simple/reactive/simple.py @@ -11,6 +11,7 @@ from charms.reactive import ( when_not, ) import charms.sshproxy +import os @when('sshproxy.configured') @@ -31,6 +32,10 @@ def install_simple_proxy_charm(): @when('actions.touch') def touch(): + if not in_action_context(): + clear_flag('actions.touch') + return + err = '' try: filename = action_get('filename') @@ -42,3 +47,8 @@ def touch(): action_set({'output': result}) finally: clear_flag('actions.touch') + + +def in_action_context(): + """Determine whether we're running on an action context.""" + return 'JUJU_ACTION_UUID' in os.environ