diff --git a/tests/p_ipa-server/0-preclean.sh b/tests/p_ipa-server/0-preclean.sh index cfa2a3e..ab0dba3 100755 --- a/tests/p_ipa-server/0-preclean.sh +++ b/tests/p_ipa-server/0-preclean.sh @@ -2,11 +2,11 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then t_Log "Running $0 - Stopping and removing httpd if present" -if /sbin/service httpd status 2>&1 | grep 'is running...' &> /dev/null +if /sbin/service httpd status 2>&1 | grep 'running...' &> /dev/null then /sbin/service httpd stop &> /dev/null fi @@ -17,7 +17,7 @@ rm -rf /etc/httpd fi t_Log "Running $0 - Stopping and removing bind if present" -if /sbin/service named status 2>&1 | grep 'is running...' &> /dev/null +if /sbin/service named status 2>&1 | grep 'running...' &> /dev/null then /sbin/service named stop &> /dev/null fi @@ -37,8 +37,11 @@ cp /etc/nsswitch.conf /tmp/nsswitch.conf.ipa-tests t_Log "Running $0 - Backing up hosts file" cp /etc/hosts /tmp/hosts.ipa-tests +if [[ -f /etc/ntp.conf ]] +then t_Log "Running $0 - Backing up ntp.conf file" cp /etc/ntp.conf /tmp/ntp.conf.ipa-tests +fi t_Log "Running $0 - Backing up saving yum history id" /usr/bin/yum history list | awk 'NR == 4 {print $1}' > /tmp/yum-rollback-id.ipa-tests diff --git a/tests/p_ipa-server/1-install_freeipa.sh b/tests/p_ipa-server/1-install_freeipa.sh index 89db9f4..4036a64 100755 --- a/tests/p_ipa-server/1-install_freeipa.sh +++ b/tests/p_ipa-server/1-install_freeipa.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then t_Log "Running $0 - Installing packages" t_InstallPackage ipa-server bind-dyndb-ldap libsss_sudo diff --git a/tests/p_ipa-server/2-configure_freeipa.sh b/tests/p_ipa-server/2-configure_freeipa.sh index bd7325a..6a6d7a6 100755 --- a/tests/p_ipa-server/2-configure_freeipa.sh +++ b/tests/p_ipa-server/2-configure_freeipa.sh @@ -1,7 +1,7 @@ #!/bin/bash # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then t_Log "Running $0 - setting hostname of system" diff --git a/tests/p_ipa-server/3-verify_kerberos_tickets.sh b/tests/p_ipa-server/3-verify_kerberos_tickets.sh index 94444fd..a53aaba 100755 --- a/tests/p_ipa-server/3-verify_kerberos_tickets.sh +++ b/tests/p_ipa-server/3-verify_kerberos_tickets.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then # kinit cannot take password from stdin so use expect diff --git a/tests/p_ipa-server/4-adduser.sh b/tests/p_ipa-server/4-adduser.sh index 4886a8f..a950483 100755 --- a/tests/p_ipa-server/4-adduser.sh +++ b/tests/p_ipa-server/4-adduser.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then # Need admin credentials diff --git a/tests/p_ipa-server/5-addservice.sh b/tests/p_ipa-server/5-addservice.sh index 5af6d4b..fe407fc 100755 --- a/tests/p_ipa-server/5-addservice.sh +++ b/tests/p_ipa-server/5-addservice.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then # Need admin credentials diff --git a/tests/p_ipa-server/6-dnsdetails.sh b/tests/p_ipa-server/6-dnsdetails.sh index 5eb71bf..0051233 100755 --- a/tests/p_ipa-server/6-dnsdetails.sh +++ b/tests/p_ipa-server/6-dnsdetails.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then # Need admin credentials diff --git a/tests/p_ipa-server/7-addsudo.sh b/tests/p_ipa-server/7-addsudo.sh index 03ef28e..4771c49 100755 --- a/tests/p_ipa-server/7-addsudo.sh +++ b/tests/p_ipa-server/7-addsudo.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then # Need admin credentials @@ -60,7 +60,7 @@ t_Log "Running $0 - clearing the sssd cache" /sbin/service sssd stop &> /dev/null rm -rf /var/lib/sss/db/* /sbin/service sssd start &> /dev/null -/sbin/service sssd status | grep 'is running' &> /dev/null +/sbin/service sssd status | grep 'running' &> /dev/null t_CheckExitStatus $? ## Leaving a little time to settle as there seems to be a slight race condition to go right away diff --git a/tests/p_ipa-server/99-postclean.sh b/tests/p_ipa-server/99-postclean.sh index 1da2c94..9b00353 100755 --- a/tests/p_ipa-server/99-postclean.sh +++ b/tests/p_ipa-server/99-postclean.sh @@ -2,7 +2,7 @@ # Author: James Hogarth # -if (t_GetPkgRel basesystem | grep -q el6) +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') then t_Log "Running $0 - Restoring up resolv.conf" @@ -14,8 +14,11 @@ cp /tmp/nsswitch.conf.ipa-tests /etc/nsswitch.conf t_Log "Running $0 - Restoring hosts file" cp /tmp/hosts.ipa-tests /etc/hosts +if [[ -f /tmp/ntp.conf.ipa-tests ]] +then t_Log "Running $0 - Restoring ntp.conf file" cp /tmp/ntp.conf.ipa-tests /etc/ntp.conf +fi t_Log "Running $0 - Rolling back to yum history id" /usr/bin/yum -y history rollback $(cat /tmp/yum-rollback-id.ipa-tests) &> /dev/null