Bug 986026 - conditional_package_names format changed for v2
Summary: conditional_package_names format changed for v2
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: 2.2 Beta
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 2.2.0
Assignee: Randy Barlow
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-18 19:35 UTC by Michael Hrivnak
Modified: 2013-09-10 15:46 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-10 15:46:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Michael Hrivnak 2013-07-18 19:35:15 UTC
in v1, on a package group, the "conditional_package_names" attribute was a dictionary where keys are the text value of a "packagereq" element in comps.xml, and the values are the corresponding "requires" attribute of that element.

in v2, the "conditional_package_names" attribute is a list of lists. In each sub list, the first position is the text value of a "packagereq" element in comps.xml, and the second value is the corresponding "requires" attribute of that element.

After upgrade, when publishing a repo with a package group that contains a requirement of type "conditional", the publish operation for that particular group fails. The error is logged in pulp.log as seen below. The error is not reported by the CLI.

This can probably be solved by adding a migration to pulp_rpm that transforms this particular attribute from a dict to a list of lists.

For additional info, see here: https://github.com/pulp/pulp_rpm/issues/278

Here is the v1 code that creates a dictionary for this attribute: https://github.com/pulp/pulp/blob/pulp_v1/src/pulp/server/api/repo.py#L1511


013-07-17 10:33:15,728 pulp.plugins.pulp_rpm.yum_plugin.updateinfo:INFO: updateinfo.xml generated and written to file /var/lib/pulp/working/repos/rhel-6-x86_64-optional/distributors/yum_distributor/updateinfo.xml
2013-07-17 10:33:15,749 pulp.server.managers.repo.publish:ERROR: Exception caught from plugin during publish for repo [rhel-6-x86_64-optional]
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/publish.py", line 122, in _do_publish
    publish_report = distributor_instance.publish_repo(transfer_repo, conduit, call_config)
  File "/usr/lib/pulp/plugins/distributors/yum_distributor/distributor.py", line 462, in publish_repo
    groups_xml_path = comps_util.write_comps_xml(repo.working_dir, existing_groups, existing_cats)
  File "/usr/lib/python2.6/site-packages/pulp_rpm/yum_plugin/comps_util.py", line 399, in write_comps_xml
    comps_xml = form_comps_xml_from_units(existing_groups, existing_cats)
  File "/usr/lib/python2.6/site-packages/pulp_rpm/yum_plugin/comps_util.py", line 175, in form_comps_xml_from_units
    yum_groups = map(unit_to_yum_group, groups)
  File "/usr/lib/python2.6/site-packages/pulp_rpm/yum_plugin/comps_util.py", line 84, in unit_to_yum_group
    return dict_to_yum_group(pg_unit.metadata, group_id=pg_unit.unit_key["id"])
  File "/usr/lib/python2.6/site-packages/pulp_rpm/yum_plugin/comps_util.py", line 123, in dict_to_yum_group
    for pkg_name, value in obj['conditional_package_names']:
ValueError: too many values to unpack

Comment 1 Randy Barlow 2013-07-23 21:10:20 UTC
https://github.com/pulp/pulp_rpm/pull/281

Comment 2 Randy Barlow 2013-07-26 14:12:28 UTC
A migration has been added to fix this issue in the pulp-2.2 and master branches.

Comment 3 Jeff Ortel 2013-07-26 23:09:08 UTC
build: 2.2.0-0.22.beta

Comment 4 Preethi Thomas 2013-08-08 20:37:03 UTC
verified

In 1.1 
Created packgegroup with conditional packages

[root@ibm-x3650m4-02-vm-03 ~]# pulp-admin packagegroup  add_package --id mybirds -r zoo-copy1 -n walrus -t conditional --requires=whale


After upgrade to 2.2

I see the packagegroup with conditional packages

[root@ibm-x3650m4-02-vm-03 ~]# pulp-admin rpm repo  content group --repo-id zoo-copy
Conditional Package Names: 
Default:                   True
Default Package Names:     
Description:               
Display Order:             1024
Id:                        birds
Langonly:                  None
Mandatory Package Names:   stork, cockateel, penguin, duck
Name:                      birds
Optional Package Names:    
Repo Id:                   zoo-copy
Translated Description:    
Translated Name:           
User Visible:              True

Conditional Package Names: 
Default:                   True
Default Package Names:     
Description:               
Display Order:             1024
Id:                        mammals
Langonly:                  None
Mandatory Package Names:   camel, dolphin, lion, zebra, mouse, horse, fox,
                           elephant, cheetah, squirrel, kangaroo, chimpanzee,
                           tiger, giraffe, bear, whale, cow, dog, cat, gorilla,
                           wolf, walrus
Name:                      mammals
Optional Package Names:    
Repo Id:                   zoo-copy
Translated Description:    
Translated Name:           
User Visible:              True

Conditional Package Names: [[u'penguin', u'duck']]
Default:                   True
Default Package Names:     
Description:               
Display Order:             1024
Id:                        mybirds
Langonly:                  None
Mandatory Package Names:   
Name:                      birds
Optional Package Names:    
Repo Id:                   zoo-copy
Translated Description:    
Translated Name:           
User Visible:              True

Conditional Package Names: 
Default:                   True
Default Package Names:     
Description:               
Display Order:             1024
Id:                        sea-animals
Langonly:                  None
Mandatory Package Names:   
Name:                      pulp
Optional Package Names:    
Repo Id:                   zoo-copy
Translated Description:    
Translated Name:           
User Visible:              True

[root@ibm-x3650m4-02-vm-03 ~]#

Comment 5 Preethi Thomas 2013-09-10 15:46:17 UTC
2.2 released
http://repos.fedorapeople.org/repos/pulp/pulp/stable/2.2/


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