Bug 1387202 - hammer host status returns Foreman::Exception on inactive host
Summary: hammer host status returns Foreman::Exception on inactive host
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hosts
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
high
medium vote
Target Milestone: Unspecified
Assignee: Shimon Shtein
QA Contact: Sachin Ghai
URL:
Whiteboard:
Keywords: Triaged
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-20 10:46 UTC by Peter Ondrejka
Modified: 2019-04-01 20:27 UTC (History)
11 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2018-02-21 16:54:37 UTC


Attachments (Terms of Use)
production.log (19.72 KB, text/plain)
2016-10-20 12:48 UTC, Peter Ondrejka
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 20966 None None None 2017-09-19 10:34 UTC

Description Peter Ondrejka 2016-10-20 10:46:11 UTC
On Satellite 6.3 snap 5 (also reproducible on satellite-6.2.3-1.0)

Execute host status on running host:

# hammer host status --id 4
Status: No reports
Power:  running

Executing the same command on disabled host:

# hammer host status --id 1
ERF42-9958 [Foreman::Exception]: Unknown power management support - can't continue


Actual results:
Foreman::Exception returned

Expected results:
Status info should be returned, informing about the power status of the host, e.g.:

# hammer host status --id 1
Status: No reports
Power:  not running

Comment 2 Marek Hulan 2016-10-20 12:12:35 UTC
Thanks for the report Peter, this triggers an exception on server side, could you please upload the production.log after you run

    # hammer host status --id 1

That would help to find out what's happened I think. Extra points if the logger is configured to log debug messages too.

Comment 3 Peter Ondrejka 2016-10-20 12:48 UTC
Created attachment 1212512 [details]
production.log

Sure, providing in the attachment

Comment 4 Marek Hulan 2016-11-03 15:26:30 UTC
Thank you, few more questions. Is the host baremetal or VM? If it's baremetal, does it have BMC interface defined? What exactly you mean by "disabled" or "inactive" host. Extra thanks for debug log level.

Comment 5 Peter Ondrejka 2016-11-10 15:49:19 UTC
Hey Marek,

On a second sight I realize that I'm hitting this only on the host that is the Satellite server itself, which is a bare metal without the BMC interface. So I guess it is expected that I don't get the power status, I'd just like to have some nice message (maybe someth. like "Status: no interface detected") rather than the exception.

I have no other bare metal host at hand, on VM hosts I get "Power: running" or "Power: off" if I power off the VM. Hope this helps

Comment 6 Shimon Shtein 2016-12-20 15:16:00 UTC
Should be fixed in Foreman 1.14 as part of http://projects.theforeman.org/issues/14688

The PR adds an action to HostsController that will not throw an exception in case the host does not support power commands:
https://github.com/theforeman/foreman/blob/develop/config/routes.rb#L34

Comment 7 Shimon Shtein 2016-12-20 15:17:20 UTC
Connecting redmine issue http://projects.theforeman.org/issues/14688 from this bug

Comment 8 Bryan Kearney 2016-12-20 17:06:38 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/14688 has been resolved.

Comment 9 Daniel Lobato Garcia 2017-01-27 08:50:00 UTC
Setting as triaged as there's a fix already upstream

Comment 10 Sebastian Gräßl 2017-08-16 08:57:54 UTC
Failed on Satellite-6.3 Snap 11.

Requesting the status of a powered down (inactive) bare metal host via hammer still returns "ERF42-9958 [Foreman::Exception]: Unknown power management support - can't continue".

Comment 11 Shimon Shtein 2017-08-21 11:23:06 UTC
From what I was able to reproduce, the system now behaves as following for bare metal host:
If the host is on, the system will return "on" status.
If the host is off, the system will return "off" status.
If the host has no BMC NIC configured, the system will return an exception.

Is this an acceptable behavior? If it is, I would suggest moving the BZ to verified. If this is not the desired behavior, I would like to know what the desired behavior is.

Comment 12 Ivan Necas 2017-08-22 14:24:51 UTC
@shimon: see https://bugzilla.redhat.com/show_bug.cgi?id=1387202#c5, the request is to not mention the exception, something like "Status: no interface detected"

Comment 13 Shimon Shtein 2017-09-17 17:18:06 UTC
Opened another upstream issuefor the specific case: https://github.com/theforeman/foreman/pull/4852

Comment 14 Shimon Shtein 2017-09-19 10:34:31 UTC
Connecting redmine issue http://projects.theforeman.org/issues/20966 from this bug

Comment 15 Sachin Ghai 2017-12-14 06:39:09 UTC
Verified with sat6.3 snap28. I don't see any exception for baremetal host instead see a proper message below:

1. baremetal host when no bmc enabled

~]# hammer host status --id 1
Power operations are not enabled on this host.

2. running virtual host

 ~]# hammer host status --id 3
Status: No reports
Power:  running


3. off virtual host
 ~]# hammer host status --id 4
Status: No reports
Power:  off

Comment 16 pm-sat@redhat.com 2018-02-21 16:54:37 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/RHSA-2018:0336


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