add commissioning script

Change-Id: I5aadcee07b4eefccdf5666fa024d87f2f4e86eb5
This commit is contained in:
Wahlstedt, Walter (ww229g) 2023-05-15 12:00:01 -04:00
parent 003f7bf702
commit 565d20ee18
2 changed files with 25 additions and 2 deletions

View File

@ -15,7 +15,7 @@
apiVersion: v1 apiVersion: v1
description: Chart to run Canonical MaaS description: Chart to run Canonical MaaS
name: maas name: maas
version: 0.1.3 version: 0.1.4
home: https://docs.ubuntu.com/maas home: https://docs.ubuntu.com/maas
sources: sources:
- https://git.launchpad.net/maas - https://git.launchpad.net/maas

View File

@ -192,6 +192,28 @@ function configure_boot_sources {
fi fi
} }
function create_extra_commissioning_script {
cat > /tmp/script.sh << 'EOF'
#!/bin/bash
set -e
output=""
for net_iface in /sys/class/net/ens*
do
if [ -z "$output" ]; then output="{"; else output+=","; fi
output+=" \"$(basename "$net_iface")\": \"$(udevadm test-builtin net_id "$net_iface" 2>/dev/null | grep ID_NET_NAME_PATH | awk -F '=' '{print $2}')\""
done
if [ -z "$output" ]; then output="{}"; else output+=" }"; fi
echo $output
EOF
maas "${ADMIN_USERNAME}" commissioning-scripts create name='99-netiface-names.sh' content@=/tmp/script.sh
rm /tmp/script.sh
}
function configure_extra_settings { function configure_extra_settings {
{{- range $k, $v := .Values.conf.maas.extra_settings }} {{- range $k, $v := .Values.conf.maas.extra_settings }}
check_then_set {{$k}} {{$v}} check_then_set {{$k}} {{$v}}
@ -217,6 +239,7 @@ configure_ntp
configure_dns configure_dns
configure_syslog configure_syslog
configure_extra_settings configure_extra_settings
create_extra_commissioning_script
# make call to import images # make call to import images
timer "$RETRY_TIMER" configure_boot_sources timer "$RETRY_TIMER" configure_boot_sources