From 15969e0adcedf60fbdade80d2debc10af8862b33 Mon Sep 17 00:00:00 2001 From: Jacob Kozol Date: Tue, 12 Jan 2021 16:17:46 +0100 Subject: [PATCH] distro/{rhel8,rhel84}: set systemd default targets An image only had a systemd stage added if its blueprint contained services or if its image type contained enabled services. The systemd stage is now also added if the image type contains disabled services or a default target. The RHEL 8.4 qcow2 image type now specifies the multi-user default target. In order to test this the image-info tool now includes the default target in its output. Image test manifests are updated to include this change. --- internal/distro/rhel8/distro.go | 2 +- internal/distro/rhel84/distro.go | 3 ++- test/data/manifests/fedora_32-aarch64-ami-boot.json | 1 + test/data/manifests/fedora_32-aarch64-openstack-boot.json | 1 + test/data/manifests/fedora_32-aarch64-qcow2-boot.json | 1 + test/data/manifests/fedora_32-x86_64-ami-boot.json | 1 + .../fedora_32-x86_64-fedora_iot_commit-boot.json | 1 + test/data/manifests/fedora_32-x86_64-openstack-boot.json | 1 + test/data/manifests/fedora_32-x86_64-qcow2-boot.json | 1 + test/data/manifests/fedora_32-x86_64-qcow2-customize.json | 1 + test/data/manifests/fedora_32-x86_64-vhd-boot.json | 1 + test/data/manifests/fedora_32-x86_64-vmdk-boot.json | 1 + test/data/manifests/fedora_33-aarch64-ami-boot.json | 1 + test/data/manifests/fedora_33-x86_64-ami-boot.json | 1 + .../fedora_33-x86_64-fedora_iot_commit-boot.json | 1 + test/data/manifests/fedora_33-x86_64-openstack-boot.json | 1 + test/data/manifests/fedora_33-x86_64-qcow2-boot.json | 1 + test/data/manifests/fedora_33-x86_64-qcow2-customize.json | 1 + test/data/manifests/fedora_33-x86_64-vhd-boot.json | 1 + test/data/manifests/fedora_33-x86_64-vmdk-boot.json | 1 + test/data/manifests/rhel_8-aarch64-ami-boot.json | 7 +++++++ test/data/manifests/rhel_8-aarch64-openstack-boot.json | 1 + test/data/manifests/rhel_8-aarch64-qcow2-boot.json | 1 + .../manifests/rhel_8-aarch64-rhel_edge_commit-boot.json | 1 + test/data/manifests/rhel_8-ppc64le-qcow2-boot.json | 1 + test/data/manifests/rhel_8-s390x-qcow2-boot.json | 1 + test/data/manifests/rhel_8-x86_64-ami-boot.json | 7 +++++++ test/data/manifests/rhel_8-x86_64-openstack-boot.json | 1 + test/data/manifests/rhel_8-x86_64-qcow2-boot.json | 1 + test/data/manifests/rhel_8-x86_64-qcow2-customize.json | 1 + .../manifests/rhel_8-x86_64-rhel_edge_commit-boot.json | 1 + test/data/manifests/rhel_8-x86_64-tar-boot.json | 1 + test/data/manifests/rhel_8-x86_64-vhd-boot.json | 1 + test/data/manifests/rhel_8-x86_64-vmdk-boot.json | 1 + test/data/manifests/rhel_84-x86_64-ami-boot.json | 7 +++++++ test/data/manifests/rhel_84-x86_64-openstack-boot.json | 1 + test/data/manifests/rhel_84-x86_64-qcow2-boot.json | 7 +++++++ test/data/manifests/rhel_84-x86_64-qcow2-customize.json | 4 +++- test/data/manifests/rhel_84-x86_64-vhd-boot.json | 1 + test/data/manifests/rhel_84-x86_64-vmdk-boot.json | 1 + tools/image-info | 8 ++++++++ 41 files changed, 75 insertions(+), 3 deletions(-) diff --git a/internal/distro/rhel8/distro.go b/internal/distro/rhel8/distro.go index b76a721ba..5b3076bfc 100644 --- a/internal/distro/rhel8/distro.go +++ b/internal/distro/rhel8/distro.go @@ -288,7 +288,7 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewUsersStage(options)) } - if services := c.GetServices(); services != nil || t.enabledServices != nil { + if services := c.GetServices(); services != nil || t.enabledServices != nil || t.disabledServices != nil || t.defaultTarget != "" { p.AddStage(osbuild.NewSystemdStage(t.systemdStageOptions(t.enabledServices, t.disabledServices, services, t.defaultTarget))) } diff --git a/internal/distro/rhel84/distro.go b/internal/distro/rhel84/distro.go index 6b2bff5c7..777d9b037 100644 --- a/internal/distro/rhel84/distro.go +++ b/internal/distro/rhel84/distro.go @@ -315,7 +315,7 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewUsersStage(options)) } - if services := c.GetServices(); services != nil || t.enabledServices != nil { + if services := c.GetServices(); services != nil || t.enabledServices != nil || t.disabledServices != nil || t.defaultTarget != "" { p.AddStage(osbuild.NewSystemdStage(t.systemdStageOptions(t.enabledServices, t.disabledServices, services, t.defaultTarget))) } @@ -958,6 +958,7 @@ func New() distro.Distro { // https://errata.devel.redhat.com/advisory/47339 lands "timedatex", }, + defaultTarget: "multi-user.target", kernelOptions: "console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto", bootable: true, defaultSize: 10 * GigaByte, diff --git a/test/data/manifests/fedora_32-aarch64-ami-boot.json b/test/data/manifests/fedora_32-aarch64-ami-boot.json index 78650e0c6..dd6c7559a 100644 --- a/test/data/manifests/fedora_32-aarch64-ami-boot.json +++ b/test/data/manifests/fedora_32-aarch64-ami-boot.json @@ -8902,6 +8902,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=46BB-8120", diff --git a/test/data/manifests/fedora_32-aarch64-openstack-boot.json b/test/data/manifests/fedora_32-aarch64-openstack-boot.json index aa6058247..54ab8cc7c 100644 --- a/test/data/manifests/fedora_32-aarch64-openstack-boot.json +++ b/test/data/manifests/fedora_32-aarch64-openstack-boot.json @@ -9252,6 +9252,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=46BB-8120", diff --git a/test/data/manifests/fedora_32-aarch64-qcow2-boot.json b/test/data/manifests/fedora_32-aarch64-qcow2-boot.json index 4c10782f3..bc874f873 100644 --- a/test/data/manifests/fedora_32-aarch64-qcow2-boot.json +++ b/test/data/manifests/fedora_32-aarch64-qcow2-boot.json @@ -8754,6 +8754,7 @@ "version": "5.6.6-300.fc32.aarch64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=46BB-8120", diff --git a/test/data/manifests/fedora_32-x86_64-ami-boot.json b/test/data/manifests/fedora_32-x86_64-ami-boot.json index 8032a7ab4..a5f9f51b4 100644 --- a/test/data/manifests/fedora_32-x86_64-ami-boot.json +++ b/test/data/manifests/fedora_32-x86_64-ami-boot.json @@ -9160,6 +9160,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json b/test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json index 95c57ba75..f6bc7adb0 100644 --- a/test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json +++ b/test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json @@ -10135,6 +10135,7 @@ } }, "image-info": { + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "mdns", diff --git a/test/data/manifests/fedora_32-x86_64-openstack-boot.json b/test/data/manifests/fedora_32-x86_64-openstack-boot.json index 9d40eabc8..e2abb4316 100644 --- a/test/data/manifests/fedora_32-x86_64-openstack-boot.json +++ b/test/data/manifests/fedora_32-x86_64-openstack-boot.json @@ -9510,6 +9510,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_32-x86_64-qcow2-boot.json b/test/data/manifests/fedora_32-x86_64-qcow2-boot.json index 97d3da4e0..a9a0aa282 100644 --- a/test/data/manifests/fedora_32-x86_64-qcow2-boot.json +++ b/test/data/manifests/fedora_32-x86_64-qcow2-boot.json @@ -9114,6 +9114,7 @@ "version": "5.6.6-300.fc32.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_32-x86_64-qcow2-customize.json b/test/data/manifests/fedora_32-x86_64-qcow2-customize.json index dcf47b9af..c204bad20 100644 --- a/test/data/manifests/fedora_32-x86_64-qcow2-customize.json +++ b/test/data/manifests/fedora_32-x86_64-qcow2-customize.json @@ -9217,6 +9217,7 @@ "version": "5.6.6-300.fc32.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_32-x86_64-vhd-boot.json b/test/data/manifests/fedora_32-x86_64-vhd-boot.json index 54524d999..486ebd700 100644 --- a/test/data/manifests/fedora_32-x86_64-vhd-boot.json +++ b/test/data/manifests/fedora_32-x86_64-vhd-boot.json @@ -8761,6 +8761,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_32-x86_64-vmdk-boot.json b/test/data/manifests/fedora_32-x86_64-vmdk-boot.json index 5a3f6d992..3f41ad8ac 100644 --- a/test/data/manifests/fedora_32-x86_64-vmdk-boot.json +++ b/test/data/manifests/fedora_32-x86_64-vmdk-boot.json @@ -8867,6 +8867,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-aarch64-ami-boot.json b/test/data/manifests/fedora_33-aarch64-ami-boot.json index f04960cbf..029c829d5 100644 --- a/test/data/manifests/fedora_33-aarch64-ami-boot.json +++ b/test/data/manifests/fedora_33-aarch64-ami-boot.json @@ -9822,6 +9822,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=46BB-8120", diff --git a/test/data/manifests/fedora_33-x86_64-ami-boot.json b/test/data/manifests/fedora_33-x86_64-ami-boot.json index 884c3c222..825e37472 100644 --- a/test/data/manifests/fedora_33-x86_64-ami-boot.json +++ b/test/data/manifests/fedora_33-x86_64-ami-boot.json @@ -9401,6 +9401,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-x86_64-fedora_iot_commit-boot.json b/test/data/manifests/fedora_33-x86_64-fedora_iot_commit-boot.json index 13aa93074..ca77d2257 100644 --- a/test/data/manifests/fedora_33-x86_64-fedora_iot_commit-boot.json +++ b/test/data/manifests/fedora_33-x86_64-fedora_iot_commit-boot.json @@ -10577,6 +10577,7 @@ } }, "image-info": { + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "mdns", diff --git a/test/data/manifests/fedora_33-x86_64-openstack-boot.json b/test/data/manifests/fedora_33-x86_64-openstack-boot.json index 3622e9978..b332bade7 100644 --- a/test/data/manifests/fedora_33-x86_64-openstack-boot.json +++ b/test/data/manifests/fedora_33-x86_64-openstack-boot.json @@ -9716,6 +9716,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-x86_64-qcow2-boot.json b/test/data/manifests/fedora_33-x86_64-qcow2-boot.json index df4abd99f..82db9e53e 100644 --- a/test/data/manifests/fedora_33-x86_64-qcow2-boot.json +++ b/test/data/manifests/fedora_33-x86_64-qcow2-boot.json @@ -9289,6 +9289,7 @@ "version": "5.8.15-301.fc33.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-x86_64-qcow2-customize.json b/test/data/manifests/fedora_33-x86_64-qcow2-customize.json index b24aadcd1..ac9d7a327 100644 --- a/test/data/manifests/fedora_33-x86_64-qcow2-customize.json +++ b/test/data/manifests/fedora_33-x86_64-qcow2-customize.json @@ -9387,6 +9387,7 @@ "version": "5.8.15-301.fc33.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-x86_64-vhd-boot.json b/test/data/manifests/fedora_33-x86_64-vhd-boot.json index 8f3441aea..605acb153 100644 --- a/test/data/manifests/fedora_33-x86_64-vhd-boot.json +++ b/test/data/manifests/fedora_33-x86_64-vhd-boot.json @@ -9002,6 +9002,7 @@ "mdns", "dhcpv6-client" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/fedora_33-x86_64-vmdk-boot.json b/test/data/manifests/fedora_33-x86_64-vmdk-boot.json index 94b2d8e95..0e07e87b7 100644 --- a/test/data/manifests/fedora_33-x86_64-vmdk-boot.json +++ b/test/data/manifests/fedora_33-x86_64-vmdk-boot.json @@ -9289,6 +9289,7 @@ "version": "5.8.15-301.fc33.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac", diff --git a/test/data/manifests/rhel_8-aarch64-ami-boot.json b/test/data/manifests/rhel_8-aarch64-ami-boot.json index baf6ea176..76d2b4ad6 100644 --- a/test/data/manifests/rhel_8-aarch64-ami-boot.json +++ b/test/data/manifests/rhel_8-aarch64-ami-boot.json @@ -3157,6 +3157,12 @@ "language": "en_US" } }, + { + "name": "org.osbuild.systemd", + "options": { + "default_target": "multi-user.target" + } + }, { "name": "org.osbuild.selinux", "options": { @@ -8724,6 +8730,7 @@ "version": "4.18.0-221.el8.aarch64" } ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-aarch64-openstack-boot.json b/test/data/manifests/rhel_8-aarch64-openstack-boot.json index de08c58a1..7d53a8ab1 100644 --- a/test/data/manifests/rhel_8-aarch64-openstack-boot.json +++ b/test/data/manifests/rhel_8-aarch64-openstack-boot.json @@ -9296,6 +9296,7 @@ "dhcpv6-client", "cockpit" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-aarch64-qcow2-boot.json b/test/data/manifests/rhel_8-aarch64-qcow2-boot.json index 7b64a6057..33bde9f41 100644 --- a/test/data/manifests/rhel_8-aarch64-qcow2-boot.json +++ b/test/data/manifests/rhel_8-aarch64-qcow2-boot.json @@ -9495,6 +9495,7 @@ "version": "4.18.0-221.el8.aarch64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json b/test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json index 68ab1b69b..919c57e44 100644 --- a/test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json +++ b/test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json @@ -8206,6 +8206,7 @@ } }, "image-info": { + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "dhcpv6-client", diff --git a/test/data/manifests/rhel_8-ppc64le-qcow2-boot.json b/test/data/manifests/rhel_8-ppc64le-qcow2-boot.json index 1c5e7e67d..a6c92d087 100644 --- a/test/data/manifests/rhel_8-ppc64le-qcow2-boot.json +++ b/test/data/manifests/rhel_8-ppc64le-qcow2-boot.json @@ -10254,6 +10254,7 @@ "version": "4.18.0-221.el8.ppc64le" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-s390x-qcow2-boot.json b/test/data/manifests/rhel_8-s390x-qcow2-boot.json index 66dcedf59..e64a19c9e 100644 --- a/test/data/manifests/rhel_8-s390x-qcow2-boot.json +++ b/test/data/manifests/rhel_8-s390x-qcow2-boot.json @@ -10209,6 +10209,7 @@ "version": "4.18.0-193.el8.s390x" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-ami-boot.json b/test/data/manifests/rhel_8-x86_64-ami-boot.json index 95fbc019d..91a181b23 100644 --- a/test/data/manifests/rhel_8-x86_64-ami-boot.json +++ b/test/data/manifests/rhel_8-x86_64-ami-boot.json @@ -3156,6 +3156,12 @@ "language": "en_US" } }, + { + "name": "org.osbuild.systemd", + "options": { + "default_target": "multi-user.target" + } + }, { "name": "org.osbuild.selinux", "options": { @@ -8731,6 +8737,7 @@ "version": "4.18.0-221.el8.x86_64" } ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-openstack-boot.json b/test/data/manifests/rhel_8-x86_64-openstack-boot.json index da5bfe480..9a1d7ecd3 100644 --- a/test/data/manifests/rhel_8-x86_64-openstack-boot.json +++ b/test/data/manifests/rhel_8-x86_64-openstack-boot.json @@ -9329,6 +9329,7 @@ "dhcpv6-client", "cockpit" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-qcow2-boot.json b/test/data/manifests/rhel_8-x86_64-qcow2-boot.json index 5177c8152..c522caff2 100644 --- a/test/data/manifests/rhel_8-x86_64-qcow2-boot.json +++ b/test/data/manifests/rhel_8-x86_64-qcow2-boot.json @@ -9498,6 +9498,7 @@ "version": "4.18.0-221.el8.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-qcow2-customize.json b/test/data/manifests/rhel_8-x86_64-qcow2-customize.json index 0e9aa0de9..eee11ba1c 100644 --- a/test/data/manifests/rhel_8-x86_64-qcow2-customize.json +++ b/test/data/manifests/rhel_8-x86_64-qcow2-customize.json @@ -9586,6 +9586,7 @@ "version": "4.18.0-221.el8.x86_64" } ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json b/test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json index 0c38301bf..37fcfb29a 100644 --- a/test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json +++ b/test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json @@ -8502,6 +8502,7 @@ } }, "image-info": { + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "dhcpv6-client", diff --git a/test/data/manifests/rhel_8-x86_64-tar-boot.json b/test/data/manifests/rhel_8-x86_64-tar-boot.json index 243ab432c..62c1c6248 100644 --- a/test/data/manifests/rhel_8-x86_64-tar-boot.json +++ b/test/data/manifests/rhel_8-x86_64-tar-boot.json @@ -5431,6 +5431,7 @@ }, "image-info": { "bootmenu": [], + "default-target": "graphical.target", "groups": [ "adm:x:4:", "audio:x:63:", diff --git a/test/data/manifests/rhel_8-x86_64-vhd-boot.json b/test/data/manifests/rhel_8-x86_64-vhd-boot.json index 987dbcfc8..b52f0d6b8 100644 --- a/test/data/manifests/rhel_8-x86_64-vhd-boot.json +++ b/test/data/manifests/rhel_8-x86_64-vhd-boot.json @@ -9240,6 +9240,7 @@ "dhcpv6-client", "cockpit" ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_8-x86_64-vmdk-boot.json b/test/data/manifests/rhel_8-x86_64-vmdk-boot.json index eaee4fdc6..191751651 100644 --- a/test/data/manifests/rhel_8-x86_64-vmdk-boot.json +++ b/test/data/manifests/rhel_8-x86_64-vmdk-boot.json @@ -8966,6 +8966,7 @@ "dhcpv6-client", "cockpit" ], + "default-target": "graphical.target", "fstab": [ [ "UUID=0bd700f8-090f-4556-b797-b340297ea1bd", diff --git a/test/data/manifests/rhel_84-x86_64-ami-boot.json b/test/data/manifests/rhel_84-x86_64-ami-boot.json index ca7299b54..81b1c2965 100644 --- a/test/data/manifests/rhel_84-x86_64-ami-boot.json +++ b/test/data/manifests/rhel_84-x86_64-ami-boot.json @@ -3103,6 +3103,12 @@ "zone": "America/New_York" } }, + { + "name": "org.osbuild.systemd", + "options": { + "default_target": "multi-user.target" + } + }, { "name": "org.osbuild.selinux", "options": { @@ -8611,6 +8617,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0194fdc2-fa2f-4cc0-81d3-ff12045b73c8", diff --git a/test/data/manifests/rhel_84-x86_64-openstack-boot.json b/test/data/manifests/rhel_84-x86_64-openstack-boot.json index 7b527baec..5b0d144d0 100644 --- a/test/data/manifests/rhel_84-x86_64-openstack-boot.json +++ b/test/data/manifests/rhel_84-x86_64-openstack-boot.json @@ -9193,6 +9193,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "dhcpv6-client", diff --git a/test/data/manifests/rhel_84-x86_64-qcow2-boot.json b/test/data/manifests/rhel_84-x86_64-qcow2-boot.json index 99afd65e4..3103f6780 100644 --- a/test/data/manifests/rhel_84-x86_64-qcow2-boot.json +++ b/test/data/manifests/rhel_84-x86_64-qcow2-boot.json @@ -3481,6 +3481,12 @@ } } }, + { + "name": "org.osbuild.systemd", + "options": { + "default_target": "multi-user.target" + } + }, { "name": "org.osbuild.selinux", "options": { @@ -9529,6 +9535,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0194fdc2-fa2f-4cc0-81d3-ff12045b73c8", diff --git a/test/data/manifests/rhel_84-x86_64-qcow2-customize.json b/test/data/manifests/rhel_84-x86_64-qcow2-customize.json index 3dc436645..82fd702e7 100644 --- a/test/data/manifests/rhel_84-x86_64-qcow2-customize.json +++ b/test/data/manifests/rhel_84-x86_64-qcow2-customize.json @@ -3582,7 +3582,8 @@ ], "disabled_services": [ "bluetooth.service" - ] + ], + "default_target": "multi-user.target" } }, { @@ -9633,6 +9634,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "multi-user.target", "fstab": [ [ "UUID=0194fdc2-fa2f-4cc0-81d3-ff12045b73c8", diff --git a/test/data/manifests/rhel_84-x86_64-vhd-boot.json b/test/data/manifests/rhel_84-x86_64-vhd-boot.json index e83c26863..d987d4682 100644 --- a/test/data/manifests/rhel_84-x86_64-vhd-boot.json +++ b/test/data/manifests/rhel_84-x86_64-vhd-boot.json @@ -9104,6 +9104,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "multi-user.target", "firewall-enabled": [ "ssh", "dhcpv6-client", diff --git a/test/data/manifests/rhel_84-x86_64-vmdk-boot.json b/test/data/manifests/rhel_84-x86_64-vmdk-boot.json index da56828c7..809624674 100644 --- a/test/data/manifests/rhel_84-x86_64-vmdk-boot.json +++ b/test/data/manifests/rhel_84-x86_64-vmdk-boot.json @@ -8740,6 +8740,7 @@ "version": "4.18.0-240.4.el8.x86_64" } ], + "default-target": "graphical.target", "firewall-enabled": [ "ssh", "dhcpv6-client", diff --git a/tools/image-info b/tools/image-info index 8d682d3f3..cb4e548be 100755 --- a/tools/image-info +++ b/tools/image-info @@ -269,6 +269,10 @@ def read_services(tree, state): return subprocess_check_output(["systemctl", f"--root={tree}", "list-unit-files"], (lambda s: parse_unit_files(s, state))) +def read_default_target(tree): + return subprocess_check_output(["systemctl", f"--root={tree}", "get-default"]).rstrip() + + def read_firewall_zone(tree): try: with open(f"{tree}/etc/firewalld/firewalld.conf") as f: @@ -309,6 +313,10 @@ def append_filesystem(report, tree, *, is_ostree=False): report["services-enabled"] = read_services(tree, "enabled") report["services-disabled"] = read_services(tree, "disabled") + default_target = read_default_target(tree) + if default_target: + report["default-target"] = default_target + with contextlib.suppress(FileNotFoundError): with open(f"{tree}/etc/hostname") as f: report["hostname"] = f.read().strip()