Bug 2166404

Summary: [RFE] Mention the list of possible providers in "explain_proxy_selection" rake task of Satellite 6.13
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: low Docs Contact:
Priority: low    
Version: 6.13.0CC: aruzicka, pcreech
Target Milestone: 6.14.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: rubygem-foreman_remote_execution-10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:18:18 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:

Description Sayan Das 2023-02-01 17:49:22 UTC
Description of problem:

The "foreman_remote_execution:explain_proxy_selection" works great but It requires input for the PROVIDER env var or else the execution will abort.

Someone who may not be aware of the possible providers to pass as value, It would be confusing to find out what to use. 

https://github.com/theforeman/foreman_remote_execution/pull/733 shows the use with SSH provider but Satellite 6.13 ( even 6.12 ) would only have either Script or Ansible as provider i guess. 

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

Satellite 6.13 

How reproducible:
Always

Steps to Reproduce:
1. Install a Satellite 6.13
2. Register a client with the satellite 
3.

Actual results:

# foreman-rake -D foreman_remote_execution:explain_proxy_selection
rake foreman_remote_execution:explain_proxy_selection
    Explains which proxies can be used for remote execution against HOST using a specified PROVIDER.
    
      * HOST         : A scoped search query to find hosts by
      * PROVIDER     : The PROVIDER to scope by
      * FORMAT       : Output format, one of verbose (or unset), json, pretty-json, csv
      * FOREMAN_USER : Run as if FOREMAN_USER triggered a job (runs as anonymous_admin if unset)
      * ORGANIZATION : Run in the context of ORGANIZATION (runs in any context if unset)
      * LOCATION     : Run in the context of LOCATION (runs in any context if unset)



# foreman-rake foreman_remote_execution:explain_proxy_selection HOST=host.example.com
rake aborted!
Environment variable PROVIDER has to be set
/usr/share/gems/gems/foreman_remote_execution-8.2.0/lib/foreman_remote_execution/tasks/explain_proxy_selection.rake:18:in `block (2 levels) in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => foreman_remote_execution:explain_proxy_selection
(See full trace by running task with --trace)


Expected results:

# foreman-rake -D foreman_remote_execution:explain_proxy_selection

...
      * PROVIDER     : The PROVIDER to scope by ( Script or Ansible )
...
...


# foreman-rake foreman_remote_execution:explain_proxy_selection HOST=host.example.com
..
..
Environment variable PROVIDER has to be set ( possible values are Script and Ansible )
..
..


Of course, if there are some other types of provides present that I am missing, They can at least be a part of the Description of the rake. 

Additional info:

No impact but simply an improvement request for better usability

Comment 2 Adam Ruzicka 2023-02-03 13:46:26 UTC
I'm afraid that listing it in help (foreman-rake -D) is borderline impossible. The list is dynamic, depends on the loaded code and when printing the descriptions, rake does not load the application code. In other words, the description for the rake task has to be more or less static string, while we would need to have its contents generated dynamically.

The second option (showing the possibilities when none is given by the user), is doable and actually an easy thing to do. Would that be enough?

Comment 3 Sayan Das 2023-02-03 13:51:28 UTC
Ah yes.. Even that works fine for me. The idea is to not leave it blank and give something for the user to work with.

Comment 6 Peter Ondrejka 2023-06-14 13:33:18 UTC
Verified on Sat 6.14 snap 1. The list of providers is now returned in the described scenario:

Environment variable PROVIDER has to be set to one of SSH, Script, Ansible. Note provider aliases SSH = Script.

Comment 9 errata-xmlrpc 2023-11-08 14:18:18 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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818