Merge lp:~jason-hobbs/maas/fix-ipmi-power-template into lp:~maas-committers/maas/trunk

Proposed by Jason Hobbs
Status: Merged
Approved by: Jason Hobbs
Approved revision: no longer in the source branch.
Merged at revision: 2643
Proposed branch: lp:~jason-hobbs/maas/fix-ipmi-power-template
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 41 lines (+9/-9)
1 file modified
etc/maas/templates/power/ipmi.template (+9/-9)
To merge this branch: bzr merge lp:~jason-hobbs/maas/fix-ipmi-power-template
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+229090@code.launchpad.net

Commit message

Treat soft like a command not like an option for off.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/maas/templates/power/ipmi.template'
2--- etc/maas/templates/power/ipmi.template 2014-07-16 09:42:00 +0000
3+++ etc/maas/templates/power/ipmi.template 2014-07-31 17:16:20 +0000
4@@ -27,20 +27,20 @@
5 # This workaround is required on many BMCs, and should have no impact
6 # on BMCs that don't require it.
7 # See https://bugs.launchpad.net/maas/+bug/1287964
8-power_options="-W opensesspriv"
9-
10-# If a soft power off is requested, pass this request to ipmipower.
11-if [ "$power_change" = "off" ] && [ "$power_off_mode" = "soft" ];
12-then
13- power_options="$power_options --soft"
14-fi
15+workarounds="-W opensesspriv"
16
17 # Determines the power command needed to execute the desired
18 # action. This function receives ${power_change} as argument.
19 formulate_power_command() {
20 case $1 in
21 'on') echo '--cycle --on-if-off' ;;
22- 'off') echo '--off' ;;
23+ 'off')
24+ if [ "$power_off_mode" = "soft" ];
25+ then
26+ echo '--soft'
27+ else
28+ echo '--off'
29+ fi ;;
30 'query') echo '--stat' ;;
31 *)
32 echo "Got unknown power state from ipmipower: '$1'" >&2
33@@ -60,7 +60,7 @@
34 echo workaround |\
35 ${ipmi_chassis_config} ${workarounds} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
36 result=$(echo workaround |\
37- ${ipmipower} ${power_options} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@")
38+ ${ipmipower} ${workarounds} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@")
39 case "$result" in
40 *:* )
41 # Result looks like the usual IPMI output: