Bug 1387256 - RFE: allow customizing options to kickstart %packages
Summary: RFE: allow customizing options to kickstart %packages
Alias: None
Product: Beaker
Classification: Community
Component: general
Version: 23
Hardware: All
OS: Linux
low vote
Target Milestone: 24.0
Assignee: Dan Callaghan
QA Contact: tools-bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2016-10-20 13:12 UTC by Jeff Bastian
Modified: 2017-02-21 18:51 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-02-21 18:51:25 UTC

Attachments (Terms of Use)
pkgoptions patch (3.59 KB, patch)
2016-10-20 19:23 UTC, Jeff Bastian
no flags Details | Diff

Description Jeff Bastian 2016-10-20 13:12:53 UTC
Description of problem:
The %packages directive in kickstart has a number of options [1]:

%packages [--excludedocs] [--ignoremissing] [--nobase] [--nocore]
      [--ignoredeps] [--resolvedeps] [--default] [--instLangs INSTLANGS]
      [--multilib] [--excludeWeakdeps]

The kickstart template in Beaker [2] does not have a way to use any of the options.  It just sets --ignoremissing automatically, and adds --default if there's no recipe or packages list in the ks_meta:

%packages --ignoremissing
{%- if not recipe and packages is undefined %} --default
{% else %}

{% snippet 'rhts_packages' %}
{% endif %}

Please add a method to allow use of the other options to the %packages directive.

[1] http://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#chapter-7-package-selection
[2] https://git.beaker-project.org/cgit/beaker/tree/Server/bkr/server/kickstarts/default#n73

Version-Release number of selected component (if applicable):

Comment 1 Jeff Bastian 2016-10-20 13:31:16 UTC
If I'm reading the Jinja2 template correctly, I think a one-line patch to add a "pkgoptions" variable to the kickstart metadata should do the trick:

diff --git a/Server/bkr/server/kickstarts/default b/Server/bkr/server/kickstarts/default
index e937945e92d4..c4d72d87f930 100644
--- a/Server/bkr/server/kickstarts/default
+++ b/Server/bkr/server/kickstarts/default
@@ -70,7 +70,7 @@ unsupported_hardware
 {% endif %}
 {% if has_rpmostree is not defined %}
-%packages --ignoremissing
+%packages {{ pkgoptions|default('--ignoremissing') }}
 {%- if not recipe and packages is undefined %} --default
 {% else %}

Example usage:
  <recipe ks_meta="pkgoptions='--excludedocs --ignoremissing'" ....>

Comment 2 Jeff Bastian 2016-10-20 19:23:21 UTC
Created attachment 1212631 [details]
pkgoptions patch

This patch adds the pkgoptions kickstart metadata variable plus an integration test and documentation.

I'm having difficulty setting up a development environment in order to actually run the integration tests, however, so the patch is just a proof of concept at this time.  If somebody with a development environment already set up can run a sanity test on my patch, I would appreciate it.

Comment 3 Jeff Bastian 2016-10-21 15:09:19 UTC
I got my devel environment fixed up with help from Dan Callaghan, Matt Jia, and Nick Coghlan -- thanks all! -- and verified the patch is working with an added test in the kickstart integration tests.

The patch is in gerrit: https://gerrit.beaker-project.org/5346

Comment 4 Dan Callaghan 2016-11-01 05:54:00 UTC
BTW Jeff why did you need this? Which option do you want to pass down to %packages? Just curious.

Comment 5 Jeff Bastian 2016-11-01 11:55:40 UTC
Michal Kolar (CC'ed on this bug) asked for help on IRC for using the --instLangs option with the %packages section.

Comment 8 Dan Callaghan 2017-02-21 18:51:25 UTC
Beaker 24.0 has been released.

Note You need to log in before you can comment on or make changes to this bug.