debian-forge-composer/tools
Tomas Hozza 1a3cbb282a image-info: Add workaround for listing services by status
`image-info` tools parses output of `systemctl list-unit-files` run on a
different tree (with `--root` option), to determine the list of enabled
and disabled services on the inspected image. However since Fedora 33
(and presumably since systemd v246), the output of `systemctl
list-unit-files` changed. Some units previously reported as "enabled" or
"disabled" are now reported as "alias", which means, that they are just
a symlink to a different unit.

There is no systemd command, that would take an "alias" unit and would
report its state as "enabled" or "disabled" and could run on a different
tree (with "--root" option).

To make the list of reported services in the given state consistent on
systems with older and new (v246+) systemd version, check all "alias"
units and append them to the list of services with a specific status,
if their target is also listed in in the list.

Example of the `systemctl list-unit-files` output change:

~]# rpm -q systemd
systemd-246.6-3.fc33.x86_64
~]# systemctl list-unit-files ctrl-alt-del.target
UNIT FILE           STATE VENDOR PRESET
ctrl-alt-del.target alias -

~]# rpm -q systemd
systemd-245.8-2.fc32.x86_64
~]# systemctl list-unit-files ctrl-alt-del.target
UNIT FILE           STATE   VENDOR PRESET
ctrl-alt-del.target enabled disabled

This change makes it possible to produce consistent output for an
inspected image, regardless if the `image-info` tool is run on Fedora
32, Fedora 33 or RHEL-8.

Also regenerate all Fedora 33 test cases, since this commit changes the
content of produced list of enabled / disabled services since Fedora 33.
The list is now consistent with what would be produced by `image-info`
for an image on older Fedora (e.g. 32) or RHEL-8.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-01 11:22:57 +01:00
..
deploy tools: Add script to generate all test cases in VMs 2021-02-01 10:22:28 +01:00
test-case-generators tools: Add script to generate all test cases in VMs 2021-02-01 10:22:28 +01:00
clouddot_build_deploy.sh tools: add delpoy script for clouddot 2020-12-22 15:27:39 +01:00
deploy-openstack tools: add deploy-openstack 2020-10-20 15:43:30 +02:00
deploy-qemu tools: Fix checking of args number in deploy-qemu 2021-01-11 10:33:51 +01:00
gen-certs.sh tools: Add internal container names to certs 2021-01-30 13:20:11 +00:00
gen-user-data tools/gen-user-data: don't depend on python3-pyyaml 2020-11-24 13:08:44 +01:00
image-info image-info: Add workaround for listing services by status 2021-02-01 11:22:57 +01:00
koji-compose.py kojiapi: support multi-build composes 2020-11-11 18:16:42 +01:00
libvirt_test.sh tests: move the libvirt test logic out of Jenkinsfile 2020-12-02 08:44:33 +01:00
prepare-source.sh tools/prepare-source: also call go generate ./... 2020-09-08 20:40:08 +02:00
provision.sh tools: Separate cert generation into its own script 2021-01-30 13:20:11 +00:00
run-koji-container.sh koji/test: use our quay mirror of the postgres container 2020-11-09 11:10:07 +01:00