~jelmer/launchpad/retry-update-node-tags

« back to all changes in this revision

Viewing changes to src/provisioningserver/power/templates/ipmi.template

  • Committer: Tarmac
  • Author(s): Andres Rodriguez
  • Date: 2012-10-06 16:53:24 UTC
  • mfrom: (1195.2.1 maas)
  • Revision ID: tarmac-20121006165324-2qji3qtejq6ec9gx
[r=allenap][bug=][author=andreserl] Minor improvements to IPMI template

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
ipmi_chassis_config={{ipmi_chassis_config}}
13
13
config={{config_dir}}/{{ipmi_config}}
14
14
 
 
15
# Determines the power command needed to execute the desired
 
16
# action. This function receives ${power_change} as argument.
15
17
formulate_power_command() {
16
18
    case $1 in
17
19
    'on') echo '--cycle --on-if-off' ;;
18
20
    'off') echo '--off' ;;
19
21
    *)
20
 
        echo "Got unknown power state from ipmipower: '$2'" >&2
 
22
        echo "Got unknown power state from ipmipower: '$1'" >&2
21
23
        exit 1
22
24
    esac
23
25
}
24
26
 
 
27
# Determines the current state on which the machine finds itself.
 
28
# The argument passed comes from IPMI's stat command in the form:
 
29
# <ipmi-ip-address>: <on/off>
 
30
# This function evaluates whether it was <on/off>.
25
31
formulate_power_state() {
26
32
    case $2 in
27
33
    'on') echo 'on' ;;
38
44
    echo workaround |\
39
45
    ${ipmi_chassis_config} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
40
46
    echo workaround |\
41
 
    ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} $*
 
47
    ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
42
48
}
43
49
 
44
50