Skip to content

Commit

Permalink
Merge pull request avocado-framework#3566 from lkotek/scratch-package…
Browse files Browse the repository at this point in the history
…-installation

unattended_install: allow pkgs installation and locking
  • Loading branch information
luckyh authored Dec 16, 2022
2 parents e0fc4a9 + e5b4a4d commit 04abeca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions virttest/shared/unattended/RHEL-8-devel.ks
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ KVM_TEST_REPOS
python3-pillow
python3-six
python3-pyparsing
python3-dnf-plugin-versionlock
net-tools
NetworkManager
dconf
Expand Down Expand Up @@ -107,5 +108,22 @@ EOF
cat >> '/home/test/.bashrc' << EOF
alias shutdown='sudo shutdown'
EOF
# Install and lock packages specified via 'kickstart_instlock_pkgs' parameter
install_and_lock()
{
for PKG in KVM_TEST_PKGS; do
ECHO "dnf install $PKG -y --nogpgcheck"
dnf install $PKG -y --nogpgcheck
if [ $? -ne 0 ]; then
ECHO "$PKG installation failed."
fi
ECHO "dnf versionlock add $PKG"
dnf versionlock add $PKG
if [ $? -ne 0 ]; then
ECHO "$PKG version lock failed."
fi
done
}
install_and_lock
ECHO 'Post set up finished'
%end
7 changes: 7 additions & 0 deletions virttest/tests/unattended_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@ def answer_kickstart(self, answer_path):
content = "\n".join(lines)
contents = re.sub(dummy_repos_re, content, contents)

dummy_pkgs_re = r'\bKVM_TEST_PKGS\b'
if re.search(dummy_pkgs_re, contents):
# Extra packages to be installed and locked
# Use space as a separator for multiple pkgs
pkgs = self.params.get("kickstart_instlock_pkgs", "")
contents = re.sub(dummy_pkgs_re, pkgs, contents)

dummy_logging_re = r'\bKVM_TEST_LOGGING\b'
if re.search(dummy_logging_re, contents):
if self.syslog_server_enabled == 'yes':
Expand Down

0 comments on commit 04abeca

Please sign in to comment.