From 0542fe56a0ed29d21079253c5a3aac3a79ecd20a Mon Sep 17 00:00:00 2001 From: Milan Lysonek Date: Tue, 6 Aug 2024 14:09:52 +0200 Subject: [PATCH] Replace Kickstart add_packages/add_packages_group with append --- hardening/anaconda/test.py | 2 +- hardening/ansible/test.py | 2 +- hardening/oscap/test.py | 2 +- lib/virt.py | 8 +------- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hardening/anaconda/test.py b/hardening/anaconda/test.py index dc38b69..ed92af3 100755 --- a/hardening/anaconda/test.py +++ b/hardening/anaconda/test.py @@ -16,7 +16,7 @@ ks = virt.translate_ssg_kickstart(profile) if os.environ.get('USE_SERVER_WITH_GUI'): - ks.add_package_group('Server with GUI') + ks.packages.append('@Server with GUI') # host a HTTP server with a datastream and let the guest download it with util.BackgroundHTTPServer(virt.NETWORK_HOST, 0) as srv: diff --git a/hardening/ansible/test.py b/hardening/ansible/test.py index d05d8d8..3e73a59 100755 --- a/hardening/ansible/test.py +++ b/hardening/ansible/test.py @@ -21,7 +21,7 @@ if not g.can_be_snapshotted(): ks = virt.Kickstart(partitions=partitions.partitions) if use_gui: - ks.add_package_group('Server with GUI') + ks.packages.append('@Server with GUI') g.install(kickstart=ks) g.prepare_for_snapshot() diff --git a/hardening/oscap/test.py b/hardening/oscap/test.py index b15ac91..30f6149 100755 --- a/hardening/oscap/test.py +++ b/hardening/oscap/test.py @@ -20,7 +20,7 @@ if not g.can_be_snapshotted(): ks = virt.Kickstart(partitions=partitions.partitions) if use_gui: - ks.add_package_group('Server with GUI') + ks.packages.append('@Server with GUI') g.install(kickstart=ks) g.prepare_for_snapshot() diff --git a/lib/virt.py b/lib/virt.py index 383c182..eae08fb 100644 --- a/lib/virt.py +++ b/lib/virt.py @@ -294,12 +294,6 @@ def add_post(self, content): 'set -xe; exec >/dev/tty 2>&1\n' + content + '\n%end') self.append(new) - def add_packages(self, pkgs): - self.packages += pkgs - - def add_package_group(self, group): - self.packages.append(f'@{group}') - def add_install_only_repo(self, name, baseurl): self.appends.append(f'repo --name={name} --baseurl={baseurl}') @@ -435,7 +429,7 @@ def install(self, location=None, kickstart=None, rpmpack=None, disk_format='raw' 'contest-rpmpack', f'http://{http_host}:{http_port}/repo', ) - kickstart.add_packages([util.RpmPack.NAME]) + kickstart.packages.append(util.RpmPack.NAME) ksfile = stack.enter_context(kickstart.to_tmpfile())