Skip to contentSkip to conversation

travis: fix kernel update check

PATCH Applied Ondrej Mosnacek 1 participant 2 messages Nov 2, 2020 – Nov 4, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 travis: fix kernel update check

We need to run ssh without -tt to get the correct output and also run dnf with -q to exclude the repo cache update lines. Also, ssh has trouble with quoting of arguments, so we need to pipe the command via stdin.

Moreover, dnf check-update doesn't seem to do what we need here. Rather use dnf -q info --avail, which is also more straightforward to use.

---
 travis-ci/run-kvm-test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
travis-ci/run-kvm-test.sh +3 -3
index 6afbf96..3c19df8 100755
@@ -123,9 +123,9 @@ fi
 
 # Check if kernel-modules-$(uname -r) can be installed from repos,
 # otherwise update kernel and reboot.
-kernel_avail="$(ssh -tt -o StrictHostKeyChecking=no -q "root@$ipaddy" \
-    sh -c "dnf check-update kernel-modules-\$(uname -r) | wc -l")"
-if [ $kernel_avail -eq 0 ]; then
+if ! echo "dnf -q info --available kernel-modules-\$(uname -r)" | \
+    ssh -o StrictHostKeyChecking=no -q "root@$ipaddy"
+then
     ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" \
         dnf update -y kernel-core
 
Signature · 1 line
2.26.2
author Applied
#1 lore raw
Quoted 31 lines · Ondrej Mosnacek

We need to run ssh without -tt to get the correct output and also run dnf with -q to exclude the repo cache update lines. Also, ssh has trouble with quoting of arguments, so we need to pipe the command via stdin.

Moreover, dnf check-update doesn't seem to do what we need here. Rather use dnf -q info --avail, which is also more straightforward to use.

---
 travis-ci/run-kvm-test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
travis-ci/run-kvm-test.sh +3 -4
index 6afbf96..3c19df8 100755
@@ -123,9 +123,9 @@ fi
 
 # Check if kernel-modules-$(uname -r) can be installed from repos,
 # otherwise update kernel and reboot.
-kernel_avail="$(ssh -tt -o StrictHostKeyChecking=no -q "root@$ipaddy" \
-    sh -c "dnf check-update kernel-modules-\$(uname -r) | wc -l")"
-if [ $kernel_avail -eq 0 ]; then
+if ! echo "dnf -q info --available kernel-modules-\$(uname -r)" | \
+    ssh -o StrictHostKeyChecking=no -q "root@$ipaddy"
+then
     ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" \
         dnf update -y kernel-core
 
--
Quoted 1 line

2.26.2

Applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/10a0b5dacd2c4108253064bb31f9218782e4403f

Signature · 3 lines
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.