Bug 790033 - pulp-admin package update output broken
Summary: pulp-admin package update output broken
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: 1.0.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Jeff Ortel
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-13 14:23 UTC by Miljan Karadzic
Modified: 2012-02-14 23:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-14 23:09:23 UTC


Attachments (Terms of Use)

Description Miljan Karadzic 2012-02-13 14:23:14 UTC
Description of problem:

pulp-admin package update does not return correct list of updated packages. The list is always the same regardless if any packages were updated or not.

The problem exists for both single consumer and consumer group update since the same code exists for both.


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

Server:
gofer-0.64-1.el6.noarch
gofer-package-0.64-1.el6.noarch
m2crypto-0.21.1.pulp-5.el6.x86_64
mod_wsgi-3.2-6.pulp.el6.x86_64
pulp-0.0.254-8.el6.noarch
pulp-admin-0.0.254-8.el6.noarch
pulp-client-lib-0.0.254-8.el6.noarch
pulp-common-0.0.254-8.el6.noarch
pulp-selinux-server-0.0.254-8.el6.noarch
python-gofer-0.64-1.el6.noarch
python-oauth2-1.5.170-2.pulp.el6.noarch

Consumer:
gofer-0.64-1.el6.noarch
gofer-package-0.64-1.el6.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
pulp-client-lib-0.0.254-8.el6.noarch
pulp-common-0.0.254-8.el6.noarch
pulp-consumer-0.0.254-8.el6.noarch
python-gofer-0.64-1.el6.noarch


Steps to Reproduce:
1. pulp-admin package update --consumergroupid current

  
Actual results:

# pulp-admin package update --consumergroupid current
Created job id: c5dd685c-f0a4-4341-85f6-830bf2d567ba
Waiting: [\] 
Update Summary:
	[ FINISHED ] pulp-consumer1: [2] packages updated:
	             d
	             r

Expected results:

# pulp-admin package update --consumergroupid current
Created job id: 4175ae1d-8bda-4309-aa48-a2d282e7a92c
Waiting: [\] 
Update Summary:
	[ FINISHED ] pulp-consumer1: [7] packages updated:
	             gofer
	             gofer-package
	             m2crypto
	             pulp-client-lib
	             pulp-common
	             pulp-consumer
	             python-gofer


Additional info:

Consumer returns following data as a return value:

retval: {'updated': {'resolved': [], 'deps': []}, 'reboot_scheduled': False}

retval['updated'] is a dictionary containing keys 'resolved' and 'deps', however pulp-admin expects it to be a list (hence 'd' and 'r' in the broken output above).

Following patch resolves the problem:

--- /usr/lib/python2.6/site-packages/pulp/client/admin/plugins/package.py.old	2012-02-13 13:34:28.588896377 +0000
+++ /usr/lib/python2.6/site-packages/pulp/client/admin/plugins/package.py	2012-02-13 14:15:15.075558871 +0000
@@ -255,9 +255,9 @@
             printwait()
             task = self.task_api.info(task['id'])
         if task_succeeded(task):
-            updated = task['result']['updated']
+            updated = task['result']['updated']['resolved']
             print _('\n[%d] packages:') % len(updated)
-            for u in sorted([u[0] for u in updated]):
+            for u in sorted([u['name'] for u in updated]):
                 print '  %s' % u
             print _('\nupdated on %s') % id
         else:
@@ -290,8 +290,8 @@
                 details = str(exception)
                 print _('\t[ %-8s ] %s: failed: %s') % (state.upper(), id, details)
                 continue
-            updated = t['result']['updated']
-            pkgs = sorted([u[0] for u in updated])
+            updated = t['result']['updated']['resolved']
+            pkgs = sorted([u['name'] for u in updated])
             print _('\t[ %-8s ] %s: [%d] packages updated:') % \
                 (state.upper(), id, len(pkgs))
             for p in pkgs:

The patch could be improved to include the list of dependencies in the output.

Comment 1 Jeff Ortel 2012-02-14 23:09:23 UTC
The pulp-admin CLI was updated in 0.257 to take advantage of extra information being returned from the agent in response to package install requests.  The agent changes were done in gofer-package 0.64.  The pulp-admin-0.0.254-8 package (which you have installed) requires gofer = 0.63 but the pulp.spec requires it as >= 0.63 which would permit gofer to be upgraded to: 0.64.  This is causing an API mismatch.

I would suggest you either downgrade gofer-package to: 0.63 or update pulp to 0.257+.  We intend to release 1.0 very soon so I'd recommend waiting until then or downgrading gofer.  Your decision.

The community release (yum) repository contains the proper (compatible) versions: http://repos.fedorapeople.org/repos/pulp/pulp/6Server/x86_64/

Verified using pulp 0.266 & gofer 0.65.


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