Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2124850

Summary: failure to enable async-ssh rex mode with Couldn't enable 'script'
Product: Red Hat Satellite Reporter: Peter Ondrejka <pondrejk>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: aruzicka, pcreech
Target Milestone: 6.12.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-smart_proxy_remote_execution_ssh-0.7.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:35:39 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: 2048547    

Description Peter Ondrejka 2022-09-07 09:33:33 UTC
Description of problem:

async ssh rex script mode is not enabled correctly on proxy, script jobs then fail to execute

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

How reproducible:
always

Steps to Reproduce:
1. satellite-installer --foreman-proxy-plugin-remote-execution-script-mode=ssh-async
2. run script rex job

Actual results:
/var/log/foreman-proxy/proxy.log contains:

2022-09-07T04:35:48  [E] Couldn't enable 'script'
2022-09-07T04:35:48  [W] Error details for Couldn't enable 'script': <RuntimeError>: Mode has to be one of ssh, async-ssh, pull, pull-mqtt, given ssh-async
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.1/lib/smart_proxy_remote_execution_ssh.rb:28:in `validate_mode!'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.1/lib/smart_proxy_remote_execution_ssh.rb:10:in `validate!'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.1/lib/smart_proxy_remote_execution_ssh/plugin.rb:45:in `block in <class:Plugin>'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:228:in `class_eval'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:228:in `configure_plugin'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:109:in `block in configure'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:109:in `each'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:109:in `configure'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:187:in `each'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:187:in `initialize_plugins'
/usr/share/foreman-proxy/lib/launcher.rb:177:in `launch'
/usr/share/foreman-proxy/bin/smart-proxy:6:in `<main>'

script rex job then fails with:

Initialization error: RestClient::NotFound - 404 Not FoundError loading data from Capsule: NoMethodError - undefined method `code' for "404 Not Found":String
Did you mean?  encode

Expected results:
async-ssh mode working

Additional info:
Using the info from the proxy log I attempted to enable asnyc-ssh instead:

~]# satellite-installer --foreman-proxy-plugin-remote-execution-script-mode=async-ssh
[ERROR ] [root] Parameter foreman-proxy-plugin-remote-execution-script-mode invalid: async-ssh must be one of ssh, ssh-async, pull-mqtt
Error during configuration, exiting

So it seems there is a mismatch in naming expectations async-ssh vs ssh-async

I can share the setup upon ping.

Comment 1 Adam Ruzicka 2022-09-07 09:45:32 UTC
This is fixed in latest upstream as part of https://github.com/theforeman/smart_proxy_remote_execution_ssh/pull/82 , a subset of that change will need to be cherry-picked.

Comment 2 Bryan Kearney 2022-09-07 12:04:58 UTC
Upstream bug assigned to aruzicka

Comment 3 Bryan Kearney 2022-09-07 12:05:00 UTC
Upstream bug assigned to aruzicka

Comment 4 Adam Ruzicka 2022-09-13 12:53:53 UTC
smart_proxy_remote_execution_ssh-0.7.2 containing the fix for this BZ just went out to rubygems

Comment 5 Peter Ondrejka 2022-09-19 15:18:58 UTC
Checked on Satellite 6.12 snap 11. I was able to turn on async-ssh using "satellite-installer --foreman-proxy-plugin-remote-execution-script-mode=async-ssh", but running the actual job against a host didn't succeed -- the job left hanging, /var/log/foreman-proxy/proxy.log showing:

2022-09-19T11:06:32  [E] <OpenSSL::SSL::SSLError> SSL_accept returned=1 errno=0 state=error: http request
	/usr/share/ruby/webrick/server.rb:299:in `accept'
	/usr/share/ruby/webrick/server.rb:299:in `block (2 levels) in start_thread'
	/usr/share/ruby/webrick/utils.rb:263:in `timeout'
	/usr/share/ruby/webrick/server.rb:297:in `block in start_thread'
	/usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

I may have omitted some additional config steps if there are any, I just ran the installer command. Machine is available for inspection.

Comment 6 Adam Ruzicka 2022-09-19 16:12:46 UTC
What's described in #5 is completely unrelated to what is described in #0. Also, I'm able to reproduce it on a 6.11 so that's nothing new.

Comment 7 Peter Ondrejka 2022-09-20 08:36:14 UTC
After discussion with adam, I created https://bugzilla.redhat.com/show_bug.cgi?id=2128209 to track problem from comment #5, it will make things easier if we decide to backport the fix. Closing this one as the original issue was fixed.

Comment 11 errata-xmlrpc 2022-11-16 13:35:39 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.12 Release), 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-2022:8506