Bug 1180644

Summary: hammer erratum list: Search with repository name fails
Product: Red Hat Satellite Reporter: sthirugn <sthirugn>
Component: HammerAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED CURRENTRELEASE QA Contact: sthirugn <sthirugn>
Severity: high Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham, bkearney
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9971
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:57:34 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:
Bug Depends On:    
Bug Blocks: 1130651, 1188301    

Description sthirugn@redhat.com 2015-01-09 15:49:05 UTC
Description of problem:
hammer erratum list: Search with repository name fails

Version-Release number of selected component (if applicable):
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.37-1.el6.noarch
* candlepin-common-1.0.17-1.el6.noarch
* candlepin-selinux-0.9.37-1.el6.noarch
* candlepin-tomcat6-0.9.37-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-compute-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-gce-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-libvirt-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-ovirt-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-postgresql-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-proxy-1.8.0-0.develop.201412301259gite2ce2a0.el6.noarch
* foreman-release-1.8.0-0.develop.201501051457git6529247.el6.noarch
* foreman-selinux-1.8.0-0.develop.201412151103gite2863e4.el6.noarch
* foreman-vmware-1.8.0-0.develop.201501051457git6529247.el6.noarch
* katello-2.1.0-1.201411061509gitb0b8f43.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.2.0-1.201412192027git113612b.el6.noarch
* katello-installer-base-2.2.0-1.201412192027git113612b.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* openldap-devel-2.4.23-32.el6_4.1.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.1-1.el6.noarch
* pulp-nodes-parent-2.5.1-1.el6.noarch
* pulp-puppet-plugins-2.5.1-1.el6.noarch
* pulp-puppet-tools-2.5.1-1.el6.noarch
* pulp-rpm-plugins-2.5.1-1.el6.noarch
* pulp-selinux-2.5.1-1.el6.noarch
* pulp-server-2.5.1-1.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.3-1.el6.noarch
* ruby193-rubygem-net-ldap-0.10.0-1.el6.noarch
* ruby193-rubygem-runcible-1.3.0-1.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create two orgs - Org1 and Org2. 
2. Create a repository and product in both the orgs and sync them. Make sure both the repos have some erratas.
Org1Product - Org1Repo
Org2Product - Org2Repo
2. Now run the cli command:
hammer> erratum list --repository=Org1Repo

Actual results:
The command runs without errors but displays all errata info from all repos (from Org2Repo) as well.  

But the following command displays right erratas.
hammer> erratum list --repository=Org1Repo --organization=Org1 --product=Org1Product

Expected results:
Make product info and org info mandatory when searching with repository name.

Additional info:
Alternatively the following command works fine:
hammer> erratum list --repository-id=7

Comment 2 Martin Bacovsky 2015-03-31 13:01:39 UTC
Created redmine issue http://projects.theforeman.org/issues/9971 from this bug

Comment 3 Bryan Kearney 2015-03-31 14:04:59 UTC
Upstream bug assigned to mbacovsk

Comment 4 Martin Bacovsky 2015-03-31 14:33:48 UTC
When hammer is trying to find out what id repository=Org1Repo has, it fails on missing organization. As repository_id is not mandatory parameter, the error is ignored and list command is performed without the repository_id filter. 

In the related PR I fixed the behaviour to *not* ignore search errors on non-mandatory parameters when they were specified by name on CLI.

With the fix the above mentioned list ends up with:

Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id

Comment 5 Bryan Kearney 2015-04-22 10:04:34 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9971 has been closed
-------------
Anonymous
Applied in changeset commit:hammer-cli-foreman|cb1470713ff4509620ce2eec12ea5ae62396f286.

Comment 8 sthirugn@redhat.com 2015-04-30 19:40:56 UTC
Verified.

Version Tested: 
Satellite-6.1.0-RHEL-6-20150429.2

# erratum list --repository=customrepo1 --product=customproduct1 --organization-id=1
-------------------------------------|----------------|----------|------------------
ID                                   | ERRATA ID      | TYPE     | TITLE            
-------------------------------------|----------------|----------|------------------
1eed8380-e7c9-4910-91b5-3821e8b3b8e7 | RHEA-2012:5629 | BugFix | 1_Erratum

Comment 9 Bryan Kearney 2015-08-11 13:22:04 UTC
This bug is slated to be released with Satellite 6.1.

Comment 10 Bryan Kearney 2015-08-12 13:57:34 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.