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 1075239 - Sometimes searching by organization name fails in the CLI
Summary: Sometimes searching by organization name fails in the CLI
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Adam Price
QA Contact: Og Maciel
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-11 20:06 UTC by Og Maciel
Modified: 2016-07-07 18:02 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-07 18:02:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Og Maciel 2014-03-11 20:06:43 UTC
Description of problem:

Some organizations can be searched by its label but some cannot

[root@qetello01 ~]# for i in 1 237 238 239; do hammer organization info --id $i; doneId:           1
Name:         ACME_Corporation
Created at:   2014/03/11 11:52:55
Updated at:   2014/03/11 11:52:57
Label:        ACME_Corporation
Description:  ACME_Corporation Organization

Id:           237
Name:         UsXFwNaOfX
Created at:   2014/03/11 19:39:44
Updated at:   2014/03/11 19:39:44
Label:        cVWdVcyYZt
Description:  KazlPHntdv

Id:           238
Name:         ÝçñèòáËïÆÌ
Created at:   2014/03/11 19:39:55
Updated at:   2014/03/11 19:39:55
Label:        zbZgDASqLZ
Description:  ìÄÏÃÞÅòïëÝ

Id:           239
Name:         睆闓嵠擑鼉鼠缨桳鴖鵓
Created at:   2014/03/11 19:40:05
Updated at:   2014/03/11 19:40:06
Label:        yfeNvcuDTr
Description:  奺娥嬏诮虹鈦餶败茢輻

[root@qetello01 ~]# for i in ACME_Corporation cVWdVcyYZt zbZgDASqLZ yfeNvcuDTr; do LANG=en_US hammer -v -u admin -p changeme --output csv organization list --search='label="$i"' ; done
Id,Name,Label,Description
Id,Name,Label,Description
Id,Name,Label,Description
Id,Name,Label,Description

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

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.8.33-1.el6.noarch
* candlepin-selinux-0.8.33-1.el6.noarch
* candlepin-tomcat6-0.8.33-1.el6.noarch
* elasticsearch-0.90.10-4.el6.noarch
* foreman-1.5.0-0.develop.201403071828gite4d8817.el6.noarch
* foreman-postgresql-1.5.0-0.develop.201403071828gite4d8817.el6.noarch
* foreman-proxy-1.5.0-0.develop.201402201704gita25e7b9.el6.noarch
* foreman-release-1.5.0-0.develop.201403071828gite4d8817.el6.noarch
* foreman-selinux-1.5.0-0.develop.201402261344git2f43f94.el6.noarch
* katello-1.5.0-14.201403071827git0bda7f5.el6.noarch
* katello-apache-1.0-1.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.2-1.el6.noarch
* katello-installer-0.0.19-1.201403072013gita7ceec1.el6.noarch
* katello-repos-1.5.1-1.git.14.0868bd1.el6.noarch
* openldap-2.4.23-31.el6.x86_64
* pulp-katello-plugins-0.2-1.el6.noarch
* pulp-nodes-common-2.3.1-1.el6.noarch
* pulp-nodes-parent-2.3.1-1.el6.noarch
* pulp-puppet-plugins-2.3.1-1.el6.noarch
* pulp-rpm-plugins-2.3.1-1.el6.noarch
* pulp-selinux-2.3.1-1.el6.noarch
* pulp-server-2.3.1-1.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.2.2-2.el6.noarch
* ruby193-rubygem-net-ldap-0.3.1-1.el6.noarch
* ruby193-rubygem-runcible-1.0.8-1.el6.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Processing by Katello::Api::V2::OrganizationsController#index as JSON
  Parameters: {"api_version"=>"v2", "organization"=>{}}
Authorized user admin(Admin User)
  Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/views/katello/api/v2/organizations/index.json.rabl within api/v2/layouts/index_layout (21.9ms)
Completed 200 OK in 84ms (Views: 23.3ms | ActiveRecord: 17.4ms)
Processing by Katello::Api::V2::OrganizationsController#index as JSON
  Parameters: {"search"=>"label=\"zbZgDASqLZ\"", "sort"=>"", "api_version"=>"v2", "organization"=>{}}
Authorized user admin(Admin User)
  Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/views/katello/api/v2/organizations/index.json.rabl within api/v2/layouts/index_layout (3.0ms)
Completed 200 OK in 58ms (Views: 6.1ms | ActiveRecord: 13.4ms)

Comment 1 RHEL Program Management 2014-03-11 20:25:09 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Og Maciel 2014-03-11 22:58:21 UTC
The following patches are part of a possible fix for this issue:

* https://gist.github.com/anonymous/9494008
* https://gist.github.com/anonymous/9494038

Comment 4 Amit Karsale 2016-06-22 12:30:45 UTC
I have tried the command 

`for i in ACME_Corporation cVWdVcyYZt zbZgDASqLZ yfeNvcuDTr; do LANG=en_US hammer -v -u admin -p changeme --output csv organization list --search='label="$i"' ; done`

for listing the organization by their labels, to my observation the single quotes which we are using with 'label="$i"' is not needed, without the single quotes it gives you the organization list w.r.t the labels passed.

So the required command would be 

`for i in ACME_Corporation cVWdVcyYZt zbZgDASqLZ yfeNvcuDTr; do LANG=en_US hammer -v -u admin -p changeme --output csv organization list --search=label="$i" ; done`

Explanation why the single quote didnt worked: anything passed in single quotes dont interpolate the string within it, so $i in our case is treated as $i and not replaced with the actual label.

can you verify the solution on your latest Satellite build and acknowledge please?

Comment 5 Og Maciel 2016-07-07 18:02:37 UTC
Hi Amit,

Thank you for looking into this, you are absolutely right about my mistake (variable not 'expanding' inside the single quotes). I tried the same command again, and sure enough things work as expected.

Thank you again for your help.

Og


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