3 # Copyright 2019 Whitestack, LLC
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
17 # For those usages not covered by the Apache License, Version 2.0 please
18 # contact: esousa@whitestack.com or glavado@whitestack.com
20 {%- if license is defined %}
21 # Copyright {{ license.year }} {{ license.company }}
23 # Licensed under the Apache License, Version 2.0 (the "License"); you may
24 # not use this file except in compliance with the License. You may obtain
25 # a copy of the License at
27 # http://www.apache.org/licenses/LICENSE-2.0
29 # Unless required by applicable law or agreed to in writing, software
30 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
31 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
32 # License for the specific language governing permissions and limitations
35 # For those usages not covered by the Apache License, Version 2.0 please
36 # contact: {{ license.email }}
40 sys.path.append('lib')
42 from charms.reactive import main
43 from charms.reactive import set_state
44 from charmhelpers.core.hookenv import action_fail, action_name
47 `set_state` only works here because it's flushed to disk inside the `main()`
48 loop. remove_state will need to be called inside the action method.
50 set_state('actions.{}'.format(action_name()))
54 except Exception as e: