Bug 1199069

Summary: content-report commands doesn't give the expected output
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: HammerAssignee: Mike McCune <mmccune>
Status: CLOSED CURRENTRELEASE QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, erezende
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10031
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 14:01:09 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: 1193969    

Description Sachin Ghai 2015-03-05 12:38:50 UTC
Description of problem:
I tried content-report commands with sat6.1 beta snap5. But none of the command gives expected result:

[root@dhcpxx-xxx foreman]#  hammer --username admin --password changeme content-report content-host-status --organization-id 1
[......................................................................                                                                       ] [50%]

[root@dhcpxx-xx foreman]#  hammer --username admin --password changeme content-report content-host-trend --organization-id 1 --content-host  ivanova.idmqe.lab.eng.bos.redhat.com
[......................................................................                                                                       ] [50%]

[root@dhcpxx-xx foreman]#  hammer --username admin --password changeme content-report status-trend --organization-id 1
[......................................................................                                                                       ] [50%]


Commands finished at 50% and neither gives any output nor raises any error. I've registered two content-hosts with it. Ideally these commands should show content-host's subscription status valid/invalid etc.

Version-Release number of selected component (if applicable):
sat6.1 beta snap5

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
Commands finished at 50% and neither gives any output nor raises any error. 

Expected results:
these commands should show content-host's subscription status valid/invalid etc.

Additional info:

Comment 2 Sachin Ghai 2015-03-05 12:45:17 UTC
output in debug mode:

[root@dhcpxx-xx foreman]#  hammer -v -d --username admin --password changeme content-report status-trend --organization-id 1
[ INFO 2015-03-05 18:14:52 Init] Initialization of Hammer CLI (0.1.4) has started...
[DEBUG 2015-03-05 18:14:52 Init] Running at ruby 2.0.0-p598
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2015-03-05 18:14:52 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2015-03-05 18:14:52 Connection] Registered: foreman
[DEBUG 2015-03-05 18:14:52 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2015-03-05 18:14:52 Modules] Extension module hammer_cli_foreman (0.1.4.6) loaded
[ INFO 2015-03-05 18:14:52 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.2.5) loaded
[ INFO 2015-03-05 18:14:53 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2015-03-05 18:14:53 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2015-03-05 18:14:53 Modules] Extension module hammer_cli_import (0.10.6.3) loaded
[ INFO 2015-03-05 18:14:53 Modules] Extension module hammer_cli_katello (0.0.7.3) loaded
[DEBUG 2015-03-05 18:14:53 Init] Using locale 'en'
[DEBUG 2015-03-05 18:14:53 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/share/gems/gems/hammer_cli-0.1.4/locale'
[DEBUG 2015-03-05 18:14:53 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-03-05 18:14:53 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/share/gems/gems/hammer_cli_foreman-0.1.4.6/locale'
[DEBUG 2015-03-05 18:14:53 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[DEBUG 2015-03-05 18:14:53 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/share/gems/gems/hammer_cli_katello-0.0.7.3/locale'
[ INFO 2015-03-05 18:14:53 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2015-03-05 18:14:53 HammerCLIGutterball::ContentReportsCommand] Called with options: {}
[ INFO 2015-03-05 18:14:53 HammerCLIGutterball::ContentReportsCommand::StatusTrend] Called with options: {"option_organization_id"=>"1"}
[ INFO 2015-03-05 18:14:53 API] GET /katello/api/content_reports/status_trend
[DEBUG 2015-03-05 18:14:53 API] Params: {
    "organization_id" => "1"
}
[DEBUG 2015-03-05 18:14:53 API] Headers: {
    :params => {
        "organization_id" => "1"
    }
}
[DEBUG 2015-03-05 18:14:54 API] Response: {
             "id" => "50964f38-fa3e-416f-bd3d-11365851b3cb",
          "label" => "Actions::ForemanGutterball::ContentReports::Report",
        "pending" => true,
       "username" => "admin",
     "started_at" => "2015-03-05T12:44:53Z",
       "ended_at" => nil,
          "state" => "running",
         "result" => "pending",
       "progress" => 0.0,
          "input" => {
        "report_type" => "status_trend",
             "params" => {
            "organization_id" => "1"
        },
             "locale" => "en"
    },
         "output" => {},
      "humanized" => {
        "action" => "Report",
         "input" => [],
        "output" => "",
        "errors" => []
    },
    "cli_example" => nil
}
[DEBUG 2015-03-05 18:14:54 API] Response headers: {
                   :date => "Thu, 05 Mar 2015 12:44:53 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :apipie_checksum => "3da49752adb429073753472ddc11fa24",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "no-cache, private",
           :x_request_id => "70454f3b9c12514835b153f49f25f5d4",
              :x_runtime => "1.223481",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTE2MWM2ZGQ5ZGVlYmQ5N2IxODQwZTE5ZDU2OGRhZGZmBjsAVEkiC2xvY2FsZQY7AEYiB2Vu--52eadafce79152f95a38ab971861cd9dac186cf8; path=/; HttpOnly"
    ],
                 :status => "202 Accepted",
             :connection => "close",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}
[ INFO 2015-03-05 18:14:54 API] GET /foreman_tasks/api/tasks/50964f38-fa3e-416f-bd3d-11365851b3cb
[DEBUG 2015-03-05 18:14:54 API] Params: {}
[DEBUG 2015-03-05 18:14:54 API] Headers: {
    :params => {}
}
[DEBUG 2015-03-05 18:14:54 API] Response: {
             "id" => "50964f38-fa3e-416f-bd3d-11365851b3cb",
          "label" => "Actions::ForemanGutterball::ContentReports::Report",
        "pending" => true,
       "username" => "admin",
     "started_at" => "2015-03-05T12:44:53Z",
       "ended_at" => nil,
          "state" => "running",
         "result" => "pending",
       "progress" => 0.0,
          "input" => {
        "report_type" => "status_trend",
             "params" => {
            "organization_id" => "1"
        },
             "locale" => "en"
    },
         "output" => {},
      "humanized" => {
        "action" => "Report",
         "input" => [],
        "output" => "",
        "errors" => []
    },
    "cli_example" => nil
}
[DEBUG 2015-03-05 18:14:54 API] Response headers: {
                   :date => "Thu, 05 Mar 2015 12:44:54 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :apipie_checksum => "3da49752adb429073753472ddc11fa24",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "must-revalidate, private, max-age=0",
           :x_request_id => "c312f0f8c4bf02a40305d754e9849e7f",
              :x_runtime => "0.056546",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTE4NmUxNmE1MjdmZGVmYWY5MWMwNzg2MjQ2MDkwMzdkBjsAVEkiC2xvY2FsZQY7AEYiB2Vu--f26120fa485e9174e43308e6e8ecfca794ddf680; path=/; HttpOnly"
    ],
                   :etag => "\"e26f127d2c5c63401531a86a57b9e6d7\"",
                 :status => "200 OK",
             :connection => "close",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}
[                                                                                                                                              ] [0%][ INFO 2015-03-05 18:14:56 API] GET /foreman_tasks/api/tasks/50964f38-fa3e-416f-bd3d-11365851b3cb
[DEBUG 2015-03-05 18:14:56 API] Params: {}
[DEBUG 2015-03-05 18:14:56 API] Headers: {
    :params => {}
}
[DEBUG 2015-03-05 18:14:56 API] Response: {
             "id" => "50964f38-fa3e-416f-bd3d-11365851b3cb",
          "label" => "Actions::ForemanGutterball::ContentReports::Report",
        "pending" => true,
       "username" => "admin",
     "started_at" => "2015-03-05T12:44:53Z",
       "ended_at" => nil,
          "state" => "paused",
         "result" => "error",
       "progress" => 0.5,
          "input" => {
        "report_type" => "status_trend",
             "params" => {
            "owner" => "Default_Organization"
        },
             "locale" => "en"
    },
         "output" => {},
      "humanized" => {
        "action" => "Report",
         "input" => [],
        "output" => "",
        "errors" => [
            [0] "ForemanGutterball::GutterballService: 404 Resource Not Found  (GET /gutterball/reports/status_trend/run/?owner=Default_Organization)"
        ]
    },
    "cli_example" => nil
}
[DEBUG 2015-03-05 18:14:56 API] Response headers: {
                   :date => "Thu, 05 Mar 2015 12:44:56 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :apipie_checksum => "3da49752adb429073753472ddc11fa24",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "must-revalidate, private, max-age=0",
           :x_request_id => "6b01b3f25947d9123b3b544fdb51e34d",
              :x_runtime => "0.061804",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTlkMjQyNTRhNWFiMmJjZmRhOWM5NjBmNzljYWI5OTEzBjsAVEkiC2xvY2FsZQY7AEYiB2Vu--70527e28d8b8c30e2c956fe6a1b8f26931b1d9cb; path=/; HttpOnly"
    ],
                   :etag => "\"49136a9847f383f4cf732d751eb24a3e\"",
                 :status => "200 OK",
             :connection => "close",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}
[......................................................................                                                                       ] [50%]
[ INFO 2015-03-05 18:14:56 API] GET /foreman_tasks/api/tasks/50964f38-fa3e-416f-bd3d-11365851b3cb
[DEBUG 2015-03-05 18:14:56 API] Params: {}
[DEBUG 2015-03-05 18:14:56 API] Headers: {
    :params => {}
}
[DEBUG 2015-03-05 18:14:56 API] Response: {
             "id" => "50964f38-fa3e-416f-bd3d-11365851b3cb",
          "label" => "Actions::ForemanGutterball::ContentReports::Report",
        "pending" => true,
       "username" => "admin",
     "started_at" => "2015-03-05T12:44:53Z",
       "ended_at" => nil,
          "state" => "paused",
         "result" => "error",
       "progress" => 0.5,
          "input" => {
        "report_type" => "status_trend",
             "params" => {
            "owner" => "Default_Organization"
        },
             "locale" => "en"
    },
         "output" => {},
      "humanized" => {
        "action" => "Report",
         "input" => [],
        "output" => "",
        "errors" => [
            [0] "ForemanGutterball::GutterballService: 404 Resource Not Found  (GET /gutterball/reports/status_trend/run/?owner=Default_Organization)"
        ]
    },
    "cli_example" => nil
}
[DEBUG 2015-03-05 18:14:56 API] Response headers: {
                   :date => "Thu, 05 Mar 2015 12:44:56 GMT",
                 :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
        :foreman_version => "1.7.2",
    :foreman_api_version => "2",
        :apipie_checksum => "3da49752adb429073753472ddc11fa24",
        :x_ua_compatible => "IE=Edge,chrome=1",
          :cache_control => "must-revalidate, private, max-age=0",
           :x_request_id => "a7aee814f2dcaddd895263a7f5d0518a",
              :x_runtime => "0.054395",
           :x_rack_cache => "miss",
           :x_powered_by => "Phusion Passenger 4.0.18",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWIyMzJjOTkyNjljOTY1NTk3MjVkNTRkMmEwZDZkN2ViBjsAVEkiC2xvY2FsZQY7AEYiB2Vu--5007e4126cdfc83047a716aa850ee1f4fce6c7c7; path=/; HttpOnly"
    ],
                   :etag => "\"49136a9847f383f4cf732d751eb24a3e\"",
                 :status => "200 OK",
             :connection => "close",
      :transfer_encoding => "chunked",
           :content_type => "application/json; charset=utf-8"
}

Comment 3 Dustin Tsang 2015-04-06 23:54:21 UTC
Created redmine issue http://projects.theforeman.org/issues/10031 from this bug

Comment 4 Dustin Tsang 2015-04-27 15:27:03 UTC
https://github.com/theforeman/hammer-cli-foreman-tasks/pull/18 PR merged

Comment 7 Sachin Ghai 2015-05-06 06:32:28 UTC
Verified with:
sat6.1 GA snap2 (Satellite-6.1.0-RHEL-7-20150429.2)

I can see the content-reports:

--

[root@dhcp pxelinux.cfg]# hammer --username admin --password changeme content-report content-host-status --organization-id 1
[............................................................................................................................................] [100%]

Hostname,Status,Date
shost.englab.pnq.redhat.com,invalid,2015-05-04
mac525400c75a5e.englab.pnq.redhat.com,invalid,2015-05-06


[root@dhcp pxelinux.cfg]# hammer --username admin --password changeme content-report content-host-trend --organization-id 1 --content-host shost.englab.pnq.redhat.com
[............................................................................................................................................] [100%]

Date,Status
2015-05-04,invalid
2015-05-04,invalid
2015-05-04,invalid
2015-05-04,invalid
2015-05-04,invalid



[root@dhcp pxelinux.cfg]# hammer --username admin --password changeme content-report status-trend --organization-id 1
[............................................................................................................................................] [100%]

Date,Valid,Invalid,Partial
2015-05-04,0,1,0
2015-05-05,0,1,0
2015-05-06,0,2,0

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

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