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 1247313 - Cannot get information for a running docker instance by name with hammer
Summary: Cannot get information for a running docker instance by name with hammer
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Container Management
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On: 1292740 1323446
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-27 18:32 UTC by Og Maciel
Modified: 2020-01-17 15:32 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 09:17:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1501 0 normal SHIPPED_LIVE Red Hat Satellite 6.2 Capsule and Server 2016-07-27 12:28:58 UTC

Description Og Maciel 2015-07-27 18:32:39 UTC
Description of problem:

Using hammer to get information for a running Docker instance doesn't work when using the instance name.

I have 2 running docker containers as can be seen below:

[root@ibm-x3250m4-01 ~]# foreman-rake console
Loading production environment (Rails 3.2.8)
irb(main):001:0> Container.all
2015-07-27 14:24:05 [D]   Container Load (0.3ms)  SELECT "containers".* FROM "containers"
=> [#<Container id: 1, name: "docker-rhel-7-1", command: "top", created_at: "2015-07-27 18:06:46", updated_at: "2015-07-27 18:06:46", compute_resource_id: 1, entrypoint: nil, cpu_set: nil, cpu_shares: nil, memory: nil, tty: true, attach_stdin: nil, attach_stdout: nil, attach_stderr: nil, uuid: "d95ecfeac89631460d57dbafdf0216da4fd324d5f16c60db7a0...", repository_name: "rhel6.7", tag: "latest", registry_id: 1, capsule_id: nil>, #<Container id: 2, name: "docker-centos-latest-1", command: "top", created_at: "2015-07-27 18:11:29", updated_at: "2015-07-27 18:11:29", compute_resource_id: 1, entrypoint: nil, cpu_set: nil, cpu_shares: nil, memory: nil, tty: true, attach_stdin: nil, attach_stdout: nil, attach_stderr: nil, uuid: "a27b5f23cad956ee72106c2d42e5727c02d68b80128a16c3d85...", repository_name: "centos", tag: "latest", registry_id: nil, capsule_id: nil>]
irb(main):002:0>

If I try to get more information about one of them using its ID, the hammer command works fine:

[root@ibm-x3250m4-01 ~]# hammer -u "${ADMIN_USER}" -p "${ADMIN_PASSWORD}" docker container info --id=1 --compute-resource="local_docker"
Name:             docker-rhel-7-1
Image repository: rhel6.7
Tag:              latest
Command:          top
Compute resource: local_docker
Entrypoint:
CPU set:
CPU shares:
Memory (Bytes):
TTY:              yes
Attach STDIN:     no
Attach STDOUT:    no
Attach STDERR:    no
Registry:         Red Hat Docker Registry
Created at:       2015/07/27 18:06:46
Updated at:       2015/07/27 18:06:46

However, if I try to use the container's name:

[root@ibm-x3250m4-01 ~]# hammer -u "${ADMIN_USER}" -p "${ADMIN_PASSWORD}" docker container info --name="docker-rhel-7-1" --compute-resource="local_docker"
Error: container found more than once

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

* Satellite 6.1.1 SNAP 14

How reproducible:


Steps to Reproduce:
1. Provision a new Docker container
2. Use hammer to get information about it (NOTE: there is no other way to get the ID for a running instance other than using rake)
3.

Actual results:

Error: container found more than once


Expected results:


Additional info:

[root@ibm-x3250m4-01 ~]# hammer -u "${ADMIN_USER}" -p "${ADMIN_PASSWORD}" -v -d docker container info --name="docker-rhel-7-1" --compute-resource="local_docker"
[ INFO 2015-07-27 14:27:26 Init] Initialization of Hammer CLI (0.1.4.11) has started...
[DEBUG 2015-07-27 14:27:26 Init] Running at ruby 2.0.0-p598
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2015-07-27 14:27:26 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2015-07-27 14:27:26 Connection] Registered: foreman
[DEBUG 2015-07-27 14:27:26 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_foreman (0.1.4.14) loaded
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.2.7) loaded
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_foreman_discovery (0.0.1.10) loaded
[ INFO 2015-07-27 14:27:26 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2015-07-27 14:27:26 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_gutterball (0.0.1.3) loaded
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_import (0.10.19) loaded
[ INFO 2015-07-27 14:27:26 Modules] Extension module hammer_cli_katello (0.0.7.17) loaded
[DEBUG 2015-07-27 14:27:26 Init] Using locale 'en'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/share/gems/gems/hammer_cli-0.1.4.11/locale'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/locale'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.3.9/locale'
[DEBUG 2015-07-27 14:27:26 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/share/gems/gems/hammer_cli_katello-0.0.7.17/locale'
[ INFO 2015-07-27 14:27:26 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ WARN 2015-07-27 14:27:26 HammerCLIForemanDocker::DockerRegistryCommand] Resource 'registries' does not exist in the API
[ INFO 2015-07-27 14:27:26 HammerCLIForemanDocker::DockerCommand] Called with options: {}
[ INFO 2015-07-27 14:27:26 HammerCLIForemanDocker::DockerContainerCommand] Called with options: {}
[ INFO 2015-07-27 14:27:26 HammerCLIForemanDocker::DockerContainerCommand::InfoCommand] Called with options: {"option_name"=>"docker-rhel-7-1", "option_compute_resource_name"=>"local_docker"}
[ INFO 2015-07-27 14:27:26 API] GET /api/compute_resources
[DEBUG 2015-07-27 14:27:26 API] Params: {
    :search => "name = \"local_docker\""
}
[DEBUG 2015-07-27 14:27:26 API] Headers: {
    :params => {
        :search => "name = \"local_docker\""
    }
}
[DEBUG 2015-07-27 14:27:26 API] Response: {
       "total" => 2,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 20,
      "search" => "name = \"local_docker\"",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
                                "id" => 1,
                              "name" => "local_docker",
                          "provider" => "Docker",
            "provider_friendly_name" => "Docker",
                       "description" => "Local Docker compute resource",
                               "url" => "http://localhost:2375",
                        "created_at" => "2015-07-23T20:41:25Z",
                        "updated_at" => "2015-07-23T20:42:56Z",
                              "user" => ""
        }
    ]
}
[DEBUG 2015-07-27 14:27:26 API] Response headers: {
                   :date => "Mon, 27 Jul 2015 18:27:26 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :apipie_checksum => "f5be3b0ebc7dd0b408568ebd915897a9",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "must-revalidate, private, max-age=0",
           :x_request_id => "120d61a8c0cd7c2061c5be54890b748e",
              :x_runtime => "0.042162",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTllMTRmYTc3MmY0OWU1MzlkMDVmODU4NWIxYTkzNGRhBjsAVEkiC2xvY2FsZQY7AEYiB2Vu--86d10785562467a3cc72ffb985f9a571ce218ccc; path=/; secure; HttpOnly"
    ],
                   :etag => "\"18e6b9948a90a71d5bc89191daa1a415\"",
                 :status => "200 OK",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}
[ INFO 2015-07-27 14:27:26 API] GET /docker/api/v2/containers
[DEBUG 2015-07-27 14:27:26 API] Params: {
    :search => "name = \"docker-rhel-7-1\""
}
[DEBUG 2015-07-27 14:27:26 API] Headers: {
    :params => {
        :search => "name = \"docker-rhel-7-1\""
    }
}
[DEBUG 2015-07-27 14:27:27 API] Response: {
       "total" => 2,
    "subtotal" => 2,
        "page" => 1,
    "per_page" => 20,
      "search" => "name = \"docker-rhel-7-1\"",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
                               "id" => 1,
                             "name" => "docker-rhel-7-1",
                             "uuid" => "d95ecfeac89631460d57dbafdf0216da4fd324d5f16c60db7a03762100fb8b63",
                          "command" => "top",
              "compute_resource_id" => 1,
            "compute_resource_name" => "local_docker",
                       "entrypoint" => nil,
                          "cpu_set" => nil,
                       "cpu_shares" => nil,
                           "memory" => nil,
                              "tty" => true,
                     "attach_stdin" => nil,
                    "attach_stdout" => nil,
                    "attach_stderr" => nil,
                  "repository_name" => "rhel6.7",
                              "tag" => "latest",
                      "registry_id" => 1,
                    "registry_name" => "Red Hat Docker Registry",
                       "created_at" => "2015-07-27T18:06:46Z",
                       "updated_at" => "2015-07-27T18:06:46Z"
        },
        [1] {
                               "id" => 2,
                             "name" => "docker-centos-latest-1",
                             "uuid" => "a27b5f23cad956ee72106c2d42e5727c02d68b80128a16c3d85a47d52a6c35b9",
                          "command" => "top",
              "compute_resource_id" => 1,
            "compute_resource_name" => "local_docker",
                       "entrypoint" => nil,
                          "cpu_set" => nil,
                       "cpu_shares" => nil,
                           "memory" => nil,
                              "tty" => true,
                     "attach_stdin" => nil,
                    "attach_stdout" => nil,
                    "attach_stderr" => nil,
                  "repository_name" => "centos",
                              "tag" => "latest",
                      "registry_id" => nil,
                    "registry_name" => nil,
                       "created_at" => "2015-07-27T18:11:29Z",
                       "updated_at" => "2015-07-27T18:11:29Z"
        }
    ]
}
[DEBUG 2015-07-27 14:27:27 API] Response headers: {
                   :date => "Mon, 27 Jul 2015 18:27:26 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "must-revalidate, private, max-age=0",
           :x_request_id => "2bb2b4bc9447a62e1f27911ee788fed9",
              :x_runtime => "0.171244",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTJkNzAxODgyZmUxNTM3MmFkZGQzMDczOWRhY2YyZmY4BjsAVEkiC2xvY2FsZQY7AEYiB2Vu--02da68e1b76aa349066eb36dbc62c5c5f54e9f11; path=/; secure; HttpOnly"
    ],
                   :etag => "\"6fe82d06ed155a6e96fee2f3d4c0ff08\"",
                 :status => "200 OK",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}
[ERROR 2015-07-27 14:27:27 Exception] Error: container found more than once
Error: container found more than once
[ERROR 2015-07-27 14:27:27 Exception]

HammerCLIForeman::ResolverError (container found more than once):
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/id_resolver.rb:192:in `pick_result'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/id_resolver.rb:156:in `find_resource'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/id_resolver.rb:139:in `get_id'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/id_resolver.rb:129:in `block (2 levels) in define_id_finders'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:149:in `get_resource_id'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:138:in `get_identifier'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:230:in `customized_options'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:235:in `request_params'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:185:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/lib/hammer_cli_foreman/commands.rb:369:in `send_request'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.11/bin/hammer:108:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 3 Brad Buckingham 2015-10-29 15:47:02 UTC
I am no longer seeing this issue with the upstream; therefore, moving the bug to POST.

E.g.

hammer> docker container list 
------|------------------|----------|------------------------------------|-----------------
NAME  | IMAGE REPOSITORY | TAG      | COMMAND                            | COMPUTE RESOURCE
------|------------------|----------|------------------------------------|-----------------
ping  | centos           | 7.1.1503 | /usr/bin/ping -c 15 www.google.com | InternalDocker  
ping2 | centos           | 7.1.1503 | /usr/bin/ping -c 15 www.google.com | InternalDocker  
------|------------------|----------|------------------------------------|-----------------
hammer> docker container info --name ping --compute-resource InternalDocker
Name:             ping
Image repository: centos
Tag:              7.1.1503
Command:          /usr/bin/ping -c 15 www.google.com
Compute resource: InternalDocker
Entrypoint:       
CPU set:          
CPU shares:       
Memory (Bytes):   
TTY:              no
Attach STDIN:     yes
Attach STDOUT:    yes
Attach STDERR:    yes
Organizations:    
    Default Organization
Created at:       2015/10/29 15:33:07
Updated at:       2015/10/29 15:33:07

hammer>

Comment 4 Tazim Kolhar 2015-12-18 10:24:35 UTC
Currently, in upstream we are not able to create new container even after 
creating compute resource ..
thanks

Comment 8 Jitendra Yejare 2016-04-26 11:19:50 UTC
Verified in Sat 6.2 Snap 9.2

I am able to info the docker container with its name from hammer now.

So moving this bug to Verified.

Proof:
# hammer docker container info --name=con1 --compute-resource="docker_cr"
ID:               6
Name:             con1
Image repository: busybox
Tag:              latest
Command:          du
Compute resource: docker_cr
UUID:             f2afab5222b0e54b03ad10e1f60c872ae25386cce29c2e43b0eb46817cf04632
Entrypoint:       
CPU set:          
CPU shares:       2
Memory (Bytes):   512m
TTY:              no
Attach STDIN:     no
Attach STDOUT:    no
Attach STDERR:    no
Locations:        
    Default Location
Organizations:    
    Default Organization
Created at:       2016/04/26 11:01:41
Updated at:       2016/04/26 11:01:41

Comment 10 errata-xmlrpc 2016-07-27 09:17:00 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/RHBA-2016:1501


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