diff mbox series

[testsuite] travis: fix kernel update check

Message ID 20201102105120.492607-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series [testsuite] travis: fix kernel update check | expand

Commit Message

Ondrej Mosnacek Nov. 2, 2020, 10:51 a.m. UTC
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.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 travis-ci/run-kvm-test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ondrej Mosnacek Nov. 4, 2020, 7:50 a.m. UTC | #1
On Mon, Nov 2, 2020 at 11:51 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> 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.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  travis-ci/run-kvm-test.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/travis-ci/run-kvm-test.sh b/travis-ci/run-kvm-test.sh
> index 6afbf96..3c19df8 100755
> --- a/travis-ci/run-kvm-test.sh
> +++ b/travis-ci/run-kvm-test.sh
> @@ -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
>
> --
> 2.26.2

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

Patch

diff --git a/travis-ci/run-kvm-test.sh b/travis-ci/run-kvm-test.sh
index 6afbf96..3c19df8 100755
--- a/travis-ci/run-kvm-test.sh
+++ b/travis-ci/run-kvm-test.sh
@@ -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