summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Saha <asaha@redhat.com>2014-06-03 13:43:16 +1000
committerGerrit Code Review <gerrit@beaker-project.org>2014-06-12 06:12:52 +0000
commit1479a0714e5520bec7b29cbed8106fbd27f66a6b (patch)
treed270faa2e81678d8f4f30781450c24a7c02a4c53
parent2334a200a145cb80a9c7973d78454b058038030d (diff)
Add a ks_meta variable "remote_post"
Using this variable, a remote script can be specified which will be executed post installtion. The remote script must have an appropriate #! line to indicate the script interpreter. Bug: 1099231 Change-Id: I17532d6bf71223282c386fb332108644b30586df
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_kickstart.py45
-rw-r--r--Server/bkr/server/kickstarts/Fedora1
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinux31
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinux41
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinux61
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinux71
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinuxClient51
-rw-r--r--Server/bkr/server/kickstarts/RedHatEnterpriseLinuxServer51
-rw-r--r--Server/bkr/server/kickstarts/RedHatStorage21
-rw-r--r--Server/bkr/server/snippets/remote_post10
-rw-r--r--documentation/user-guide/customizing-installation.rst7
11 files changed, 70 insertions, 0 deletions
diff --git a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
index b3d5dd2..08118c4 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
@@ -2430,3 +2430,48 @@ part /mnt/testarea2 --size=10240 --fstype btrfs
</job>''')
ks = recipe.rendered_kickstart.kickstart
self.assertEquals(ks.count('IPV6_DISABLED=True\n'), 2)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1099231
+ def test_remote_post(self):
+
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="remote_post=http://path/to/myscript">
+ <distroRequires>
+ <distro_name op="=" value="RHEL5-Server-U8" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''')
+
+ ks = recipe.rendered_kickstart.kickstart
+ self.assertIn('wget --tries 20 -O remote_script http://path/to/myscript '
+ '&& chmod +x remote_script && ./remote_script',
+ ks)
+
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="remote_post='http://path/to/~scriptsdir/myscript'">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-6.2" />
+ <distro_variant op="=" value="Server" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''')
+ ks = recipe.rendered_kickstart.kickstart
+ self.assertIn("curl --retry 20 -o remote_script 'http://path/to/~scriptsdir/myscript' "
+ "&& chmod +x remote_script && ./remote_script",
+ ks)
diff --git a/Server/bkr/server/kickstarts/Fedora b/Server/bkr/server/kickstarts/Fedora
index 964a210..9db599d 100644
--- a/Server/bkr/server/kickstarts/Fedora
+++ b/Server/bkr/server/kickstarts/Fedora
@@ -99,6 +99,7 @@ chrony
{% snippet 'rhts_post' %}
{% snippet 'Fedora_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
%end
{{ ks_appends|join('\n') }}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux3 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux3
index 3070eb0..6a26931 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux3
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux3
@@ -79,6 +79,7 @@ PATH=/usr/bin:$PATH
{% snippet 'rhts_post' %}
{% snippet 'RedHatEnterpriseLinux3_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
) 2>&1 | /usr/bin/tee /dev/console
{{ ks_appends|join('\n') }}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux4 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux4
index bd393df..a5e5b0a 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux4
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux4
@@ -88,6 +88,7 @@ lvm2
{% snippet 'rhts_post' %}
{% snippet 'RedHatEnterpriseLinux4_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
{{ ks_appends|join('\n') }}
{% snippet 'post_s390_reboot' %}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux6 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux6
index 42eead1..e46fa4e 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux6
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux6
@@ -90,6 +90,7 @@ unsupported_hardware
{% if recipe.systemtype == 'Virtual' %}
{% snippet 'virt_console_post' %}
{% endif %}
+{% snippet 'remote_post' %}
%end
{{ ks_appends|join('\n') }}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux7 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux7
index 2a899bf..8024150 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinux7
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinux7
@@ -86,6 +86,7 @@ chrony
{% snippet 'rhts_post' %}
{% snippet 'RedHatEnterpriseLinux7_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
%end
{{ ks_appends|join('\n') }}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxClient5 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxClient5
index 2e545a1..bf9bb67 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxClient5
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxClient5
@@ -106,6 +106,7 @@ xkeyboard-config
{% snippet 'rhts_post' %}
{% snippet 'RedHatEnterpriseLinuxClient5_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
{{ ks_appends|join('\n') }}
{% snippet 'post_s390_reboot' %}
diff --git a/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxServer5 b/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxServer5
index 0427517..f7b239d 100644
--- a/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxServer5
+++ b/Server/bkr/server/kickstarts/RedHatEnterpriseLinuxServer5
@@ -105,6 +105,7 @@ xkeyboard-config
{% snippet 'rhts_post' %}
{% snippet 'RedHatEnterpriseLinuxServer5_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
{{ ks_appends|join('\n') }}
{% snippet 'post_s390_reboot' %}
diff --git a/Server/bkr/server/kickstarts/RedHatStorage2 b/Server/bkr/server/kickstarts/RedHatStorage2
index 19e4e70..fbd46fb 100644
--- a/Server/bkr/server/kickstarts/RedHatStorage2
+++ b/Server/bkr/server/kickstarts/RedHatStorage2
@@ -86,6 +86,7 @@ unsupported_hardware
{% snippet 'rhts_post' %}
{% snippet 'RedHatStorage2_post' %}
{% snippet 'system_post' %}
+{% snippet 'remote_post' %}
%end
{{ ks_appends|join('\n') }}
diff --git a/Server/bkr/server/snippets/remote_post b/Server/bkr/server/snippets/remote_post
new file mode 100644
index 0000000..53601bd
--- /dev/null
+++ b/Server/bkr/server/snippets/remote_post
@@ -0,0 +1,10 @@
+{% if remote_post is defined %}
+{% set url = remote_post|shell_quoted %}
+{% if distro is osmajor('RedHatEnterpriseLinux3', 'RedHatEnterpriseLinux4', 'RedHatEnterpriseLinuxServer5', 'RedHatEnterpriseLinuxServerGrid5', 'RedHatEnterpriseLinuxClient5') %}
+wget --tries 20 -O remote_script {{ url }} && chmod +x remote_script && ./remote_script
+{% else %}
+curl --retry 20 -o remote_script {{ url }} && chmod +x remote_script && ./remote_script
+{% endif %}
+#https://bugzilla.redhat.com/show_bug.cgi?id=1107915
+exit 0
+{% endif %} \ No newline at end of file
diff --git a/documentation/user-guide/customizing-installation.rst b/documentation/user-guide/customizing-installation.rst
index 8dcc000..2eac9b4 100644
--- a/documentation/user-guide/customizing-installation.rst
+++ b/documentation/user-guide/customizing-installation.rst
@@ -177,6 +177,13 @@ correspond to the similarly-named kickstart option.
Root password to use. Must be encrypted in the conventional
:manpage:`crypt(3)` format.
+``remote_post=<url>``
+ Specify a URL to a script to be executed post-install. The script must specify a
+ interpreter using the ``#!`` line if not a bash script. This is especially useful
+ for systems set to Manual mode. If you are scheduling a job, a
+ simpler alternative is to embed a ``%post`` scriptlet directly in your
+ job XML using the ``<ks_append/>`` element.
+
``rootfstype``
Filesystem type for the root filesystem. Default is to allow the installer
to choose.