[master 2/2] Add a test for kickstarts that %include a URL

dashea installerbot-noreply at redhat.com
Fri Sep 4 15:54:38 UTC 2015


From: David Shea <dshea at redhat.com>

---
 tests/kickstart_tests/ks-include-post.ks |  4 +++
 tests/kickstart_tests/ks-include.ks      | 20 ++++++++++++++
 tests/kickstart_tests/ks-include.sh      | 46 ++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)
 create mode 100644 tests/kickstart_tests/ks-include-post.ks
 create mode 100644 tests/kickstart_tests/ks-include.ks
 create mode 100755 tests/kickstart_tests/ks-include.sh

diff --git a/tests/kickstart_tests/ks-include-post.ks b/tests/kickstart_tests/ks-include-post.ks
new file mode 100644
index 0000000..bc57fcf
--- /dev/null
+++ b/tests/kickstart_tests/ks-include-post.ks
@@ -0,0 +1,4 @@
+%post
+# If this is being run, it's a success
+echo SUCCESS > /root/RESULT
+%end
diff --git a/tests/kickstart_tests/ks-include.ks b/tests/kickstart_tests/ks-include.ks
new file mode 100644
index 0000000..6178a07
--- /dev/null
+++ b/tests/kickstart_tests/ks-include.ks
@@ -0,0 +1,20 @@
+url --mirror=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-rawhide&arch=$basearch
+install
+network --bootproto=dhcp
+
+bootloader --timeout=1
+zerombr
+clearpart --all
+autopart
+
+keyboard us
+lang en
+timezone America/New_York
+rootpw qweqwe
+shutdown
+
+%packages
+%end
+
+# Include a kickstart that contains %post
+%include KS-TEST-INCLUDE
diff --git a/tests/kickstart_tests/ks-include.sh b/tests/kickstart_tests/ks-include.sh
new file mode 100755
index 0000000..b8636eb
--- /dev/null
+++ b/tests/kickstart_tests/ks-include.sh
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea at redhat.com>
+
+TESTTYPE="kickstart"
+
+. ${KSTESTDIR}/functions.sh
+
+prepare() {
+    ks=$1
+    tmpdir=$2
+
+    # Copy the included kickstart to a directory in tmpdir
+    mkdir ${tmpdir}/http
+    cp $(dirname ${ks})/ks-include-post.ks ${tmpdir}/http
+
+    # Start a http server to serve the included file
+    start_httpd ${tmpdir}/http $tmpdir
+
+    # Set the URL of the included file
+    sed -e "/^%include/ s|KS-TEST-INCLUDE|${httpd_url}/ks-include-post.ks|" ${ks} > ${tmpdir}/ks.cfg
+    echo ${tmpdir}/ks.cfg
+}
+
+cleanup() {
+    tmpdir=$1
+
+    if [ -f ${tmpdir}/httpd-pid ]; then
+        kill $(cat ${tmpdir}/httpd-pid)
+    fi
+}


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/8ce05de34eac11a8cc92f0b786bc9e694a069852


More information about the anaconda-patches mailing list