From 454cf92c429a5ff53d51a262be132b2a38a9d47c Mon Sep 17 00:00:00 2001 From: Johnny Hughes Date: Apr 25 2019 19:24:47 +0000 Subject: added the ability to add in or take out all repos besides base, added boot kernel version to log, switch DEFAULTKERNEL=kernel-plus if CENTOSPLUS is enabled --- diff --git a/tests/0_common/000_centos_default_repos.py b/tests/0_common/000_centos_default_repos.py index 6892dcd..a2c2fe5 100755 --- a/tests/0_common/000_centos_default_repos.py +++ b/tests/0_common/000_centos_default_repos.py @@ -13,22 +13,29 @@ import os yb = yum.YumBase() -try: - fasttrack = int(os.environ['FASTTRACK']) -except KeyError: - fasttrack = 0 +def getEnvironOpt(varname,defval): + val=defval + try: + val = int(os.environ[varname]) + except KeyError: + pass + print val + return val -try: - centosplus = int(os.environ['CENTOSPLUS']) -except KeyError: - centosplus = 0 - -if fasttrack: - centos_default_repos = ['base','extras','updates','cr','fasttrack','centos-kernel'] -elif centosplus: - centos_default_repos = ['base','extras','updates','cr','centosplus','centos-kernel'] -else: - centos_default_repos = ['base','extras','updates','cr','centos-kernel'] +centos_default_repos = ['base'] + +if getEnvironOpt('UPDATES',1): + centos_default_repos.append('updates') +if getEnvironOpt('EXTRAS',1): + centos_default_repos.append('extras') +if getEnvironOpt('CR',1): + centos_default_repos.append('cr') +if getEnvironOpt('CENTOS_KERNEL',1): + centos_default_repos.append('centos-kernel') +if getEnvironOpt('FASTTRACK',0): + centos_default_repos.append('fasttrack') +if getEnvironOpt('CENTOSPLUS',0): + centos_default_repos.append('centosplus') now = lambda: datetime.datetime.today().strftime("%c") print "[+] %s -> Check if non default repo is enabled" % now() diff --git a/tests/0_common/03_print_booted_kernel.sh b/tests/0_common/03_print_booted_kernel.sh new file mode 100755 index 0000000..44081c4 --- /dev/null +++ b/tests/0_common/03_print_booted_kernel.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +kerver="$(uname -r)" +t_Log "Boot Kernel Version: $kerver" + diff --git a/tests/0_common/20_upgrade_all.sh b/tests/0_common/20_upgrade_all.sh index d379a7a..68dc04d 100755 --- a/tests/0_common/20_upgrade_all.sh +++ b/tests/0_common/20_upgrade_all.sh @@ -2,6 +2,11 @@ t_Log "Running $0 - test that all updates can be applied to this machine cleanly" +# If CENTOSPLUS, and CentOS 7, and x86_64 change default kernel to kernel-plus +if [ "$CENTOSPLUS" == "1" ] && [ "$centos_ver" == "7" ] && [ "$arch" == "x86_64" ] ; then + sed -i 's,DEFAULTKERNEL=.*,DEFAULTKERNEL=kernel-plus,g' /etc/sysconfig/kernel +fi + yum -d0 -y install deltarpm yum -d0 -y upgrade