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 1107319

Summary: hammer content-view info does not filter by cv name
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: HammerAssignee: Adam Price <adprice>
Status: CLOSED CURRENTRELEASE QA Contact: Kedar Bidarkar <kbidarka>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, bkearney, jmontleo, kbidarka
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/6151
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 14:14:55 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:

Description Og Maciel 2014-06-09 21:41:28 UTC
Description of problem:

Using the hammer cli to find information about a content view from an organization by name doesn't seem to filter by the organization {id, name, label}. It looks like if your organization only has the Default Organization View, things work fine but if you have multiple CVs you get the stacktrace.

This affects upstream and downstream versions.

[root@qetello01 ~]# hammer -v -u admin -p changeme organization info --id=149
Id:                     149
Name:                   zid6x4k
Users:

Smart proxies:
    qetello01.usersys.redhat.com
Subnets:

Compute resources:

Installation media:

Templates:

Domains:

Environments:

Hostgroups:

Parameters:

Created at:             2014/06/09 21:23:22
Updated at:             2014/06/09 21:23:36
Label:                  zid6x4k
Description:
Red Hat Repository URL: https://cdn.redhat.com


# hammer -v -u admin -p changeme  content-view list --organization-id=149
----------------|---------------------------|---------------------------|-----------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------
189             | Default Organization View | Default_Organization_View |           |
190             | TodfPNNvaC                | TodfPNNvaC                |           |
----------------|---------------------------|---------------------------|-----------|---------------

# LANG=en_US hammer -v -u admin -p changeme  content-view info --name='Default Organization View' --organization zid6x4k
[ERROR 2014-06-09 17:32:16 Exception] Error: content_view found more than once
Error: content_view found more than once
[ERROR 2014-06-09 17:32:16 Exception]

HammerCLIForeman::ResolverError (content_view found more than once):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:109:in `pick_result'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:104:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:82:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:76:in `content_view_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:122:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:241:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:154:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:288:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19


# LANG=en_US hammer -v -u admin -p changeme  content-view info --name='Default Organization View' --organization-id 149
[ERROR 2014-06-09 17:32:55 Exception] Error: content_view found more than once
Error: content_view found more than once
[ERROR 2014-06-09 17:32:55 Exception]

HammerCLIForeman::ResolverError (content_view found more than once):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:109:in `pick_result'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:104:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:82:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:76:in `content_view_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:122:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:241:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:154:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:288:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

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

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.15-1.el6.noarch
* candlepin-selinux-0.9.15-1.el6.noarch
* candlepin-tomcat6-0.9.15-1.el6.noarch
* elasticsearch-0.90.10-4.el6.noarch
* foreman-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-compute-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-gce-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-libvirt-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-ovirt-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-postgresql-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-proxy-1.6.0-0.develop.201406020719git0007366.el6.noarch
* foreman-release-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* foreman-selinux-1.6.0-0.develop.201405301314git8ad6a63.el6.noarch
* foreman-vmware-1.6.0-0.develop.201406061204git1b726d4.el6.noarch
* katello-1.5.0-14.201406061917git5ddde60.el6.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.2-1.git.1.edab2c4.el6.noarch
* katello-installer-0.0.19-1.201406041328git82fa2d9.el6.noarch
* katello-repos-1.5.1-1.git.14.0868bd1.el6.noarch
* openldap-2.4.23-31.el6.x86_64
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.4.0-0.18.beta.el6.noarch
* pulp-nodes-parent-2.4.0-0.18.beta.el6.noarch
* pulp-puppet-plugins-2.4.0-0.18.beta.el6.noarch
* pulp-puppet-tools-2.4.0-0.18.beta.el6.noarch
* pulp-rpm-plugins-2.4.0-0.18.beta.el6.noarch
* pulp-selinux-2.4.0-0.18.beta.el6.noarch
* pulp-server-2.4.0-0.18.beta.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
* ruby193-rubygem-runcible-1.1.0-1.el6.noarch
* rubygem-hammer_cli-0.1.1-1.201406060838git35c7928.el6.noarch
* rubygem-hammer_cli_foreman-0.1.1-1.201406041305gitac7deb1.el6.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.2-1.201405270839git145bea1.git.0.f729008.el6.noarch
* rubygem-hammer_cli_katello-0.0.3-1.201405271430gitc178633.git.0.6be9e8e.el6.noarch

How reproducible:


Steps to Reproduce:
1. Create a simple content view to a brand new organization
2. Use hammer content-view info --organization <new_organization_name> --name 'Default Organization View'
3.

Actual results:

Stacktrace

Expected results:


Additional info:

# LANG=en_US hammer -v -d -u admin -p changeme  content-view info --name='Default Organization View' --organization-id 149
[ INFO 2014-06-09 17:35:09 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-06-09 17:35:09 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-09 17:35:09 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-09 17:35:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-06-09 17:35:09 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2014-06-09 17:35:09 Connection] Registered: foreman
[DEBUG 2014-06-09 17:35:09 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2014-06-09 17:35:09 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-09 17:35:09 API] Params: {}
[DEBUG 2014-06-09 17:35:09 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-09 17:35:09 API] Response {
    "checksum" => "19800b4f09740119c1b4b37d731038a5"
}
[ INFO 2014-06-09 17:35:10 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[ INFO 2014-06-09 17:35:10 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2014-06-09 17:35:10 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2014-06-09 17:35:11 Modules] Extension module hammer_cli_katello (0.0.3) loaded
[DEBUG 2014-06-09 17:35:11 Init] Using locale 'en'
[DEBUG 2014-06-09 17:35:11 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale'
[DEBUG 2014-06-09 17:35:11 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale'
[DEBUG 2014-06-09 17:35:11 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.3/locale'
[ INFO 2014-06-09 17:35:11 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_password"=>"***", "option_username"=>"admin"}
[ INFO 2014-06-09 17:35:11 HammerCLIKatello::ContentView] Called with options: {}
[ INFO 2014-06-09 17:35:11 HammerCLIKatello::ContentView::InfoCommand] Called with options: {"option_name"=>"Default Organization View", "option_organization_id"=>"149"}
[ INFO 2014-06-09 17:35:11 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-09 17:35:11 API] Params: {}
[DEBUG 2014-06-09 17:35:11 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-09 17:35:11 API] Response {
    "checksum" => "19800b4f09740119c1b4b37d731038a5"
}
[ INFO 2014-06-09 17:35:11 API] GET /katello/api/organizations/149/content_views
[DEBUG 2014-06-09 17:35:11 API] Params: {
    "name" => "Default Organization View"
}
[DEBUG 2014-06-09 17:35:11 API] Headers: {
    :params => {
        "name" => "Default Organization View"
    }
}
[DEBUG 2014-06-09 17:35:11 API] Response {
      "search" => nil,
    "subtotal" => 2,
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
             "component_ids" => [],
            "repository_ids" => [],
                 "composite" => nil,
                "created_at" => "2014-06-09T21:23:22Z",
                        "id" => 189,
               "permissions" => {
                              "deletable" => true,
                               "readable" => true,
                "promotable_or_removable" => true
            },
                "updated_at" => "2014-06-09T21:23:22Z",
            "last_published" => "2014-06-09T21:23:22Z",
              "next_version" => 1,
              "environments" => [
                [0] {
                             "id" => 177,
                    "permissions" => {
                        "readable" => true
                    },
                          "label" => "Library",
                           "name" => "Library"
                }
            ],
               "description" => nil,
                "components" => [],
                  "versions" => [
                [0] {
                          "published" => "2014-06-09T21:23:22Z",
                                 "id" => 167,
                            "version" => 1,
                    "environment_ids" => [
                        [0] 177
                    ]
                }
            ],
                   "default" => true,
            "puppet_modules" => [],
              "organization" => {
                "label" => "zid6x4k",
                 "name" => "zid6x4k"
            },
                     "label" => "Default_Organization_View",
              "repositories" => [],
                      "name" => "Default Organization View"
        },
        [1] {
             "component_ids" => [],
            "repository_ids" => [],
                 "composite" => nil,
                "created_at" => "2014-06-09T21:23:46Z",
                        "id" => 190,
               "permissions" => {
                              "deletable" => true,
                               "readable" => true,
                "promotable_or_removable" => true
            },
                "updated_at" => "2014-06-09T21:23:46Z",
            "last_published" => nil,
              "next_version" => 1,
              "environments" => [],
               "description" => nil,
                "components" => [],
                  "versions" => [],
                   "default" => false,
            "puppet_modules" => [],
              "organization" => {
                "label" => "zid6x4k",
                 "name" => "zid6x4k"
            },
                     "label" => "TodfPNNvaC",
              "repositories" => [],
                      "name" => "TodfPNNvaC"
        }
    ],
        "page" => 1,
       "total" => 2,
    "per_page" => 20
}
[ERROR 2014-06-09 17:35:11 Exception] Error: content_view found more than once
Error: content_view found more than once
[ERROR 2014-06-09 17:35:11 Exception]

HammerCLIForeman::ResolverError (content_view found more than once):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:109:in `pick_result'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:104:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:82:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:76:in `content_view_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:122:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:241:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:154:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:288:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 1 Og Maciel 2014-06-09 21:42:09 UTC
Automation blocker and perhaps affects API as well?

Comment 3 Og Maciel 2014-06-10 14:30:12 UTC
Looks like this also affects lifecycle-environments by name:

# LANG=en_US hammer -v -d -u admin -p changeme  --output csv content-host create --name='qeajAJonyPJGKSy' --environment='Library' --content-view-id='235' --organization-id='193' --description='PZiDugBqReXWJjTXoydL'
[ INFO 2014-06-10 10:28:56 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-06-10 10:28:56 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-10 10:28:56 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-10 10:28:56 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-06-10 10:28:56 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2014-06-10 10:28:56 Connection] Registered: foreman
[DEBUG 2014-06-10 10:28:56 API] Global headers: {
              :accept => "application/json;version=2",
        :content_type => "application/json",
    "Accept-Language" => "en"
}
[ INFO 2014-06-10 10:28:56 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-10 10:28:56 API] Params: {}
[DEBUG 2014-06-10 10:28:56 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-10 10:28:56 API] Response {
    "checksum" => "40dab0f1704906b1b978c67335739b0d"
}
[ INFO 2014-06-10 10:28:57 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[ INFO 2014-06-10 10:28:57 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2014-06-10 10:28:57 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2014-06-10 10:28:58 Modules] Extension module hammer_cli_katello (0.0.4) loaded
[DEBUG 2014-06-10 10:28:58 Init] Using locale 'en'
[DEBUG 2014-06-10 10:28:58 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale'
[DEBUG 2014-06-10 10:28:58 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale'
[DEBUG 2014-06-10 10:28:58 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.4/locale'
[ INFO 2014-06-10 10:28:58 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_password"=>"***", "option_debug"=>true, "option_output"=>"csv", "option_username"=>"admin"}
[ INFO 2014-06-10 10:28:58 HammerCLIKatello::ContentHostCommand] Called with options: {}
[ INFO 2014-06-10 10:28:58 HammerCLIKatello::ContentHostCommand::CreateCommand] Called with options: {"option_description"=>"PZiDugBqReXWJjTXoydL", "option_name"=>"qeajAJonyPJGKSy", "option_organization_id"=>"193", "option_environment_name"=>"Library", "option_content_view_id"=>"235"}
[ INFO 2014-06-10 10:28:58 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-10 10:28:58 API] Params: {}
[DEBUG 2014-06-10 10:28:58 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-10 10:28:58 API] Response {
    "checksum" => "40dab0f1704906b1b978c67335739b0d"
}
[ INFO 2014-06-10 10:28:58 API] GET /api/environments
[DEBUG 2014-06-10 10:28:58 API] Params: {
    "name" => "Library"
}
[DEBUG 2014-06-10 10:28:58 API] Headers: {
    :params => {
        "name" => "Library"
    }
}
[DEBUG 2014-06-10 10:28:58 API] Response {
        "page" => 1,
       "total" => 42,
    "subtotal" => 42,
     "results" => [
        [ 0] {
            "updated_at" => "2014-06-05T17:34:19Z",
            "created_at" => "2014-06-05T17:34:19Z",
                  "name" => "99095882",
                    "id" => 4
        },
        [ 1] {
            "updated_at" => "2014-06-05T18:08:42Z",
            "created_at" => "2014-06-05T18:08:42Z",
                  "name" => "cPWUhGivGI",
                    "id" => 23
        },
        [ 2] {
            "updated_at" => "2014-06-05T17:34:21Z",
            "created_at" => "2014-06-05T17:34:21Z",
                  "name" => "Environment_151590",
                    "id" => 5
        },
        [ 3] {
            "updated_at" => "2014-06-05T17:34:28Z",
            "created_at" => "2014-06-05T17:34:28Z",
                  "name" => "Environment_378072",
                    "id" => 7
        },
        [ 4] {
            "updated_at" => "2014-06-05T17:34:24Z",
            "created_at" => "2014-06-05T17:34:24Z",
                  "name" => "Environment_476717",
                    "id" => 6
        },
        [ 5] {
            "updated_at" => "2014-06-05T17:51:41Z",
            "created_at" => "2014-06-05T17:51:41Z",
                  "name" => "KT_6nbtin_Library_dOlyQyXvMu_56",
                    "id" => 10
        },
        [ 6] {
            "updated_at" => "2014-06-05T17:48:35Z",
            "created_at" => "2014-06-05T17:48:35Z",
                  "name" => "KT_6nbtin_Library_DYcwXDYnLF_52",
                    "id" => 8
        },
        [ 7] {
            "updated_at" => "2014-06-05T18:03:29Z",
            "created_at" => "2014-06-05T18:03:29Z",
                  "name" => "KT_6nbtin_Library_GJtYBVCxkt_71",
                    "id" => 19
        },
        [ 8] {
            "updated_at" => "2014-06-05T17:57:54Z",
            "created_at" => "2014-06-05T17:57:54Z",
                  "name" => "KT_6nbtin_Library_gWognWNdGX_67",
                    "id" => 14
        },
        [ 9] {
            "updated_at" => "2014-06-05T18:00:34Z",
            "created_at" => "2014-06-05T18:00:34Z",
                  "name" => "KT_6nbtin_Library_RnOnyAmTMg_69",
                    "id" => 17
        },
        [10] {
            "updated_at" => "2014-06-05T17:59:44Z",
            "created_at" => "2014-06-05T17:59:44Z",
                  "name" => "KT_6nbtin_Library_RpDrMvmCpw_68",
                    "id" => 16
        },
        [11] {
            "updated_at" => "2014-06-05T18:06:17Z",
            "created_at" => "2014-06-05T18:06:17Z",
                  "name" => "KT_6nbtin_Library_TQDKSQDVDY_72",
                    "id" => 21
        },
        [12] {
            "updated_at" => "2014-06-05T17:56:10Z",
            "created_at" => "2014-06-05T17:56:10Z",
                  "name" => "KT_6nbtin_Library_vTvCcPDFIg_66",
                    "id" => 12
        },
        [13] {
            "updated_at" => "2014-06-05T18:02:02Z",
            "created_at" => "2014-06-05T18:02:02Z",
                  "name" => "KT_6nbtin_Library_zdJxoqfGsU_70",
                    "id" => 18
        },
        [14] {
            "updated_at" => "2014-06-05T17:55:23Z",
            "created_at" => "2014-06-05T17:55:23Z",
                  "name" => "KT_6nbtin_Library_ZOCiMFOKRT_65",
                    "id" => 11
        },
        [15] {
            "updated_at" => "2014-06-05T18:03:54Z",
            "created_at" => "2014-06-05T18:03:54Z",
                  "name" => "KT_6nbtin_v4dlvy_GJtYBVCxkt_71",
                    "id" => 20
        },
        [16] {
            "updated_at" => "2014-06-05T17:58:13Z",
            "created_at" => "2014-06-05T17:58:13Z",
                  "name" => "KT_6nbtin_v4dlvy_gWognWNdGX_67",
                    "id" => 15
        },
        [17] {
            "updated_at" => "2014-06-05T18:06:40Z",
            "created_at" => "2014-06-05T18:06:40Z",
                  "name" => "KT_6nbtin_v4dlvy_TQDKSQDVDY_72",
                    "id" => 22
        },
        [18] {
            "updated_at" => "2014-06-05T17:56:32Z",
            "created_at" => "2014-06-05T17:56:32Z",
                  "name" => "KT_6nbtin_v4dlvy_vTvCcPDFIg_66",
                    "id" => 13
        },
        [19] {
            "updated_at" => "2014-06-05T19:45:04Z",
            "created_at" => "2014-06-05T19:45:04Z",
                  "name" => "KT_MgAtVcFfJy_a3b6bb51_14a8_4445_d53a_9888301bc0ec_PrtVfkDF_127",
                    "id" => 35
        }
    ],
    "per_page" => 20,
        "sort" => {
        "order" => nil,
           "by" => nil
    },
      "search" => nil
}
[ERROR 2014-06-10 10:28:58 Exception] Error: environment found more than once
Could not create content host:
  Error: environment found more than once
[ERROR 2014-06-10 10:28:58 Exception]

HammerCLIForeman::ResolverError (environment found more than once):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:109:in `pick_result'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:104:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:82:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:76:in `environment_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:133:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:162:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:159:in `each'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:159:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.4/lib/hammer_cli_katello/content_host.rb:47:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:154:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 4 Adam Price 2014-06-10 21:32:52 UTC
Created redmine issue http://projects.theforeman.org/issues/6151 from this bug

Comment 5 Adam Price 2014-06-10 21:36:08 UTC
@omacial, if you look at the `hammer content-view info` you can see that it says it's finding more than one content-view in the return json. so what's actually failing to happen, is that we aren't filtering the content-views by name, so we were just getting all of them back!


https://github.com/Katello/katello/pull/4243

Comment 6 Adam Price 2014-06-10 21:41:26 UTC
also, in the future, could you please paste your error output in a text attachment? it's much easier to read there because it isn't smooshed by bugzilla's comment width limit. thanks :)

Comment 7 Bryan Kearney 2014-06-10 21:56:42 UTC
adam, check out the name processing which was added as part of https://bugzilla.redhat.com/show_bug.cgi?id=1102451. This should fix this issue.

Comment 10 Kedar Bidarkar 2014-06-12 14:11:43 UTC
verified with sat6-snap9

the initial bug report issue now works fine, but the issue mentioned in comment3 fails.

----------------


Installed Packages

    candlepin-0.9.7-1.el6_5.noarch
    candlepin-scl-1-5.el6_4.noarch
    candlepin-scl-quartz-2.1.5-5.el6_4.noarch
    candlepin-scl-rhino-1.7R3-1.el6_4.noarch
    candlepin-scl-runtime-1-5.el6_4.noarch
    candlepin-selinux-0.9.7-1.el6_5.noarch
    candlepin-tomcat6-0.9.7-1.el6_5.noarch
    createrepo-0.9.9-21.2.pulp.el6sat.noarch
    dhcp207-55.lab.eng.pnq.redhat.com-qpid-broker-1.0-1.noarch
    dhcp207-55.lab.eng.pnq.redhat.com-qpid-client-cert-1.0-1.noarch
    elasticsearch-0.90.10-4.el6sat.noarch
    katello-1.5.0-25.el6sat.noarch
    katello-ca-1.0-1.noarch
    katello-certs-tools-1.5.5-1.el6sat.noarch
    katello-installer-0.0.48-1.el6sat.noarch
    m2crypto-0.21.1.pulp-10.el6sat.x86_64
    mod_wsgi-3.4-1.pulp.el6sat.x86_64
    pulp-katello-0.3-3.el6sat.noarch
    pulp-nodes-common-2.4.0-0.20.beta.el6sat.noarch
    pulp-nodes-parent-2.4.0-0.20.beta.el6sat.noarch
    pulp-puppet-plugins-2.4.0-0.20.beta.el6sat.noarch
    pulp-puppet-tools-2.4.0-0.20.beta.el6sat.noarch
    pulp-rpm-plugins-2.4.0-0.20.beta.el6sat.noarch
    pulp-selinux-2.4.0-0.20.beta.el6sat.noarch
    pulp-server-2.4.0-0.20.beta.el6sat.noarch
    python-gofer-qpid-1.2.1-1.el6sat.noarch
    python-isodate-0.5.0-1.pulp.el6sat.noarch
    python-kombu-3.0.15-10.pulp.el6sat.noarch
    python-pulp-bindings-2.4.0-0.20.beta.el6sat.noarch
    python-pulp-common-2.4.0-0.20.beta.el6sat.noarch
    python-pulp-puppet-common-2.4.0-0.20.beta.el6sat.noarch
    python-pulp-rpm-common-2.4.0-0.20.beta.el6sat.noarch
    python-qpid-0.22-14.el6sat.noarch
    python-qpid-qmf-0.22-31.el6sat.x86_64
    qpid-cpp-client-0.22-40.el6.x86_64
    qpid-cpp-server-0.22-40.el6.x86_64
    qpid-cpp-server-linearstore-0.22-40.el6.x86_64
    qpid-proton-c-0.7-1.el6.x86_64
    qpid-qmf-0.22-31.el6sat.x86_64
    qpid-tools-0.22-12.el6.noarch
    ruby193-rubygem-katello-1.5.0-57.el6sat.noarch
    rubygem-hammer_cli_katello-0.0.4-6.el6sat.noarch



-----------------



[root@xxxx ~]# hammer content-view info --name cv-common --organization-id 1
ID:             2
Name:           cv-common
Label:          cv-common
Composite:      
Description:    
Organization:   ACME_Corporation
Repositories:   
 1) ID:    2
    Name:  fortello
    Label: fortello
 2) ID:    1
    Name:  rhcommon
    Label: rhcommon
Puppet Modules: 

Environments:   
 1) ID:   1
    Name: Library
Versions:       
 1) ID:        2
    Version:   1
    Published: 2014/06/12 13:27:51
Components:

[root@xxxx ~]# hammer content-view info --name "Default Organization View" --organization-id 1
ID:             1
Name:           Default Organization View
Label:          Default_Organization_View
Composite:      
Description:    
Organization:   ACME_Corporation
Repositories:   

Puppet Modules: 

Environments:   
 1) ID:   1
    Name: Library
Versions:       
 1) ID:        1
    Version:   1
    Published: 2014/06/12 08:02:39
Components:

Comment 11 Kedar Bidarkar 2014-06-12 14:17:24 UTC
the issue mentioned in comment3 still persists.

will be raising another bug for the issue specific to as mentioned in comment3


[root@ ~]# hammer content-host create --name="test_host" --environment='Library' --content-view-id=2 --organization-id 1 
Could not create content host:
  Error: environment found more than once

Comment 12 Bryan Kearney 2014-07-02 14:10:03 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.

Comment 13 Bryan Kearney 2014-07-02 14:10:25 UTC
This was delivered in 6.0.3, the Beta version of Satellite 6.0

Comment 14 Bryan Kearney 2014-07-02 14:14:55 UTC
This was delivered in the Satellite 6 Beta (6.0.3)