Skip to content

Commit

Permalink
Fix and expand nfs-repo-and-addon.ks
Browse files Browse the repository at this point in the history
Make the file checks actually match the comments, and add checks for
whether the repo file that is supposed to be installed is actually
installed.
  • Loading branch information
dashea committed Jul 31, 2015
1 parent ca2a604 commit 1d629e8
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions tests/kickstart_tests/nfs-repo-and-addon.ks
Expand Up @@ -4,16 +4,17 @@ nfs --server=NFS-SERVER --dir=NFS-PATH
# NFS:
# - testpkg-nfs-core, to be installed with @core
# - testpkg-nfs-addon, to be installed because we ask for it
# - testpkg-share1, contains a file /usr/share/testpkg-2/nfs. To be installed by excluding
# the HTTP version.
# - testpkg-share2, contains a file /usr/share/testpkg-3/nfs. To be excluded via cost
# - testpkg-share1, contains a file /usr/share/testpkg-1/nfs. To be installed by excluding
# the HTTP version, despite http's lower cost.
# - testpkg-share2, contains a file /usr/share/testpkg-2/nfs. To be excluded via cost
# HTTP:
# - testpkg-http-core, to be installed with @core
# - testpkg-http-addon, to be installed because we ask for it
# - testpkg-share1, contains a file /usr/share/testpkg-2/http. To be excluded via excludepkgs.
# - testpkg-share2, contains a file /usr/share/testpkg-3/http. To be included via cost.
repo --name=kstest-nfs --baseurl=NFS-ADDON-REPO --cost=50 --install
repo --name=kstest-http --baseurl=HTTP-ADDON-REPO --cost=25 --excludepkgs=testpkg-share2 --install
# - testpkg-share1, contains a file /usr/share/testpkg-1/http. To be excluded via excludepkgs.
# - testpkg-share2, contains a file /usr/share/testpkg-2/http. To be included because the cost
# is lower.
repo --name=kstest-nfs --baseurl=NFS-ADDON-REPO --cost=50
repo --name=kstest-http --baseurl=HTTP-ADDON-REPO --cost=25 --excludepkgs=testpkg-share1 --install

install
network --bootproto=dhcp
Expand Down Expand Up @@ -61,17 +62,44 @@ if [[ "${status}" -eq 0 ]]; then
fi
# Double check that the correct marker files are in place
if [[ -e /usr/share/testpkg-1/nfs ]]; then
if [[ ! -e /usr/share/testpkg-1/nfs ]]; then
echo "*** unable to find marker for testpkg-share1" >> /root/RESULT
status=1
fi
if [[ -e /usr/share/testpkg-2/http ]]; then
if [[ ! -e /usr/share/testpkg-2/http ]]; then
echo "*** unable to find marker for testpkg-share2" >> /root/RESULT
status=1
fi
fi
repofile=/etc/yum.repos.d/kstest-http.repo
if [[ "${status}" -eq 0 ]]; then
# Check that the repo file got installed
if [[ ! -e $repofile ]]; then
echo "*** kstest-http.repo was not installed" >> /root/RESULT
status=1
# Check that is has all the options
elif ! grep -q '^baseurl=HTTP-ADDON-REPO$' $repofile ; then
echo "*** kstest-http.repo is missing the baseurl" >> /root/RESULT
status=1
elif ! grep -q '^cost=25$' $repofile; then
echo "*** kstest-http.repo is missing the cost" >> /root/RESULT
status=1
elif ! grep -q '^exclude=testpkg-share1$' $repofile; then
echo "*** kstest-http.repo is missing the exclude" >> /root/RESULT
status=1
fi
fi
if [[ "${status}" -eq 0 ]]; then
# Check that the NFS repo file was not installed
if [[ -e /etc/yum.repos.d/kstest-nfs.repo ]]; then
echo "*** kstest-nfs.repo was installed with --install" >> /root/RESULT
status=1
fi
fi
if [[ "${status}" -eq 0 ]]; then
echo SUCCESS > /root/RESULT
fi
Expand Down

0 comments on commit 1d629e8

Please sign in to comment.