Bug 997524

Summary: rfe: determine whether a groupid in optionlist in an environment is default
Product: [Fedora] Fedora Reporter: Ales Kozumplik <akozumpl>
Component: libcompsAssignee: Jindrich Luza <jluza>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: akozumpl, jluza, jzeleny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libcomps-0.1.3-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-27 14:34:34 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:

Description Ales Kozumplik 2013-08-15 13:55:12 UTC
Suppose the following comps:

  <environment>
    <id>.../id>
    <optionlist>
      <groupid default="true">libreoffice</groupid>
      <groupid>gnome-games</groupid>
      <groupid>epiphany</groupid>
      <groupid>3d-printing</groupid>
    </optionlist>
  </environment>

With Python, one can find out the groupids of the options as env.option_ids

But how to tell which ones have default=true set and which ones do not? Maybe it's possible and I just can't figure out how, but the parsing code seems to suggest we actually ignore the value.

Comment 1 Ales Kozumplik 2013-08-15 13:59:17 UTC
(FWIW this prevents proper implementation of DNFPayload.environmentOptionIsDefault in Anaconda)

Comment 2 Jindrich Luza 2013-08-19 08:25:02 UTC
Yes, Your conclusion is right. Current version is unable to deal with default attribute in groupid element, because it wasn't considerated. I'll try modify library to be capable handle this as fast as I can. 

Will You require default attribute in grouplist -> groupid element as well, or just in case you mentioned.

Comment 3 Ales Kozumplik 2013-08-19 09:23:22 UTC
(In reply to Jindrich Luza from comment #2)
> Will You require default attribute in grouplist -> groupid element as well,
> or just in case you mentioned.

I don't require it per-se, but it is probably a good idea to extend the API to support it too.

Comment 4 Fedora Update System 2013-08-20 14:11:25 UTC
libcomps-0.1.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/libcomps-0.1.3-1.fc19

Comment 5 Fedora Update System 2013-08-21 00:04:34 UTC
Package libcomps-0.1.3-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libcomps-0.1.3-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15047/libcomps-0.1.3-1.fc19
then log in and leave karma (feedback).

Comment 6 Ales Kozumplik 2013-08-26 10:34:50 UTC
Jindrich, how does one use the new API to determine the default parameter? I looked at 08008e492804c488a4a97712785ed99880343d69 and am none the wiser: there's no unit test nor a release note. Can you please provide an example? Thanks!

Comment 7 Jindrich Luza 2013-08-27 14:34:34 UTC
I thought API for default attribute is obvious. But maybe You're right, I should shed more light on this. For backward compatibilty you don't have to create special object for groupid attribute, and could use:
   group_ids.append("some id")
for groupid with default attribute set to False. And then you can set default attribute as
   group_ids[0].default = True.
Or one line aproach:
   group_ids.append(libcomps.GroupId("some id", default=True)).
Obviously you can use something like:
 group_ids.append(libcomps.GroupId("some id"))
 group_ids.append(libcomps.GroupId("some id", default=False))

Default attribute API explanation is included in tests for
libcomps-0.1.3-2 build

Comment 8 Fedora Update System 2013-09-30 00:29:39 UTC
libcomps-0.1.3-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.