Bug 1381457 - Hammer error messages for job invocations need improving
Summary: Hammer error messages for job invocations need improving
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Remote Execution
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-04 07:18 UTC by Stephen Wadeley
Modified: 2018-09-04 17:43 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 17:43:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21852 0 Normal New hammer job-inovcation output should not have `--name` option 2020-04-29 21:43:14 UTC
Red Hat Bugzilla 1377245 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 1377245

Description Stephen Wadeley 2016-10-04 07:18:38 UTC
Description of problem:

The hammer error messages are not helpful to a new user of hammer

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

[root@rhel7-2-sat6-1 ~]# rpm -q tfm-rubygem-hammer_cli
tfm-rubygem-hammer_cli-0.5.1.11-4.el7sat.noarch



Actual results:

with no defaults set and no credentials file:

[root@rhel7-2-sat6-1 ~]# hammer job-invocation output --host "rhel7-2-sat6-1.example.com" --id 1
[Foreman] Password for admin: 
Error initializing command #<Proxy::RemoteExecution::Ssh::Dispatcher::Command:0x0000000191e5c8>
Net::SSH::AuthenticationFailed Authentication failed for user root.122.98
Exit status: EXCEPTION

In the above I can guess that is a user name and password failure, but it seems to contain information best left for the logs.

The example below does not give me a hint what I have done wrong:

[root@rhel7-2-sat6-1 ~]# hammer job-invocation output --host "rhel7-2-sat6-1.example.com" --name ping
[Foreman] Password for admin: 
Error: 400 Bad Request


after adding a credentials file:

[root@rhel7-2-sat6-1 ~]# hammer organization list
Error: undefined method `request' for #<String:0x00000003b33320>

Comment 1 Stephen Wadeley 2016-10-04 07:21:57 UTC
forgot to add this one, also before setting any defaults and with no credentials file:

[root@rhel7-2-sat6-1 ~]# hammer job-invocation output --id 14 --host rhel7-2-sat6-1.example.com 
[Foreman] Password for admin: 
undefined method `pending?' for nil:NilClass

Comment 2 Stephen Wadeley 2016-10-04 09:11:12 UTC
Hello

I had a mistake in my credentials file, https was missing in the "host" line[1].


So the last example in comment 0 now works:


[root@rhel7-2-sat6-1 ~]# hammer organization list
---|----------------------|----------------------|------------
ID | NAME                 | LABEL                | DESCRIPTION
---|----------------------|----------------------|------------
1  | Default Organization | Default_Organization |            
---|----------------------|----------------------|------------




[1] "Authentication" https://access.redhat.com/documentation/en/red-hat-satellite/6.2/paged/hammer-cli-guide/12-authentication

Comment 4 Stephen Wadeley 2016-10-04 09:53:34 UTC
Hello

When I ran this:

[root@rhel7-2-sat6-1 ~]# hammer job-invocation create --job-template "Ping a Host" --search-query "name = rhel7-2-sat6-1.example.com"
Job invocation 17 created

[.................................................] [100%]
1 task(s), 1 success, 0 fail


and then in the web UI went to Jobs, I saw the job but when I tried to view the details I saw:  Oops, we're sorry but something went wrong undefined method `name' for nil:NilClass

Is that already a known issue? I will attach the trace just in case.

Comment 9 Ivan Necas 2017-12-04 12:39:09 UTC
With 6.3, the job invocation output should better handle the exceptions:

bin/hammer job-invocation output --id 581 --host='host-5.foreman.test' 
Error initializing command: Net::SSH::AuthenticationFailed - Authentication failed for user root.0.4
Exit status: EXCEPTION

For the --name argument: the issue is with should not even show the name argument for this command, filing an issue for that.

Comment 10 Ivan Necas 2017-12-04 12:56:12 UTC
Created redmine issue http://projects.theforeman.org/issues/21852 from this bug

Comment 11 Bryan Kearney 2018-09-04 17:43:47 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.


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