Bug 1381457

Summary: Hammer error messages for job invocations need improving
Product: Red Hat Satellite Reporter: Stephen Wadeley <swadeley>
Component: Remote ExecutionAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: aruzicka, inecas, jcallaha, sshtein
Target Milestone: UnspecifiedKeywords: Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 17:43:47 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:

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.