1 from charmhelpers
.core
.hookenv
import (
6 from charms
.reactive
import (
8 remove_state
as remove_flag
,
10 import charms
.sshproxy
13 @when('actions.reboot')
17 result
, err
= charms
.sshproxy
._run
("reboot")
19 action_fail('command failed:' + err
)
21 action_set({'outout': result
})
23 remove_flag('actions.reboot')
26 ###############################################################################
27 # Below is an example implementation of the start/stop/restart actions. #
28 # To use this, copy the below code into your layer and add the appropriate #
29 # command(s) necessary to perform the action. #
30 ###############################################################################
32 # @when('actions.start')
36 # cmd = "service myname start"
37 # result, err = charms.sshproxy._run(cmd)
39 # action_fail('command failed:' + err)
41 # action_set({'outout': result})
43 # remove_flag('actions.start')
46 # @when('actions.stop')
50 # # Enter the command to stop your service(s)
51 # cmd = "service myname stop"
52 # result, err = charms.sshproxy._run(cmd)
54 # action_fail('command failed:' + err)
56 # action_set({'outout': result})
58 # remove_flag('actions.stop')
61 # @when('actions.restart')
65 # # Enter the command to restart your service(s)
66 # cmd = "service myname restart"
67 # result, err = charms.sshproxy._run(cmd)
69 # action_fail('command failed:' + err)
71 # action_set({'outout': result})
73 # remove_flag('actions.restart')