Bug #16107

Cannot render snippet due to .join call

Added by Daniel Lobato Garcia almost 2 years ago. Updated 7 days ago.

Status:Closed
Priority:Normal
Assignee:Daniel Lobato Garcia
Category:Foreman
Target version:1.11.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link:1346091 Found in Releases:
Pull request:https://github.com/theforeman/foreman_remote_execution/pull/199, https://github.com/theforeman/community-templates/pull/481

Description

Currently Foreman is failing to render the REX snippet with this error: "The snippet 'remote_execution_ssh_keys' threw an error: undefined method `join' for #<String:0x007f4775c597e8>"

From what I see https://github.com/theforeman/community-templates/blob/develop/snippets/remote_execution_ssh_keys.erb#L30 , the parameter is expected to be an array or similar.
The docs say nothing about it - https://theforeman.org/plugins/foreman_remote_execution/0.3/index.html - and there's no way for the user to set the parameter as Array as a global param or a host param.

The 'expected' Array comes from the plugin itself who queries all proxies for the param - https://github.com/theforeman/foreman_remote_execution/blob/0c722f8ecb96a94f6f74db30e0305d3f37fde7cf/app/models/concerns/foreman_remote_execution/host_extensions.rb

I propose making the method in REX return a string so that we can: * remove the `join` call from the template * allow people to set their own SSH keys via global params

Associated revisions

Revision c133a43e
Added by Dirk Götz about 1 month ago

Refs #16107 - Also handle strings in snippet remote_execution_ssh_keys

This allows to use the snippet also without using the Remote execution plugin.

History

#1 Updated by Daniel Lobato Garcia almost 2 years ago

Also, the method in REX doesn't respect the user settings now - e.g: `params['remote_execution_ssh_keys']` takes the content of `Host#remote_execution_ssh_keys` no matter what, if there's any. The plugin should respect the param if it already exists and merely add new keys to it

#2 Updated by The Foreman Bot almost 2 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/199 added

#3 Updated by Daniel Lobato Garcia almost 2 years ago

  • Target version set to 1.6.2

#4 Updated by Daniel Lobato Garcia almost 2 years ago

  • Target version changed from 1.6.2 to 117

#5 Updated by Daniel Lobato Garcia almost 2 years ago

  • Target version changed from 117 to 1.5.2

#6 Updated by Alex Fisher over 1 year ago

A number of puppet users are already using the parameter from Foreman's ENC output and expect it to be an array.

#7 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version changed from 1.5.2 to 1.4.3

#8 Updated by Ivan Necas over 1 year ago

  • Bugzilla link set to 1346091

#9 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version changed from 1.4.3 to 1.11.0

#10 Updated by Dirk Götz about 1 month ago

  • Pull request https://github.com/theforeman/community-templates/pull/481 added

I created a new pull request to change the template and allow it to render a manually provided string or the array provided by the plugin. Not sure if this fixes all issues, but it solves at least my use case.

#11 Updated by Ivan Necas about 1 month ago

  • Status changed from Ready For Testing to Closed

This has been fixed in community templates.

Also available in: Atom PDF