]> git.ipfire.org Git - thirdparty/libvirt.git/commit
systemd: Support merging multiple units
authorAndrea Bolognani <abologna@redhat.com>
Thu, 28 Sep 2023 09:39:23 +0000 (11:39 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 25 Oct 2023 09:42:19 +0000 (11:42 +0200)
commitb1aeca5db0f6643dfe53880559dcf512bc940dda
tree1e86a5ac5e5651bd2526602683dd5957e31d128a
parent9b268343052d13d320180c1099a97eab1ea4ab12
systemd: Support merging multiple units

In order to further deduplicate the contents of the various unit
files, we need to be able to merge multiple additional units
into the initial one.

Luckily the merge logic is in no way constrained to working with
just two units, so achieving this is pretty much just a matter
of lifting the existing limitation on the number of arguments
that the script accepts.

As a special case, it's now also possible to call the script
with just the base unit as argument. No merging will be performed
in that case, obviously, but we'll still go through the basic
validation and cleanup steps.

This also fixes a bug in the check for the number of arguments:
sys.argv also contains the name of the script, so we should have
checked that its size was at least 3. The check is now written in
a way that's less prone to misunderstandings.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
scripts/merge-systemd-units.py