Merge lp:~julian-edwards/maas/ipmi-password-failure-detect into lp:~maas-committers/maas/trunk

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 2972
Proposed branch: lp:~julian-edwards/maas/ipmi-password-failure-detect
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 22 lines (+10/-1)
1 file modified
etc/maas/templates/power/ipmi.template (+10/-1)
To merge this branch: bzr merge lp:~julian-edwards/maas/ipmi-password-failure-detect
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+234430@code.launchpad.net

Commit message

Detect IPMI password failures and exit with the right status in the IPMI template.

Description of the change

I've tested this locally and it works, although there's a separate bug of the stderr from the template not reaching the event log, which I'll investigate separately.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) :
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-08-19 22:22:31 +0000
3+++ etc/maas/templates/power/ipmi.template 2014-09-12 09:45:57 +0000
4@@ -62,8 +62,17 @@
5 echo workaround |\
6 ${ipmi_chassis_config} ${workarounds} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
7 fi
8+
9+ # Use C locale to force English error messages.
10 result=$(echo workaround |\
11- ${ipmipower} ${workarounds} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@")
12+ LC_ALL=C ${ipmipower} ${workarounds} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@")
13+
14+ if [ $(echo $result | grep -q "password invalid") ]
15+ then
16+ echo "Invalid password" >&2
17+ exit 1
18+ fi
19+
20 case "$result" in
21 *:* )
22 # Result looks like the usual IPMI output: