Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1380595

Summary: hammer package list throws error "bind message supplies 2 parameters" with options environment and content-view-version
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: RepositoriesAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, bvassova, cdonnell, dcaplan, dhawke, ehelms, jcallaha, nshaik, omaciel, oshtaier, rankumar, tstrachota, yundtj
Target Milestone: UnspecifiedKeywords: PrioBumpPM, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-hammer-cli-katello-0.11.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 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:
Attachments:
Description Flags
Hammer log
none
Production log
none
publish task
none
latest debug log none

Description Ranjan Kumar 2016-09-30 04:30:42 UTC
Description of problem: hammer package list with option environment and content-view-version-id raise an exception.

root@sat ~]# hammer package list --content-view upmc-6.7-x86_64 --environment test  --organization Redhat --content-view-version 16

ERROR:  bind message supplies 2 parameters, but prepared statement "a124" requires 1

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


How reproducible: always

Actual results: bind message supplies 2 parameters, but prepared statement "a124" requires 1


Expected results: should list packages of given content view version


Additional info:

Comment 2 Brad Buckingham 2016-10-27 20:53:17 UTC
Hi Ranjan,

Were you able to reproduce the issue described?

Would it be possible to obtain the debug output from hammer?  (e.g. -vd) 

In addition, the specific section of the production.log when the command is executed would be useful.

Comment 3 Ranjan Kumar 2016-10-28 04:17:08 UTC
Created attachment 1214814 [details]
Hammer log

Comment 4 Ranjan Kumar 2016-10-28 04:17:29 UTC
Created attachment 1214815 [details]
Production log

Comment 5 Ranjan Kumar 2016-10-28 04:20:43 UTC
Hello Brad,

Uploaded required log files.

Comment 6 Brad Buckingham 2016-11-02 15:27:05 UTC
Hi Ranjan,

Looking at the hammer log, it appears that the package listing is being done on content view version with id=53.  In that log, I also see it retrieve the list of versions (GET /katello/api/content_views/8/content_view_versions) and it looks like the following error may have been reported for that version:

[0] "PLP0034: The distributor Redhat-Library-ranjan indicated a failed response when publishing repository Redhat-Library-ranjan."

It is very likely that the package listing is failing due to the error publishing the version.  Can you confirm that the content view version was published correctly?

Comment 7 Ranjan Kumar 2016-11-03 06:13:06 UTC
Yes, content view was published correctly. This issue occurs only when the options environment-id is used. uploaded debug log with environment and without environment and screen shot of content view publish task.

Comment 8 Ranjan Kumar 2016-11-03 06:13:52 UTC
Created attachment 1216851 [details]
publish task

Comment 9 Ranjan Kumar 2016-11-03 06:15:53 UTC
Created attachment 1216852 [details]
latest debug log

Comment 11 Nagoor Shaik 2017-04-05 06:26:01 UTC
Basically it seems that it doesn't like the --environment switch in the hammer command 


WORKING :-

# hammer package list --content-view-id 11 --content-view-version-id 1
------|---------------------------------------------
ID    | FILENAME                                    
------|---------------------------------------------
4313  | 389-ds-base-1.3.1.6-25.el7.x86_64.rpm       
5975  | 389-ds-base-1.3.1.6-26.el7_0.x86_64.rpm     
16474 | 389-ds-base-1.3.3.1-13.el7.x86_64.rpm       
9965  | 389-ds-base-1.3.3.1-13.el7.x86_64.rpm       
1696  | 389-ds-base-1.3.3.1-15.el7_1.x86_64.rpm     
332   | 389-ds-base-1.3.3.1-16.el7_1.x86_64.rpm     
1219  | 389-ds-base-1.3.3.1-20.el7_1.x86_64.rpm     
3191  | 389-ds-base-1.3.3.1-23.el7_1.x86_64.rpm     
15391 | 389-ds-base-1.3.4.0-19.el7.x86_64.rpm       
570   | 389-ds-base-1.3.4.0-19.el7.x86_64.rpm       
7377  | 389-ds-base-1.3.4.0-21.el7_2.x86_64.rpm     
3228  | 389-ds-base-1.3.4.0-26.el7_2.x86_64.rpm     
7667  | 389-ds-base-1.3.4.0-29.el7_2.x86_64.rpm     
10532 | 389-ds-base-1.3.4.0-30.el7_2.x86_64.rpm     
18309 | 389-ds-base-1.3.4.0-32.el7_2.x86_64.rpm     
18411 | 389-ds-base-1.3.4.0-33.el7_2.x86_64.rpm     
21609 | 389-ds-base-1.3.5.10-11.el7.x86_64.rpm      
20007 | 389-ds-base-1.3.5.10-11.el7.x86_64.rpm      
19436 | 389-ds-base-1.3.5.10-12.el7_3.x86_64.rpm    
20919 | 389-ds-base-1.3.5.10-15.el7_3.x86_64.rpm    
8385  | 389-ds-base-libs-1.3.1.6-25.el7.x86_64.rpm  
6227  | 389-ds-base-libs-1.3.1.6-26.el7_0.x86_64.rpm
17668 | 389-ds-base-libs-1.3.3.1-13.el7.x86_64.rpm  
9412  | 389-ds-base-libs-1.3.3.1-13.el7.x86_64.rpm  
3187  | 389-ds-base-libs-1.3.3.1-15.el7_1.x86_64.rpm
238   | 389-ds-base-libs-1.3.3.1-16.el7_1.x86_64.rpm
6996  | 389-ds-base-libs-1.3.3.1-20.el7_1.x86_64.rpm
4261  | 389-ds-base-libs-1.3.3.1-23.el7_1.x86_64.rpm
14221 | 389-ds-base-libs-1.3.4.0-19.el7.x86_64.rpm  
7856  | 389-ds-base-libs-1.3.4.0-19.el7.x86_64.rpm  
------|---------------------------------------------

NON-WORKING :- 

# hammer package list --content-view-id 11 --content-view-version-id 1 --environment Library --organization-id 1
ERROR:  bind message supplies 2 parameters, but prepared statement "a42" requires 1

Comment 13 Brad Buckingham 2017-06-19 14:46:01 UTC
Created redmine issue http://projects.theforeman.org/issues/20046 from this bug

Comment 14 Brad Buckingham 2017-07-11 20:20:23 UTC
PR just merged upstream, moving to POST.

Comment 15 Satellite Program 2017-08-03 22:04:16 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20046 has been resolved.

Comment 16 Oleksandr Shtaier 2017-08-07 20:36:52 UTC
Failed QA:
katello-3.4.4-2.el7sat.noarch
tfm-rubygem-katello-3.4.4-1.el7sat.noarch

Initial PR that marked as one that resolving current defect:
https://github.com/Katello/hammer-cli-katello/pull/501

In its description next problem is mentioned:
$ hammer package list --organization-id 1
Error: found more than one repository

It is fixed properly:
hammer -v -u admin -p changeme package list --organization-id='3'
------|-------------------------------|---------------------------
ID    | FILENAME                      | SOURCE RPM                
------|-------------------------------|---------------------------
22032 | bear-4.1-1.noarch.rpm         | bear-4.1-1.src.rpm        
22041 | camel-0.1-1.noarch.rpm        | camel-0.1-1.src.rpm       
22038 | cat-1.0-1.noarch.rpm          | cat-1.0-1.src.rpm         
22029 | cheetah-1.25.3-5.noarch.rpm   | cheetah-1.25.3-5.src.rpm
...

But problem in current BZ and in http://projects.theforeman.org/issues/20046 is not fixed:

hammer package list --content-view upmc-6.7-x86_64 --environment test  --organization Redhat --content-view-version 16
Error: Unrecognised option '--content-view'

hammer package list --organization "Default Organization" --environment dev --content-view-version "1.0"
Error: found more than one content_view_version

hammer -v -u admin -p changeme package list --content-view-version="1.0" environment-id="3"
[ERROR 2017-08-07 15:07:02 Exception] Error: too many arguments

hammer -v -u admin -p changeme package list --content-view-version="1.0" organization-id='3'
[ERROR 2017-08-07 15:07:48 Exception] Error: too many arguments

hammer -v -u admin -p changeme package list --content-view-version="1.0" organization='hT5SCE'
[ERROR 2017-08-07 15:08:11 Exception] Error: too many arguments

Comment 17 Andrew Kofink 2017-08-25 13:26:43 UTC
I linked Foreman issue 20091. It is required along with 20046 to fix this issue.

Comment 18 Brad Buckingham 2017-09-22 12:39:31 UTC
*** Bug 1410243 has been marked as a duplicate of this bug. ***

Comment 19 Og Maciel 2017-11-28 20:38:52 UTC
Running command with no pagination may take a while but it does return all packages. Here's a sample:

# hammer package list --organization 'São Paulo' --content-view rhel-7-server-x86_64-cv --environment Library --content-view-version '1.0'
------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------
ID    | FILENAME                                                                         | SOURCE RPM
------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------
62949 | 389-ds-base-1.3.1.6-25.el7.x86_64.rpm                                            | 389-ds-base-1.3.1.6-25.el7.src.rpm
71998 | 389-ds-base-1.3.1.6-26.el7_0.x86_64.rpm                                          | 389-ds-base-1.3.1.6-26.el7_0.src.rpm
55972 | 389-ds-base-1.3.3.1-13.el7.x86_64.rpm                                            | 389-ds-base-1.3.3.1-13.el7.src.rpm
65121 | 389-ds-base-1.3.3.1-15.el7_1.x86_64.rpm                                          | 389-ds-base-1.3.3.1-15.el7_1.src.rpm
64742 | 389-ds-base-1.3.3.1-16.el7_1.x86_64.rpm                                          | 389-ds-base-1.3.3.1-16.el7_1.src.rpm
80874 | 389-ds-base-1.3.3.1-20.el7_1.x86_64.rpm                                          | 389-ds-base-1.3.3.1-20.el7_1.src.rpm
68149 | 389-ds-base-1.3.3.1-23.el7_1.x86_64.rpm                                          | 389-ds-base-1.3.3.1-23.el7_1.src.rpm
63199 | 389-ds-base-1.3.4.0-19.el7.x86_64.rpm                                            | 389-ds-base-1.3.4.0-19.el7.src.rpm
63353 | 389-ds-base-1.3.4.0-21.el7_2.x86_64.rpm                                          | 389-ds-base-1.3.4.0-21.el7_2.src.rpm
67915 | 389-ds-base-1.3.4.0-26.el7_2.x86_64.rpm                                          | 389-ds-base-1.3.4.0-26.el7_2.src.rpm


Pagination also works:

# hammer package list --organization 'São Paulo' --content-view rhel-7-server-x86_64-cv --environment Library --content-view-version '1.0' --per-page 10 --page 1
------|-----------------------------------------|-------------------------------------
ID    | FILENAME                                | SOURCE RPM
------|-----------------------------------------|-------------------------------------
62949 | 389-ds-base-1.3.1.6-25.el7.x86_64.rpm   | 389-ds-base-1.3.1.6-25.el7.src.rpm
71998 | 389-ds-base-1.3.1.6-26.el7_0.x86_64.rpm | 389-ds-base-1.3.1.6-26.el7_0.src.rpm
55972 | 389-ds-base-1.3.3.1-13.el7.x86_64.rpm   | 389-ds-base-1.3.3.1-13.el7.src.rpm
65121 | 389-ds-base-1.3.3.1-15.el7_1.x86_64.rpm | 389-ds-base-1.3.3.1-15.el7_1.src.rpm
64742 | 389-ds-base-1.3.3.1-16.el7_1.x86_64.rpm | 389-ds-base-1.3.3.1-16.el7_1.src.rpm
80874 | 389-ds-base-1.3.3.1-20.el7_1.x86_64.rpm | 389-ds-base-1.3.3.1-20.el7_1.src.rpm
68149 | 389-ds-base-1.3.3.1-23.el7_1.x86_64.rpm | 389-ds-base-1.3.3.1-23.el7_1.src.rpm
63199 | 389-ds-base-1.3.4.0-19.el7.x86_64.rpm   | 389-ds-base-1.3.4.0-19.el7.src.rpm
63353 | 389-ds-base-1.3.4.0-21.el7_2.x86_64.rpm | 389-ds-base-1.3.4.0-21.el7_2.src.rpm
67915 | 389-ds-base-1.3.4.0-26.el7_2.x86_64.rpm | 389-ds-base-1.3.4.0-26.el7_2.src.rpm
------|-----------------------------------------|-------------------------------------
Page 1 of 2255 (use --page and --per-page for navigation)


# hammer package list --organization 'São Paulo' --content-view rhel-7-server-x86_64-cv --environment Library --content-view-version '1.0' --per-page 10 --page 2253
------|------------------------------------|----------------------------
ID    | FILENAME                           | SOURCE RPM
------|------------------------------------|----------------------------
59049 | zlib-devel-1.2.7-13.el7.i686.rpm   | zlib-1.2.7-13.el7.src.rpm
42811 | zlib-devel-1.2.7-13.el7.x86_64.rpm | zlib-1.2.7-13.el7.src.rpm
77631 | zlib-devel-1.2.7-15.el7.x86_64.rpm | zlib-1.2.7-15.el7.src.rpm
65132 | zlib-devel-1.2.7-15.el7.i686.rpm   | zlib-1.2.7-15.el7.src.rpm
68660 | zlib-devel-1.2.7-17.el7.i686.rpm   | zlib-1.2.7-17.el7.src.rpm
50089 | zlib-devel-1.2.7-17.el7.x86_64.rpm | zlib-1.2.7-17.el7.src.rpm
18447 | zlib-devel-1.2.7-17.el7.i686.rpm   | zlib-1.2.7-17.el7.src.rpm
11366 | zlib-devel-1.2.7-17.el7.x86_64.rpm | zlib-1.2.7-17.el7.src.rpm
38928 | zsh-5.0.2-7.el7.x86_64.rpm         | zsh-5.0.2-7.el7.src.rpm
57610 | zsh-5.0.2-7.el7_1.1.x86_64.rpm     | zsh-5.0.2-7.el7_1.1.src.rpm
------|------------------------------------|----------------------------
Page 2253 of 2255 (use --page and --per-page for navigation)

Comment 20 Og Maciel 2017-11-28 20:39:33 UTC
Verified on satellite-6.3.0-21.0.beta.el7sat.noarch

Comment 21 Satellite Program 2018-02-21 16:54:37 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> > 
> > For information on the advisory, and where to find the updated files, follow the link below.
> > 
> > If the solution does not work for you, open a new bug report.
> > 
> > https://access.redhat.com/errata/RHSA-2018:0336