Cannot upload node-script - complains about missing shebang

I am trying to upload a custom commissioning script, and yes it starts with a shebang (#!/bin/bash) but the CLI is telling me it doesn’t. I even tried with an example from the docs, and same result. Can anyone assist? I am using MAAS v3.2.6

user@machine:~$ cat test.sh
#!/bin/bash

# --- Start MAAS 1.0 script metadata ---
# name: example
# parallel: instance
# parameters:
#   storage:
#     type: storage
#     argument-format: '{model}' '{serial}'
# --- End MAAS 1.0 script metadata ---

echo "Model: $1"
echo "Serial: $2"
user@machine:~$ sudo maas wr node-scripts create name=test script=test.sh type=commissioning
{"script": ["Must start with shebang."]}

that’s weird. i moved this one to the “Users” category so more people will see it.

2 Likes

There are two errors in this script:

  1. either use the property name or use the CLI parameter name, you cannot override command line parameters in the YAML
  2. your argument-format is not a valid YAML value, use '{model} {serial}' instead

Also the command line is not correct:

sudo maas wr node-scripts create name=test script@=test.sh type=commissioning

Notice the @= operator, you want to send to file contents, not its name

You’re the best! Thank you.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.