Bug 1826603

Summary: Remote execution job fails with TypeError (no implicit conversion of Array into String
Product: Red Hat Satellite Reporter: dgupte
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7.0CC: ajambhul, aruzicka, egolov, inecas, jjeffers, momran, pstehlik, tasander
Target Milestone: 6.7.5Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_remote_execution-2.0.10.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-26 19:03:10 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 dgupte 2020-04-22 04:38:18 UTC
Description of problem:
>>>
Remote execution job fails with "TypeError (no implicit conversion of Array into String" error after upgrade to 6.7 when Global Parameter has "remote_execution_ssh_keys" defined. 

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

Steps to Reproduce:
>>>
1. Add "remote_execution_ssh_keys" in Global Parameters with type string and any key value  like below,
--
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSsK0oExZLLLVLS2ZN+8qTl2ak+4tRGTP57mTtlGd1nNd6aTFwDakQ6chW18VcrpELhU0VYzUBYI4K2IRlYQUolW3qCLIeKAYJHDj81KYdSWeGx4PPPskmUc3BczN2nZOb3+PoOsV00lH1rfPIFuA6Oj4TUiyCpKZIUIL6/tKrQ/WxZ5FDbdQyHicXtOQy/rroyoM/DArJm77LTC9V8RCDmBVioK4bltdQXSA4SQkmkIAn9hafNwmIbFq/9JRdFXYzj5pqWikXYj45BLcELlOoBoZZx6N9UelwcE/fFL/dy8hiWYzOkMxshuCTuVdAJi/rPedZd1XGSD455uboPlRJ
--

2.  Try to fetch host paras from Satellite webui >> Hosts >> select any host >> click on "YAML" or use hammer command, 

# echo  'Host.find_by_name("vm253-90.example.com").params'  |  foreman-rake console


Actual results:
>>>
[root@sat67 ~]# echo  'Host.find_by_name("vm253-90.example.com").params'  |  foreman-rake console
Loading production environment (Rails 5.2.1)
Switch to inspect mode.
Host.find_by_name("vm253-90.example.com").params
Traceback (most recent call last):
        6: from lib/tasks/console.rake:5:in `block in <top (required)>'
        5: from (irb):1
        4: from app/models/concerns/host_params.rb:11:in `params'
        3: from app/models/concerns/host_params.rb:54:in `host_params'
        2: from foreman_remote_execution (2.0.10) app/models/concerns/foreman_remote_execution/host_extensions.rb:54:in `host_params_hash'
        1: from foreman_remote_execution (2.0.10) app/models/concerns/foreman_remote_execution/host_extensions.rb:54:in `+'
TypeError (no implicit conversion of Array into String)

Expected results:
>>>
[root@sat66 ~]# echo  'Host.find_by_name("vm253-90.example.com").params'  |  foreman-rake console
Loading production environment (Rails 5.2.1)
Switch to inspect mode.
Host.find_by_name("vm253-90.example.com").params
{"anan"=>true, "enable-epel"=>"false", "enable-puppet5"=>"true", "remote_execution_ssh_keys"=>["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhZJllZtrkxCLRuHTPQdRGktroyY7S3Vmk6/QHtZSHCvV/OrtVYyaUGVGxB5nD+uzBnz2IkYp49lnPwPYqGX5S/gzzCbM4EoyGvulGCVTAq+TwKJUQkck2QmpTnyKNiZCGQlIlBE8aGSEfAwvfyUEkng+Rjsw4u/UoNYJ5ijuVNjyh6G6rIilT0f3MdQ/DQTmMQVy1Aol5li8MCbu2r96rgff2BHM2IdV1Aqr5hTbNF/+SbhKZWq1nTZ4Jmbu9hSux/l4atxH7ikqVucP2HZEDtDY6zAvHSgMSJtEcdC38GZ/QOc3gBpnPgtwECVORwzO+w5rNY9BBLNRQE6AMtLtl foreman-proxy.pnq2.redhat.com"], "remote_execution_ssh_user"=>"rex", "remote_execution_effective_user_method"=>"sudo", "remote_execution_connect_by_ip"=>true}

Comment 3 Adam Ruzicka 2020-04-22 10:20:12 UTC
Well, yes, the parameter should be an array of strings, not just a string.

Comment 10 Adam Ruzicka 2020-06-09 08:42:53 UTC
Created redmine issue http://projects.theforeman.org/issues/30068 from this bug

Comment 11 Bryan Kearney 2020-06-20 12:05:14 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30068 has been resolved.

Comment 13 Adam Ruzicka 2020-07-03 08:36:27 UTC
Not sure what the actual question for the needinfo is. Anyway, support for it being a string was added back in tfm-rubygem-foreman_remote_execution-3.3.2

Comment 14 Taft Sanders 2020-07-03 12:33:43 UTC
(In reply to Adam Ruzicka from comment #13)
> Not sure what the actual question for the needinfo is. Anyway, support for
> it being a string was added back in
> tfm-rubygem-foreman_remote_execution-3.3.2

Sorry for the confusion. Just wanted to bring to your attention that the "Hidden Value" checkbox changes the value from array to string and wasn't sure if it was being addressed or covered in any QE testing. Since support for both array and string will be included, then it should. Thanks for clarifying.

Comment 16 Lukáš Hellebrandt 2020-10-14 14:44:51 UTC
Verified with Sat 6.7.5 snap 1.

Used reproducer from OP and from comment 14. Host parameters can now be retrieved.

Comment 21 errata-xmlrpc 2020-10-26 19:03:10 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 (Satellite 6.7.5 Async 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/RHBA-2020:4346