Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of empty command lists in Autoinstall YAML #2072

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions examples/autoinstall/empty-cmdlist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 1
locale: en_GB.UTF-8
network:
version: 2
ethernets:
all-eth:
match:
name: "en*"
dhcp6: yes
apt:
mirror-selection:
primary:
- uri: http://localhost/failed
fallback: offline-install
codecs:
install: true
identity:
realname: ''
username: ubuntu
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
hostname: ubuntu
early-commands:
# Command list purposely empty
late-commands:
# Command list purposely empty
12 changes: 12 additions & 0 deletions scripts/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ LANG=C.UTF-8 timeout --foreground 60 \
--source-catalog examples/sources/install.yaml
validate

clean
testname=autoinstall-empty-cmdlist
LANG=C.UTF-8 timeout --foreground 60 \
python3 -m subiquity.cmd.tui \
--dry-run \
--output-base "$tmpdir" \
--machine-config examples/machines/simple.json \
--autoinstall examples/autoinstall/empty-cmdlist.yaml \
--kernel-cmdline autoinstall \
--source-catalog examples/sources/install.yaml
validate

python3 -m subiquity.cmd.schema > $tmpdir/test-schema.json
diff -u "autoinstall-schema.json" $tmpdir/test-schema.json

Expand Down
2 changes: 2 additions & 0 deletions subiquity/server/controllers/cmdlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __init__(self, app):
self.run_event = asyncio.Event()

def load_autoinstall_data(self, data):
if data is None:
return
self.cmds = [Command(args=cmd, check=self.cmd_check) for cmd in data]

def env(self):
Expand Down
Loading