summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Styk <mastyk@redhat.com>2019-01-10 08:02:54 +0100
committerMartin Styk <mastyk@redhat.com>2019-01-10 16:29:17 +0100
commit4e5968b0bf17236c30740ea76c9afb2acce595eb (patch)
tree77ef6776c1c2ad9b28c0722f3f386b5267389e03
parent0063f44c9c075cc681a6b426e920cf3c89f2c9c1 (diff)
ks: Added support for disabling/removing repos
Added support for following options in ks meta: no_repo_<repo_id> disable_<type>_repos disable_repo_<repo_id> Also tests and documentation were updated accordingly. Change-Id: Ifddfdd07ce041fa798c467b9eb855a39c66c3e3e
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_kickstart.py187
-rw-r--r--Server/bkr/server/snippets/print_anaconda_repos5
-rw-r--r--Server/bkr/server/snippets/print_repos6
-rw-r--r--documentation/user-guide/customizing-installation.rst22
4 files changed, 217 insertions, 3 deletions
diff --git a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
index 5670ad9..d0e338d 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
@@ -334,7 +334,27 @@ class KickstartTest(unittest.TestCase):
repo_id=u'AppStream-debuginfo',
repo_type=u'debug',
path=u'../../../AppStream/x86_64/debug/tree'
- )
+ ),
+ DistroTreeRepo(
+ repo_id=u'CRB-debuginfo',
+ repo_type=u'debug',
+ path=u'../../../CRB/x86_64/debug/tree'
+ ),
+ DistroTreeRepo(
+ repo_id=u'CRB',
+ repo_type=u'variant',
+ path=u'../../../CRB/x86_64/os'
+ ),
+ DistroTreeRepo(
+ repo_id=u'BaseOS',
+ repo_type=u'variant',
+ path=u'../../../BaseOS/x86_64/os'
+ ),
+ DistroTreeRepo(
+ repo_id=u'AppStream',
+ repo_type=u'variant',
+ path=u'../../../AppStream/x86_64/os'
+ ),
]
@@ -2350,6 +2370,171 @@ install
self.assert_('/etc/yum.repos.d/beaker-debug.repo' not in k, k)
self.assert_('/etc/yum.repos.d/beaker-optional-x86_64-debug.repo' not in k, k)
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_no_repo_CRB(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="no_repo_CRB">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' not in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' in k, k)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_no_repo_CRB_disable_repo_CRB(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="no_repo_CRB disable_repo_CRB">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' not in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' in k, k)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_disable_repo_CRB(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="disable_repo_CRB">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' not in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' in k, k)
+ self.assert_('CRB/x86_64/os\nenabled=0\n' in k, k)
+ self.assert_('CRB/x86_64/debug/tree\nenabled=1\n' in k, k)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_disable_debug_repos(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="disable_debug_repos">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' not in k, k)
+ self.assert_('repo --name=beaker-AppStream-debuginfo' not in k, k)
+ self.assert_('repo --name=beaker-BaseOS-debuginfo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-AppStream-debuginfo.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-BaseOS-debuginfo.repo' in k, k)
+ self.assert_('CRB/x86_64/os\nenabled=1\n' in k, k)
+ self.assert_('CRB/x86_64/debug/tree\nenabled=0\n' in k, k)
+ self.assert_('AppStream/x86_64/debug/tree\nenabled=0\n' in k, k)
+ self.assert_('BaseOS/x86_64/debug/tree\nenabled=0\n' in k, k)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_disable_repo_CRB_and_debuginfo(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="disable_repo_CRB disable_repo_CRB-debuginfo">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' not in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' in k, k)
+ self.assert_('CRB/x86_64/os\nenabled=0\n' in k, k)
+ self.assert_('CRB/x86_64/debug/tree\nenabled=0\n' in k, k)
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1664750
+ def test_no_debug_repos_disable_repo_CRB(self):
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe ks_meta="no_debug_repos disable_repo_CRB">
+ <distroRequires>
+ <distro_name op="=" value="RHEL-8.0-20181114.n.0" />
+ <distro_variant op="=" value="BaseOS" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <task name="/distribution/install" />
+ <task name="/distribution/reservesys" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', self.system)
+ k = recipe.installation.rendered_kickstart.kickstart
+ self.assert_('repo --name=beaker-CRB --cost' not in k, k)
+ self.assert_('repo --name=beaker-CRB-debuginfo' not in k, k)
+ self.assert_('repo --name=beaker-AppStream-debuginfo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB.repo' in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-CRB-debuginfo.repo' not in k, k)
+ self.assert_('/etc/yum.repos.d/beaker-AppSteam-debuginfo.repo' not in k, k)
+ self.assert_('CRB/x86_64/os\nenabled=0\n' in k, k)
+
# https://bugzilla.redhat.com/show_bug.cgi?id=874191
def test_no_updates_repos_fedora(self):
recipe = self.provision_recipe('''
diff --git a/Server/bkr/server/snippets/print_anaconda_repos b/Server/bkr/server/snippets/print_anaconda_repos
index 5d58fc7..c581c50 100644
--- a/Server/bkr/server/snippets/print_anaconda_repos
+++ b/Server/bkr/server/snippets/print_anaconda_repos
@@ -2,7 +2,10 @@
{% set repo_base = distro_tree.url_in_lab(lab_controller, scheme=['http', 'ftp']) %}
{% if repo_base %}
{% for repo in distro_tree.repos %}
-{% if var('no_%s_repos' % repo.repo_type) is undefined %}
+{% if var('no_%s_repos' % repo.repo_type) is undefined
+ and var('disable_%s_repos' % repo.repo_type) is undefined
+ and var('no_repo_%s' % repo.repo_id) is undefined
+ and var('disable_repo_%s' % repo.repo_id) is undefined %}
repo --name=beaker-{{ repo.repo_id }} --cost=100 --baseurl={{ repo_base|urljoin(repo.path) }}
{% endif %}
{% endfor %}
diff --git a/Server/bkr/server/snippets/print_repos b/Server/bkr/server/snippets/print_repos
index 6d0a98d..266762b 100644
--- a/Server/bkr/server/snippets/print_repos
+++ b/Server/bkr/server/snippets/print_repos
@@ -2,12 +2,16 @@
{% set repo_base = distro_tree.url_in_lab(lab_controller, scheme=['http', 'ftp']) %}
{% if repo_base %}
{% for repo in distro_tree.repos %}
-{% if var('no_%s_repos' % repo.repo_type) is undefined %}
+{% if var('no_%s_repos' % repo.repo_type) is undefined and var('no_repo_%s' % repo.repo_id) is undefined %}
cat <<"EOF" >/etc/yum.repos.d/beaker-{{ repo.repo_id }}.repo
[beaker-{{ repo.repo_id }}]
name=beaker-{{ repo.repo_id }}
baseurl={{ repo_base|urljoin(repo.path) }}
+{% if var('disable_%s_repos' % repo.repo_type) is undefined and var('disable_repo_%s' % repo.repo_id) is undefined %}
enabled=1
+{% else %}
+enabled=0
+{% endif %}
gpgcheck=0
skip_if_unavailable=1
EOF
diff --git a/documentation/user-guide/customizing-installation.rst b/documentation/user-guide/customizing-installation.rst
index 3f6ed22..a697a75 100644
--- a/documentation/user-guide/customizing-installation.rst
+++ b/documentation/user-guide/customizing-installation.rst
@@ -192,6 +192,23 @@ correspond to the similarly-named kickstart option.
For example, ``harness_rw_host_volumes='/myvolume'`` will then only
mount the ``/myvolume`` with write permissions.
+``disable_repo_<id>``
+ Disable repo of the given id. By default, the kickstart will include repo.
+ Repo is also created in yum.repos.d/ and enabled. Set this variable if you
+ want to omit ``repo`` command in kickstart and disable it in yum.repos.d/.
+ You can find repo id for a particular distro tree under the
+ :guilabel:`Repos` tab on the distro tree page.
+ For example disable_repo_CRB.
+
+``disable_<type>_repos``
+ Disable repos of the given types. Valid types include ``variant``, ``addon``,
+ ``optional``, and ``debug``. By default, the kickstart will include all repos
+ of the given type. Repos are also created in yum.repos.d/ and enabled.
+ Set this variable if you want to omit ``repo`` command in kickstart and
+ disable them in yum.repos.d/. You can find repo id for a particular distro
+ tree under the :guilabel:`Repos` tab on the distro tree page.
+ For example disable_debug_repos.
+
``ethdevices=<module>[,<module>...]``
Comma-separated list of network modules to be loaded during installation.
@@ -288,6 +305,11 @@ correspond to the similarly-named kickstart option.
variable if you want to supply explicit partitioning commands in some other
way, for example in a ``<ks_append/>`` section.
+``no_repo_<id>``
+ Omits repo of the given id. You can find repo id for a particular distro
+ tree under the :guilabel:`Repos` tab on the distro tree page.
+ For example no_repo_CRB-debuginfo.
+
``no_<type>_repos``
Omits repos of the given type. Valid types include ``variant``, ``addon``,
``optional``, and ``debug``. You can find which repo types are available