Project

General

Profile

Bug #20931

Using host_params in parameters leads to @Safemode doesn't allow to access 'host_params' on #<Safemode::ScopeObject>@

Added by Ivan Necas over 1 year ago. Updated 8 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Smart Variables
Target version:
Difficulty:
medium
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

1. use <%= host_params('blabla') %> inside the host parameters
2. Rendering fails on Safemode doesn't allow to access 'host_params' on #<Safemode::ScopeObject>


Related issues

Related to Foreman - Feature #16740: Host parameters should be available in templates using some macroClosed2016-09-29
Related to Foreman - Bug #23593: function "host_param" in default value of smart class parameter is not allowed anymore. It results in undefined method `host_param' (erb):1:in `parse_string'Duplicate

Associated revisions

Revision 638d98a9 (diff)
Added by Ivan Necas over 1 year ago

Fixes #20931 - unify parameters and templates renderer (#4835)

  • Fixes #20931 - unify parameters and templates renderer

Before this patch, we used separate renderer for the parameters. This
caused issues when introducing more dsl methods for the templates that
we want to use in the parameters as well. Also, by the time of writing
the original SafeRenderer, there was no Renderer available.

After doing so, I was hitting issue with recursion, as
`Renderer.host_param` was using `@host.params` while the @host.params
was trying to render the params, that could include the `host_param`
call again, which lead to endless loop. After simplifying the
`HostParams` methods, it is possible to achieve this.

I also noticed that we were rendering only the inherited params and not
the non-inherited once. I've fixed this bug also as part of this patch.

Last but not least, due to the fact that we were using the
host_inherited_params for multiple purposes, we were rendering it also
when showing the host form, which was not even needed.

History

#1 Updated by Ivan Necas over 1 year ago

  • Related to Feature #16740: Host parameters should be available in templates using some macro added

#2 Updated by Ivan Necas over 1 year ago

  • Difficulty changed from easy to medium

#3 Updated by The Foreman Bot over 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4835 added

#4 Updated by Marek Hulán over 1 year ago

  • Legacy Backlogs Release (now unused) set to 330

#5 Updated by Ivan Necas over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#6 Updated by Marek Hulán 11 months ago

  • Related to Bug #23593: function "host_param" in default value of smart class parameter is not allowed anymore. It results in undefined method `host_param' (erb):1:in `parse_string' added

#7 Updated by Ondřej Pražák 8 months ago

  • Triaged set to No
  • Fixed in Releases 1.18.2 added

#8 Updated by Tomer Brisker 8 months ago

  • Fixed in Releases 1.18.0 added
  • Fixed in Releases deleted (1.18.2)

Also available in: Atom PDF