Bug #8052

Smart class parameters with ERB snippets are broken for other that String types

Added by Petr Chalupa over 3 years ago. Updated about 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Marek Hulán
Category:Smart Variables
Target version:-
Difficulty: Bugzilla link:1183643
Found in release: Pull request:https://github.com/theforeman/foreman/pull/2080
Story points-
Velocity based estimate-
Release1.7.3Release relationshipAuto

Description

Smart class parameters currently have broken validation and type-casting when used with ERB snippets. It tries to validate the value with the ERB without evaluation when key is being saved. It was hacked around it in Staypuft. How to fix it: Validation and type-casting has to be done on classification when ERB can be evaluated; SafeRender needs to be aware of the ERB parameters, they need to be validated and properly type-casted based on the given KeyValue (this association is missing currently).

The hack for Staypuft is in this file https://github.com/theforeman/staypuft/blob/master/app/models/staypuft/concerns/lookup_key_extensions.rb


Related issues

Related to Foreman - Refactor #9142: Unify validate_regexp and validate_list for lookup value/key Duplicate 01/28/2015
Related to Foreman - Bug #10088: Smart class default parameter interpreted as string New 04/08/2015
Related to Foreman - Bug #9673: YAML type casting fails for lookup values in 1.7.3 Closed 03/06/2015
Related to Foreman - Bug #9787: Default values of smart class parameters can't be JSON or... Closed 03/16/2015
Blocked by Foreman - Bug #9044: Tests can fail randomly on mac.succ Closed 01/20/2015

Associated revisions

Revision f8a56f5b
Added by Marek Hulán about 3 years ago

Fixes #8052 - allows erb in array and hash params

Revision 0f203546
Added by Marek Hulán almost 3 years ago

Fixes #8052 - allows erb in array and hash params

(cherry picked from commit f8a56f5bd809305080e4ba69113f73f65957a3f9)

History

#1 Updated by Dominic Cleal over 3 years ago

  • Category set to Smart Variables
  • Priority changed from High to Normal

#2 Updated by Marek Hulán about 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Marek Hulán

#3 Updated by The Foreman Bot about 3 years ago

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

#4 Updated by Ivan Necas about 3 years ago

  • Bugzilla link set to 1183643

#5 Updated by Dominic Cleal about 3 years ago

  • Blocked by Bug #9044: Tests can fail randomly on mac.succ added

#6 Updated by Dominic Cleal about 3 years ago

  • Release set to 1.7.3

#7 Updated by Dominic Cleal about 3 years ago

  • Related to Refactor #9142: Unify validate_regexp and validate_list for lookup value/key added

#8 Updated by Marek Hulán about 3 years ago

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

#9 Updated by Dominic Cleal almost 3 years ago

  • Related to Bug #10088: Smart class default parameter interpreted as string added

#10 Updated by Dominic Cleal almost 3 years ago

  • Related to Bug #9673: YAML type casting fails for lookup values in 1.7.3 added

#11 Updated by Dominic Cleal almost 3 years ago

  • Related to Bug #9787: Default values of smart class parameters can't be JSON or YAML added

Also available in: Atom PDF