Bug 554717

Summary: RFE: Better groups exclusion support
Product: [Fedora] Fedora Reporter: Alexander Todorov <atodorov>
Component: pykickstartAssignee: Chris Lumens <clumens>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: clumens
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pykickstart-1.68-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 555311 (view as bug list) Environment:
Last Closed: 2010-07-01 20:57:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 555311, 558516    

Description Alexander Todorov 2010-01-12 13:31:23 UTC
Description of problem:
pykickstart does not support exclusion of groups that were not previously added in the %packages section. 

Red Hat QE needs this so that we can execute test cases such as:
%packages
@everything
-@conflicts


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

Additional info:
Package exclusion works the same way we'd like groups exclusion to work. For example:
%packages
@everything
-java*


Patch proposed by by James Laska and tested:
--- /usr/lib/python2.5/site-packages/pykickstart/parser.py	2010-01-07
04:16:41.000000000 -0500
+++ /tmp/parser.py	2010-01-07 04:16:29.000000000 -0500
@@ -365,4 +365,3 @@
                         pass
-                else:
-                    newExcludedSet.add(stripped[1:])
+                newExcludedSet.add(stripped[1:])
             else:

Comment 1 Chris Lumens 2010-01-13 19:25:23 UTC
Has this actually been tested in an install?  I don't see how just adding the excluded group to newExcludedSet is going to help.  That'll mean the group name gets into self.excludedList, which then gets passed on to YumBackend.deselectPackage.  I don't think that's doing anything magic to iterate over the packages in a group, or knows to deselect the group as opposed to a package.

It almost seems like we need an extra list here of groups to exclude, then call the appropriate thing in anaconda.  Of course, I could just not be following the patch correctly.

Comment 2 Alexander Todorov 2010-01-14 10:05:22 UTC
(In reply to comment #1)
> Has this actually been tested in an install?  

No. What I meant is that we've tested that pykickstart with this patch will generate a proper ks.cfg file. 

I've started a test job with manually created ks.cfg file to see how anaconda will interpret it. It's likely that anaconda will require another fix or modification of this patch.

Comment 5 Chris Lumens 2010-01-14 14:57:15 UTC
Can you attach a test script and example of what a "proper ks.cfg file" looks like?  I want to test an alternate patch here and make sure we get the same results.

Comment 6 Alexander Todorov 2010-01-14 16:02:18 UTC
A test script is the following SNAKE template:

from pykickstart.version import FC6
from installdefaults import InstallKs

# minimal install, procedural style
def ks(**context):
    '''Package set / Everything'''

    ks=InstallKs()
    if ks.version <= FC6:
        ks.packages.add(['@everything'])
    else:
        ks.packages.add(['*'])

    ks.packages.add(['-@conflicts'])

    return ks


The result should contain (along with other default values):

%packages
*
-@conflicts

Comment 9 Chris Lumens 2010-01-14 18:44:01 UTC
Okay, fixing this to work in anaconda too makes things a whole lot more complicated, but I think I've managed to make sense of it all.  This should now work like you want both in pykickstart's __str__ methods and in anaconda.

Comment 10 Alexander Todorov 2010-01-15 08:34:43 UTC
Chris,
can you post your patch or an updates.img for RHEL5.5 so I can give it a try?

Comment 11 Alexander Todorov 2010-01-19 18:20:56 UTC
This works OK for QE. snake.test server now generates a ks.cfg with
%packages
*
-@conflicts