Bug 1380595 - hammer package list throws error "bind message supplies 2 parameters" with options environment and content-view-version
Summary: hammer package list throws error "bind message supplies 2 parameters" with op...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.2.0
Hardware: x86_64
OS: All
medium
medium
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: Og Maciel
URL:
Whiteboard:
: 1410243 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-30 04:30 UTC by Ranjan Kumar
Modified: 2021-06-10 11:34 UTC (History)
13 users (show)

Fixed In Version: tfm-rubygem-hammer-cli-katello-0.11.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Hammer log (38.87 KB, text/plain)
2016-10-28 04:17 UTC, Ranjan Kumar
no flags Details
Production log (23.02 KB, text/plain)
2016-10-28 04:17 UTC, Ranjan Kumar
no flags Details
publish task (90.47 KB, image/png)
2016-11-03 06:13 UTC, Ranjan Kumar
no flags Details
latest debug log (16.00 MB, text/plain)
2016-11-03 06:15 UTC, Ranjan Kumar
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20046 0 Normal Closed hammer package list no longer supports --content-view or --content-view-id 2020-08-27 18:52:49 UTC
Foreman Issue Tracker 20091 0 Normal Closed `hammer package list --organization-id` results in 'Error: found more than one repository' 2020-08-27 18:52:48 UTC

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


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