Merge lp:~racb/maas/fix-ipmi-enlistment into lp:~maas-committers/maas/trunk

Proposed by Robie Basak
Status: Merged
Approved by: Robie Basak
Approved revision: no longer in the source branch.
Merged at revision: 1256
Proposed branch: lp:~racb/maas/fix-ipmi-enlistment
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 15 lines (+4/-1)
1 file modified
contrib/preseeds_v2/enlist_userdata (+4/-1)
To merge this branch: bzr merge lp:~racb/maas/fix-ipmi-enlistment
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Andres Rodriguez Pending
Review via email: mp+128914@code.launchpad.net

Commit message

Retry maas-enlist without power parameters on failure

Older versions of maas-enlist (such as in Precise) do not support the
new power parameters switches and fail when they are provided, so on
failure retry without them.

Description of the change

This fixes the problem for me. A better way would be to do some proper feature or version checking in maas-enlist, but this would introduce more chance of a regression and we are time constrained right now. This also spams the console, but at least it is clear when the fallback has taken place.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Is there any chance you can make it more obvious that the second invocation is conditional on the first? It's pretty easy to misread given that the first line is very long and ends with the critical "||\" characters. Perhaps indent the second maas-enlist line?

Looks ok otherwise.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contrib/preseeds_v2/enlist_userdata'
2--- contrib/preseeds_v2/enlist_userdata 2012-10-10 20:14:55 +0000
3+++ contrib/preseeds_v2/enlist_userdata 2012-10-11 08:42:27 +0000
4@@ -182,7 +182,10 @@
5 fi
6 power_params=$(maas-ipmi-autodetect --configdir "$IPMI_CONFIG_D" ${pargs} --commission-creds) &&
7 [ -n "${power_params}" ] && power_params=${power_params%.} && power_type=ipmi
8- maas-enlist --serverurl "$url" ${host:+--hostname "${host}"} ${power_params:+--power-params "${power_params}" --power-type "${power_type}"}>/tmp/enlist.out
9+ # Try maas-enlist without power parameters on failure for older versions of
10+ # maas-enlist without power parameter support
11+ maas-enlist --serverurl "$url" ${host:+--hostname "${host}"} ${power_params:+--power-params "${power_params}" --power-type "${power_type}"}>/tmp/enlist.out ||\
12+ maas-enlist --serverurl "$url" ${host:+--hostname "${host}"} >/tmp/enlist.out
13 if [ $? -eq 0 ]; then
14 msg="successfully enlisted to '$url'"
15 [ -n "$host" ] && msg="$msg with hostname '$host'" ||