canonical-hw-cert team mailing list archive
-
canonical-hw-cert team
-
Mailing list archive
-
Message #79970
[Merge] ~rodsmith/maas-cert-server:add-login-debugging into maas-cert-server:master
Rod Smith has proposed merging ~rodsmith/maas-cert-server:add-login-debugging into maas-cert-server:master.
Commit message:
Add code to display MAAS errors and quit if maniacs-setup can't log in to MAAS
Requested reviews:
Michael Reed (mreed8855)
For more details, see:
https://code.launchpad.net/~rodsmith/maas-cert-server/+git/maas-cert-server/+merge/438244
Michael has passed on problems that a vendor is having with failed logins in the maniacs-setup script. Because maniacs-setup redirects stdout and stderr to /dev/null on these attempts, we don't know why MAAS is failing the logins. This MR adds a final attempt that does NOT redirect output, so we should at least see one error message. Because nothing else will work if the logins fail, the script then terminates.
--
Your team hardware-certification-users is subscribed to branch maas-cert-server:master.
diff --git a/debian/changelog b/debian/changelog
index e7cd82e..e210363 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+maas-cert-server (0.7.5-0ppa1) jammy; urgency=medium
+
+ * Add code to display MAAS error and terminate if login attempts fail
+ in maniacs-setup.
+
+ -- Rod Smith <rod.smith@xxxxxxxxxxxxx> Thu, 02 Mar 2023 15:14:57 -0500
+
maas-cert-server (0.7.4-0ppa1) jammy; urgency=medium
* Add disk space checks to maniacs-setup and lxc-setup scripts.
diff --git a/usr/sbin/maniacs-setup b/usr/sbin/maniacs-setup
index a8c84bd..4848fe3 100755
--- a/usr/sbin/maniacs-setup
+++ b/usr/sbin/maniacs-setup
@@ -430,6 +430,18 @@ login_maas_admin() {
(( TRIES_LEFT-- )) || true
sleep 3
done
+ if [[ "$TRIES_LEFT" -le 0 ]] ; then
+ # $TRIES_LEFT login failures in a row. Something is wrong, so
+ # try again without redirecting to /dev/null to try to get
+ # debugging info, then terminate the script if that fails.
+ maas login admin "$MAAS_URL" "$APIKEY"
+ RETURN_CODE=$?
+ if [[ "$RETURN_CODE" != 0 ]] ; then
+ echo "Too many failed login attempts; something is wrong!"
+ echo "Script is terminating."
+ exit 1
+ fi
+ fi
set -e
ensure_running
}
Follow ups