Bug #6151
closedhammer content-view info does not filter by organization
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1107319
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