Bug 1387256

Summary: RFE: allow customizing options to kickstart %packages
Product: [Retired] Beaker Reporter: Jeff Bastian <jbastian>
Component: generalAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 23CC: dcallagh, dowang, mjia, mkolar, rjoost
Target Milestone: 24.0Keywords: FutureFeature, Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-21 18:51:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pkgoptions patch none

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):
beaker-23.2

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.