[Fedora-livecd-list] @group --something support is broken

Jesse Keating jkeating at redhat.com
Tue Oct 7 17:51:14 UTC 2008


Looking at the code, I don't think this ever worked quite right, and
there is a bit of API confusion.

From yuminst.py:

    def selectGroup(self, grp, include = pykickstart.parser.GROUP_DEFAULT):
        yum.YumBase.selectGroup(self, grp)
        if include == pykickstart.parser.GROUP_REQUIRED:
            map(lambda p: self.deselectPackage(p), grp.default_packages.keys())
        elif include == pykickstart.parser.GROUP_ALL:
            map(lambda p: self.selectPackage(p), grp.optional_packages.keys())

There is a bit of a problem in this function.  'grp' right now is being
passed in (via creator.py) as a string that is the group name, and that
works great for the first line of the function, where yum expects a
string for selectGroup.  However if there were options passed to the
group and we have to fetch values, we try to call
'grp.default_packages.keys()' or optional_packages.  A string doesn't
have those attributes, but a pykickstart group object does.

Fixing this is easy, just make 'grp' the actual pykickstart group
object.  In fact, if we did that, we could do away with the second
argument, include =.  That would be the most simple fix, but that would
break API.  Even just changing 'grp' to be expected to be a pykickstart
group object could be seen as an API break.  I don't really see a way to
fix this without some sort of API change, unless we add yet another
keyword argument to the function that is the pykickstart object, and
declare that unless you pass that third option, you don't get --foo
support for your groups.  Not that it ever worked anyway.

Other options are create a new function all together, which adds to the
API, and callers that want groups with options can use the new call, or
we could try to detect what object 'grp' is within the existing function
and operate accordingly (although I don't see how you can pass in a
string and still make --foo options work, at least not without a lot of
extra yum object calls to get the group and get the optional/all
members).

Since this is a sticky fix, I thought I'd post to the list for
discussion before working on a patch.  Thoughts?

-- 
Jesse Keating
Fedora -- Freedom² is a feature!
identi.ca: http://identi.ca/jkeating
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-livecd-list/attachments/20081007/2352d7ed/attachment.sig>


More information about the Fedora-livecd-list mailing list