From e56d1112e44e0695d0862d80cdf2954f4d3c6f9f Mon Sep 17 00:00:00 2001 From: Steven Presti Date: Tue, 28 May 2024 15:11:47 -0400 Subject: [PATCH 1/3] */customize/*: shorten network interface names to 15 chars NetworkManager produces a warning if an interface name exceeds 15 chars, resulting in errors such as: 'failed to load connection: invalid connection 'nmstate-yaml-eth2': interface name is longer than 15 characters'. To reduce these warnings, update network interface names to ensure they are within this character limit. --- fixtures/customize/dest.bu | 8 ++++---- fixtures/customize/dest.ign | 2 +- fixtures/customize/installer-test-nmstate-json.json | 4 ++-- fixtures/customize/installer-test-nmstate-yaml.yaml | 4 ++-- fixtures/customize/live.bu | 8 ++++---- fixtures/customize/live.ign | 2 +- ...son-eth1.nmconnection => nmstate-js-eth1.nmconnection} | 0 ...son-eth2.nmconnection => nmstate-js-eth2.nmconnection} | 2 +- ...aml-eth1.nmconnection => nmstate-yl-eth1.nmconnection} | 2 +- ...aml-eth2.nmconnection => nmstate-yl-eth2.nmconnection} | 2 +- tests/images/customize.sh | 8 ++++---- 11 files changed, 21 insertions(+), 21 deletions(-) rename fixtures/customize/{nmstate-json-eth1.nmconnection => nmstate-js-eth1.nmconnection} (100%) rename fixtures/customize/{nmstate-json-eth2.nmconnection => nmstate-js-eth2.nmconnection} (69%) rename fixtures/customize/{nmstate-yaml-eth1.nmconnection => nmstate-yl-eth1.nmconnection} (69%) rename fixtures/customize/{nmstate-yaml-eth2.nmconnection => nmstate-yl-eth2.nmconnection} (69%) diff --git a/fixtures/customize/dest.bu b/fixtures/customize/dest.bu index 1e17035c9..c33a1819d 100644 --- a/fixtures/customize/dest.bu +++ b/fixtures/customize/dest.bu @@ -9,10 +9,10 @@ systemd: Description=Dest Ignition Applied Before=multi-user.target ConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection ConditionKernelCommandLine=install-config-karg-1 ConditionKernelCommandLine=install-config-karg-2 ConditionKernelCommandLine=dest-karg diff --git a/fixtures/customize/dest.ign b/fixtures/customize/dest.ign index fa60b6a83..37425d002 100644 --- a/fixtures/customize/dest.ign +++ b/fixtures/customize/dest.ign @@ -5,7 +5,7 @@ "systemd": { "units": [ { - "contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n", + "contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n", "enabled": true, "name": "dest-ignition-applied.service" } diff --git a/fixtures/customize/installer-test-nmstate-json.json b/fixtures/customize/installer-test-nmstate-json.json index a0bd86bcc..94dbc13f6 100644 --- a/fixtures/customize/installer-test-nmstate-json.json +++ b/fixtures/customize/installer-test-nmstate-json.json @@ -1,7 +1,7 @@ { "interfaces": [ { - "name": "nmstate-json-eth1", + "name": "nmstate-js-eth1", "type": "ethernet", "state": "up", "ipv4": { @@ -10,7 +10,7 @@ } }, { - "name": "nmstate-json-eth2", + "name": "nmstate-js-eth2", "type": "ethernet", "state": "up", "ipv4": { diff --git a/fixtures/customize/installer-test-nmstate-yaml.yaml b/fixtures/customize/installer-test-nmstate-yaml.yaml index d993d26d5..ffb29f3df 100644 --- a/fixtures/customize/installer-test-nmstate-yaml.yaml +++ b/fixtures/customize/installer-test-nmstate-yaml.yaml @@ -1,11 +1,11 @@ interfaces: - - name: nmstate-yaml-eth1 + - name: nmstate-yl-eth1 type: ethernet state: up ipv4: enabled: true dhcp: true - - name: nmstate-yaml-eth2 + - name: nmstate-yl-eth2 type: ethernet state: up ipv4: diff --git a/fixtures/customize/live.bu b/fixtures/customize/live.bu index 1845f7406..253d4c216 100644 --- a/fixtures/customize/live.bu +++ b/fixtures/customize/live.bu @@ -10,10 +10,10 @@ systemd: Before=coreos-installer.target Before=multi-user.target ConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection - ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection + ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection [Service] Type=oneshot diff --git a/fixtures/customize/live.ign b/fixtures/customize/live.ign index 57905ff74..d813129c1 100644 --- a/fixtures/customize/live.ign +++ b/fixtures/customize/live.ign @@ -5,7 +5,7 @@ "systemd": { "units": [ { - "contents": "[Unit]\nDescription=Live Ignition Applied\nBefore=coreos-installer.target\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/echo @applied-live-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=coreos-installer.target\nRequiredBy=multi-user.target\n", + "contents": "[Unit]\nDescription=Live Ignition Applied\nBefore=coreos-installer.target\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/echo @applied-live-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=coreos-installer.target\nRequiredBy=multi-user.target\n", "enabled": true, "name": "live-ignition-applied.service" }, diff --git a/fixtures/customize/nmstate-json-eth1.nmconnection b/fixtures/customize/nmstate-js-eth1.nmconnection similarity index 100% rename from fixtures/customize/nmstate-json-eth1.nmconnection rename to fixtures/customize/nmstate-js-eth1.nmconnection diff --git a/fixtures/customize/nmstate-json-eth2.nmconnection b/fixtures/customize/nmstate-js-eth2.nmconnection similarity index 69% rename from fixtures/customize/nmstate-json-eth2.nmconnection rename to fixtures/customize/nmstate-js-eth2.nmconnection index f2fcda14b..822f79270 100644 --- a/fixtures/customize/nmstate-json-eth2.nmconnection +++ b/fixtures/customize/nmstate-js-eth2.nmconnection @@ -1,5 +1,5 @@ [connection] -id=nmstate-json-eth2 +id=nmstate-js-eth2 type=ethernet [ipv4] diff --git a/fixtures/customize/nmstate-yaml-eth1.nmconnection b/fixtures/customize/nmstate-yl-eth1.nmconnection similarity index 69% rename from fixtures/customize/nmstate-yaml-eth1.nmconnection rename to fixtures/customize/nmstate-yl-eth1.nmconnection index b08878065..7f6c4128b 100644 --- a/fixtures/customize/nmstate-yaml-eth1.nmconnection +++ b/fixtures/customize/nmstate-yl-eth1.nmconnection @@ -1,5 +1,5 @@ [connection] -id=nmstate-yaml-eth1 +id=nmstate-yl-eth1 type=ethernet [ipv4] diff --git a/fixtures/customize/nmstate-yaml-eth2.nmconnection b/fixtures/customize/nmstate-yl-eth2.nmconnection similarity index 69% rename from fixtures/customize/nmstate-yaml-eth2.nmconnection rename to fixtures/customize/nmstate-yl-eth2.nmconnection index b3d472b06..63387cf75 100644 --- a/fixtures/customize/nmstate-yaml-eth2.nmconnection +++ b/fixtures/customize/nmstate-yl-eth2.nmconnection @@ -1,5 +1,5 @@ [connection] -id=nmstate-yaml-eth2 +id=nmstate-yl-eth2 type=ethernet [ipv4] diff --git a/tests/images/customize.sh b/tests/images/customize.sh index 61dc15be9..ae55a9307 100755 --- a/tests/images/customize.sh +++ b/tests/images/customize.sh @@ -278,19 +278,19 @@ coreos-installer pxe customize src-initrd -o initrd --network-keyfile "${fixtures}/installer-test.nmconnection" 2>&1 ||:) | grepq "already specifies keyfile" (iso_customize \ - --network-keyfile "${fixtures}/nmstate-json-eth1.nmconnection" \ + --network-keyfile "${fixtures}/nmstate-js-eth1.nmconnection" \ --network-nmstate "${fixtures}/installer-test-nmstate-json.json" 2>&1 ||:) | grepq "already specifies keyfile" (iso_customize \ - --network-keyfile "${fixtures}/nmstate-json-eth2.nmconnection" \ + --network-keyfile "${fixtures}/nmstate-js-eth2.nmconnection" \ --network-nmstate "${fixtures}/installer-test-nmstate-json.json" 2>&1 ||:) | grepq "already specifies keyfile" (iso_customize \ - --network-keyfile "${fixtures}/nmstate-yaml-eth1.nmconnection" \ + --network-keyfile "${fixtures}/nmstate-yl-eth1.nmconnection" \ --network-nmstate "${fixtures}/installer-test-nmstate-yaml.yaml" 2>&1 ||:) | grepq "already specifies keyfile" (iso_customize \ - --network-keyfile "${fixtures}/nmstate-yaml-eth2.nmconnection" \ + --network-keyfile "${fixtures}/nmstate-yl-eth2.nmconnection" \ --network-nmstate "${fixtures}/installer-test-nmstate-yaml.yaml" 2>&1 ||:) | grepq "already specifies keyfile" (iso_customize \ From a8c1f0c65d1b16bdf321189df9ca80ed7d2df707 Mon Sep 17 00:00:00 2001 From: Steven Presti Date: Wed, 29 May 2024 15:29:47 -0400 Subject: [PATCH 2/3] test/images/customize: add debug logic to give better feedback --- tests/images/customize.sh | 48 ++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/tests/images/customize.sh b/tests/images/customize.sh index ae55a9307..d03309184 100755 --- a/tests/images/customize.sh +++ b/tests/images/customize.sh @@ -145,28 +145,44 @@ qemu_disk() { } assert() { - grep -Fq "$1" log + if grep -Fq "$1" log; then + echo "Assertion passed: '$1' found in log" + return 0 + else + echo "Assertion failed: '$1' not found in log" + return 1 + fi +} + +assert_not() { + if grep -Fq "$1" log; then + echo "Assertion failed: '$1' found in log" + return 1 + else + echo "Assertion passed: '$1' not found in log" + return 0 + fi } check_live_noinstall() { assert @applied-live-ign@ assert @applied-live-2-ign@ - ! assert @applied-dest-ign@ - ! assert @applied-dest-2-ign@ + assert_not @applied-dest-ign@ + assert_not @applied-dest-2-ign@ assert @did-not-install@ - ! assert @preinst-1@ - ! assert @preinst-2@ - ! assert @postinst-1@ - ! assert @postinst-2@ + assert_not @preinst-1@ + assert_not @preinst-2@ + assert_not @postinst-1@ + assert_not @postinst-2@ assert 'Adding "coreos-installer test certificate" to list of CAs' } check_live_install() { assert @applied-live-ign@ assert @applied-live-2-ign@ - ! assert @applied-dest-ign@ - ! assert @applied-dest-2-ign@ - ! assert @did-not-install@ + assert_not @applied-dest-ign@ + assert_not @applied-dest-2-ign@ + assert_not @did-not-install@ assert @preinst-1@ assert @preinst-2@ assert @postinst-1@ @@ -175,14 +191,14 @@ check_live_install() { } check_dest() { - ! assert @applied-live-ign@ - ! assert @applied-live-2-ign@ + assert_not @applied-live-ign@ + assert_not @applied-live-2-ign@ assert @applied-dest-ign@ assert @applied-dest-2-ign@ - ! assert @preinst-1@ - ! assert @preinst-2@ - ! assert @postinst-1@ - ! assert @postinst-2@ + assert_not @preinst-1@ + assert_not @preinst-2@ + assert_not @postinst-1@ + assert_not @postinst-2@ assert 'Adding "coreos-installer test certificate" to list of CAs' } From 9e2933d59754456120a137b0437e8d595c42581f Mon Sep 17 00:00:00 2001 From: Steven Presti Date: Wed, 5 Jun 2024 15:48:05 -0400 Subject: [PATCH 3/3] fixtures/customize/dest: update unit to use console.cfg With the changeover to OSBuild, GRUB configs are handled slightly diffrently. Update butane and ignition files to reflect that. fixes #1479 --- fixtures/customize/dest.bu | 2 +- fixtures/customize/dest.ign | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fixtures/customize/dest.bu b/fixtures/customize/dest.bu index c33a1819d..139ee4c1b 100644 --- a/fixtures/customize/dest.bu +++ b/fixtures/customize/dest.bu @@ -23,7 +23,7 @@ systemd: [Service] Type=oneshot RemainAfterExit=true - ExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg + ExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/console.cfg ExecStart=/bin/echo @applied-dest-ign@ StandardOutput=tty diff --git a/fixtures/customize/dest.ign b/fixtures/customize/dest.ign index 37425d002..2f8f45852 100644 --- a/fixtures/customize/dest.ign +++ b/fixtures/customize/dest.ign @@ -5,7 +5,7 @@ "systemd": { "units": [ { - "contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n", + "contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/console.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n", "enabled": true, "name": "dest-ignition-applied.service" }