RFE: put the Rack address into the script environment

The SquashFS, which contains the root filesystem of the ephemeral environment, comes from the rack controller. This is defined on the kernel command line. The rack-controller-connectivity test gets the rack URL as follows:

# When booting into the ephemeral environment root is the retrieved from
# the rack controller.
for i in $(cat /proc/cmdline); do
    arg=$(echo $i | cut -d '=' -f1)
    if [ "$arg" == "root" ]; then
        value=$(echo $i | cut -d '=' -f2-)
        # MAAS normally specifies the file has "filetype:url"
        filetype=$(echo $value | cut -d ':' -f1)
        if [ "$filetype" == "squash" ]; then
            url=$(echo $value | cut -d ':' -f2-)
        else
            url=$filetype
        fi
        break
    fi
done

MAAS does not have a way to include arbitrary environmental variables however there are two ways to work around this.

  1. You can include a script which defines variables and sources it. Testing scripts tagged with commissioning run by default. Commissioning and testing scripts are stored in separate directories adding source ../testing/my-vars should work for a test script named my-vars to be included in both commissioning and testing scripts.
  2. MAAS 2.9 added support for string, password, and choice script parameters. MAAS does not currently have UI support, they are only available on the command line. These options are used by 30-maas-01-bmc-config to pass BMC parameters. I did a Show & Tell on this a few months back which shows how to create your own custom script.
1 Like