launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #13055
[Merge] lp:~andreserl/maas/fix_ipmi_command_execution into lp:maas
Andres Rodriguez has proposed merging lp:~andreserl/maas/fix_ipmi_command_execution into lp:maas.
Requested reviews:
Andres Rodriguez (andreserl)
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~andreserl/maas/fix_ipmi_command_execution/+merge/128342
--
https://code.launchpad.net/~andreserl/maas/fix_ipmi_command_execution/+merge/128342
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/fix_ipmi_command_execution into lp:maas.
=== modified file 'src/provisioningserver/power/templates/ipmi.template'
--- src/provisioningserver/power/templates/ipmi.template 2012-10-05 06:17:45 +0000
+++ src/provisioningserver/power/templates/ipmi.template 2012-10-06 04:02:21 +0000
@@ -12,6 +12,15 @@
ipmi_chassis_config={{ipmi_chassis_config}}
config={{config_dir}}/{{ipmi_config}}
+formulate_power_command() {
+ case $1 in
+ 'on') echo '--cycle --on-if-off' ;;
+ 'off') echo '--off' ;;
+ *)
+ echo "Got unknown power state from ipmipower: '$2'" >&2
+ exit 1
+ esac
+}
formulate_power_state() {
case $2 in
@@ -29,7 +38,7 @@
echo workaround |\
${ipmi_chassis_config} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
echo workaround |\
- ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} $1
+ ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} $*
}
@@ -42,5 +51,6 @@
if [ "$(get_power_state)" != "${power_change}" ]
then
- issue_ipmi_command ${power_change}
+ power_command=$(formulate_power_command ${power_change})
+ issue_ipmi_command ${power_command}
fi
Follow ups