Bug 1403947

Summary: hammer erratum list --organization-id : exception if organization has more one product or product repositories
Product: Red Hat Satellite Reporter: Djebran Lezzoum <dlezzoum>
Component: Errata ManagementAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Renzo Nuccitelli <rnuccite>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, cfouant, dhlavacd, dlezzoum, ehelms, jcallaha, rnuccite, tstrachota
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
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 17:11:38 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:

Description Djebran Lezzoum 2016-12-12 16:57:42 UTC
Description of problem:
hammer erratum list --organization-id : exception if organization has more one product or product repositories

Version-Release number of selected component (if applicable):
* candlepin-0.9.54.14-1.el7.noarch
* candlepin-selinux-0.9.54.14-1.el7.noarch
* foreman-1.13.2.1-2.el7sat.noarch
* foreman-compute-1.13.2.1-2.el7sat.noarch
* foreman-debug-1.13.2.1-2.el7sat.noarch
* foreman-discovery-image-3.1.1-16.el7sat.noarch
* foreman-ec2-1.13.2.1-2.el7sat.noarch
* foreman-gce-1.13.2.1-2.el7sat.noarch
* foreman-installer-1.13.2-1.el7sat.noarch
* foreman-installer-katello-3.2.1-1.el7sat.noarch
* foreman-libvirt-1.13.2.1-2.el7sat.noarch
* foreman-openstack-1.13.2.1-2.el7sat.noarch
* foreman-ovirt-1.13.2.1-2.el7sat.noarch
* foreman-postgresql-1.13.2.1-2.el7sat.noarch
* foreman-proxy-1.13.2-1.el7sat.noarch
* foreman-rackspace-1.13.2.1-2.el7sat.noarch
* foreman-selinux-1.13.2-1.el7sat.noarch
* foreman-vmware-1.13.2.1-2.el7sat.noarch
* katello-3.2.0-3.el7sat.noarch
* katello-certs-tools-2.4.0-1.el7sat.noarch
* katello-client-bootstrap-1.2.2-2.el7sat.noarch
* katello-common-3.2.0-3.el7sat.noarch
* katello-debug-3.2.0-3.el7sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-base-3.2.1-1.el7sat.noarch
* katello-selinux-3.0.1-1.el7sat.noarch
* katello-server-ca-1.0-1.noarch
* katello-service-3.2.0-3.el7sat.noarch
* openldap-2.4.40-13.el7.x86_64
* pulp-client-1.0-1.noarch
* pulp-docker-plugins-2.0.4-1.el7sat.noarch
* pulp-katello-1.0.2-1.el7sat.noarch
* pulp-ostree-plugins-1.1.3-1.el7sat.noarch
* pulp-puppet-plugins-2.9.3-1.el7sat.noarch
* pulp-puppet-tools-2.9.3-1.el7sat.noarch
* pulp-rpm-plugins-2.9.3-1.el7sat.noarch
* pulp-selinux-2.9.3-2.el7sat.noarch
* pulp-server-2.9.3-2.el7sat.noarch
* python-ldap-2.4.15-2.el7.x86_64
* tfm-rubygem-ldap_fluff-0.4.3-1.el7sat.noarch
* tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch


How reproducible:
Always

Steps to Reproduce:
1.Create one organization - Org.
2. Create 2 products with one repository in each product and synchronize them.
   Make sure both the repositories have some erratum.
3. Now run the cli command:
   hammer erratum list --organization-id="Org-id"

where Org-id is the id or Org return by hammer when created the Org

Actual results:
HammerCLIForeman::ResolverError (found more than one repository):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/id_resolver.rb:209:in `pick_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/id_resolver.rb:168:in `find_resource'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.1.2/lib/hammer_cli_katello/id_resolver.rb:85:in `repository_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:154:in `get_resource_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:223:in `block in customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:220:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:220:in `customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:244:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.8.0/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:280:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.8.0/lib/hammer_cli_foreman/commands.rb:303:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.8.0/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.8.0/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.8.0/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.8.0/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


Expected results:
hammer should return the erratum info of all Org products repositories

Additional info:
1. the same error is returned if a product contain 2 repositories
   e.g. hammer erratum list --product-id="Product-id" 
   where Product-id is the product id that contain 2 repositories
2. on 6.2 this command work as expected

Comment 3 Christine Fouant 2017-07-19 19:06:52 UTC
Hammer erratum list by organization has been fixed by https://github.com/Katello/hammer-cli-katello/pull/502

Hammer erratum list by product would be a new feature request rather than a regression. It currently works as designed. Could you open up a new BZ to enhance hammer erratum command to honor the product-id?

Comment 4 Djebran Lezzoum 2017-07-20 16:13:37 UTC
Hi Christine, 

Ok will open a new bug for product-id,

Concerning this bug, for the moment it's failing on the latest 6.3 build,
wait next 6.3 build to verify

Comment 5 Djebran Lezzoum 2017-08-09 12:48:47 UTC
This test is still failing

Versions:
* candlepin-2.0.40-1.el7.noarch
* candlepin-selinux-2.0.40-1.el7.noarch
* foreman-1.15.2-1.el7sat.noarch
* foreman-cli-1.15.2-1.el7sat.noarch
* foreman-compute-1.15.2-1.el7sat.noarch
* foreman-debug-1.15.2-1.el7sat.noarch
* foreman-discovery-image-3.1.1-22.el7sat.noarch
* foreman-ec2-1.15.2-1.el7sat.noarch
* foreman-gce-1.15.2-1.el7sat.noarch
* foreman-installer-1.15.2-1.el7sat.noarch
* foreman-installer-katello-3.4.4-1.el7sat.noarch
* foreman-libvirt-1.15.2-1.el7sat.noarch
* foreman-openstack-1.15.2-1.el7sat.noarch
* foreman-ovirt-1.15.2-1.el7sat.noarch
* foreman-postgresql-1.15.2-1.el7sat.noarch
* foreman-proxy-1.15.2-1.el7sat.noarch
* foreman-rackspace-1.15.2-1.el7sat.noarch
* foreman-selinux-1.15.2-1.el7sat.noarch
* foreman-vmware-1.15.2-1.el7sat.noarch
* katello-3.4.4-2.el7sat.noarch
* katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-4.noarch
* katello-certs-tools-2.4.0-1.el7sat.noarch
* katello-client-bootstrap-1.4.0-1.el7sat.noarch
* katello-common-3.4.4-2.el7sat.noarch
* katello-debug-3.4.4-2.el7sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-base-3.4.4-1.el7sat.noarch
* katello-selinux-3.0.2-1.el7sat.noarch
* katello-server-ca-1.0-1.noarch
* katello-service-3.4.4-2.el7sat.noarch
* openldap-2.4.44-5.el7.x86_64
* pulp-client-1.0-1.noarch
* pulp-docker-plugins-2.3.0-1.el7sat.noarch
* pulp-katello-1.0.2-1.el7sat.noarch
* pulp-ostree-plugins-1.2.1-1.el7sat.noarch
* pulp-puppet-plugins-2.12.2-1.el7sat.noarch
* pulp-puppet-tools-2.12.2-1.el7sat.noarch
* pulp-rpm-plugins-2.12.2-2.el7sat.noarch
* pulp-selinux-2.12.2-2.el7sat.noarch
* pulp-server-2.12.2-2.el7sat.noarch
* python-ldap-2.4.15-2.el7.x86_64
* tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch
* tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch



automation log
_______________________________________________________________________
2017-08-05 11:10:59 - robottelo.ssh - INFO - >>> LANG=en_US.UTF-8  hammer -v -u admin -p changeme --output=csv erratum list --organization-id="92" --per-page="10000"
2017-08-05 11:11:01 - robottelo.ssh - INFO - <<< stderr
[ERROR 2017-08-05 11:11:01 Exception] Error: found more than one repository
Error: found more than one repository
[ERROR 2017-08-05 11:11:01 Exception] 

HammerCLIForeman::ResolverError (found more than one repository):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/id_resolver.rb:209:in `pick_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/id_resolver.rb:168:in `find_resource'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.10.0/lib/hammer_cli_katello/id_resolver.rb:83:in `repository_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:130:in `get_resource_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:199:in `block in customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:196:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:196:in `customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:220:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:256:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:279:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 6 Christine Fouant 2017-08-16 15:22:50 UTC
(In reply to Djebran Lezzoum from comment #5)
> This test is still failing
> 
> Versions:
> * candlepin-2.0.40-1.el7.noarch
> * candlepin-selinux-2.0.40-1.el7.noarch
> * foreman-1.15.2-1.el7sat.noarch
> * foreman-cli-1.15.2-1.el7sat.noarch
> * foreman-compute-1.15.2-1.el7sat.noarch
> * foreman-debug-1.15.2-1.el7sat.noarch
> * foreman-discovery-image-3.1.1-22.el7sat.noarch
> * foreman-ec2-1.15.2-1.el7sat.noarch
> * foreman-gce-1.15.2-1.el7sat.noarch
> * foreman-installer-1.15.2-1.el7sat.noarch
> * foreman-installer-katello-3.4.4-1.el7sat.noarch
> * foreman-libvirt-1.15.2-1.el7sat.noarch
> * foreman-openstack-1.15.2-1.el7sat.noarch
> * foreman-ovirt-1.15.2-1.el7sat.noarch
> * foreman-postgresql-1.15.2-1.el7sat.noarch
> * foreman-proxy-1.15.2-1.el7sat.noarch
> * foreman-rackspace-1.15.2-1.el7sat.noarch
> * foreman-selinux-1.15.2-1.el7sat.noarch
> * foreman-vmware-1.15.2-1.el7sat.noarch
> * katello-3.4.4-2.el7sat.noarch
> * katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-4.noarch
> * katello-certs-tools-2.4.0-1.el7sat.noarch
> * katello-client-bootstrap-1.4.0-1.el7sat.noarch
> * katello-common-3.4.4-2.el7sat.noarch
> * katello-debug-3.4.4-2.el7sat.noarch
> * katello-default-ca-1.0-1.noarch
> * katello-installer-base-3.4.4-1.el7sat.noarch
> * katello-selinux-3.0.2-1.el7sat.noarch
> * katello-server-ca-1.0-1.noarch
> * katello-service-3.4.4-2.el7sat.noarch
> * openldap-2.4.44-5.el7.x86_64
> * pulp-client-1.0-1.noarch
> * pulp-docker-plugins-2.3.0-1.el7sat.noarch
> * pulp-katello-1.0.2-1.el7sat.noarch
> * pulp-ostree-plugins-1.2.1-1.el7sat.noarch
> * pulp-puppet-plugins-2.12.2-1.el7sat.noarch
> * pulp-puppet-tools-2.12.2-1.el7sat.noarch
> * pulp-rpm-plugins-2.12.2-2.el7sat.noarch
> * pulp-selinux-2.12.2-2.el7sat.noarch
> * pulp-server-2.12.2-2.el7sat.noarch
> * python-ldap-2.4.15-2.el7.x86_64
> * tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch
> * tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch
> 
> 
> 
> automation log
> _______________________________________________________________________
> 2017-08-05 11:10:59 - robottelo.ssh - INFO - >>> LANG=en_US.UTF-8  hammer -v
> -u admin -p changeme --output=csv erratum list --organization-id="92"
> --per-page="10000"
> 2017-08-05 11:11:01 - robottelo.ssh - INFO - <<< stderr
> [ERROR 2017-08-05 11:11:01 Exception] Error: found more than one repository
> Error: found more than one repository
> [ERROR 2017-08-05 11:11:01 Exception] 
> 
> HammerCLIForeman::ResolverError (found more than one repository):
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/id_resolver.rb:209:in `pick_result'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/id_resolver.rb:168:in `find_resource'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.10.0/lib/
> hammer_cli_katello/id_resolver.rb:83:in `repository_id'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:130:in `get_resource_id'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:199:in `block in customized_options'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:196:in `each'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:196:in `customized_options'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:220:in `request_params'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/
> hammer_cli/apipie/command.rb:43:in `send_request'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:166:in `send_request'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:256:in `send_request'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/
> hammer_cli_foreman/commands.rb:279:in `execute'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.
> rb:68:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/
> hammer_cli/abstract.rb:29:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/
> subcommand/execution.rb:11:in `execute'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.
> rb:68:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/
> hammer_cli/abstract.rb:29:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/
> subcommand/execution.rb:11:in `execute'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.
> rb:68:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/
> hammer_cli/abstract.rb:29:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.
> rb:133:in `run'
>    
> /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/bin/hammer:
> 147:in `<top (required)>'
>     /usr/bin/hammer:23:in `load'
>     /usr/bin/hammer:23:in `<main>'

Did you bring in the code from the attached foreman issue? The errors you're showing are the ones before the fix from the attached foreman issue.

Comment 7 Djebran Lezzoum 2017-08-22 14:41:40 UTC
Hi Christine, checked the lasted satellite snap 12, that fix is not shipped.

Comment 8 Brad Buckingham 2017-08-28 11:34:27 UTC
Moving to POST and setting 'Fixed in Version' to katello-3.5.0, based upon the status of the upstream issue.

Comment 9 Renzo Nuccitelli 2017-09-26 16:11:52 UTC
Hammer is correctly listing errata by Organization on Satellite 6.3 snap 18. Also it can list erratum list present in a product, but only if it has only on repository. If it has more than one user must list errata list using also repository-id:

hammer erratum list --product-id=13 --repository-id=3

Once listing errata as a new feature as filled in another BZ, I'm moving this one to VERIFIED state.

Comment 10 Bryan Kearney 2018-02-21 17:11:38 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