Project

General

Profile

Bug #11862

Smart variables with illegal characters raises an exception

Added by Ori Rabin almost 4 years ago. Updated about 1 year ago.

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

Description

For example using rocket hash instead of json:
1) create a smart variable of type hash
2) change default value to: {'a'=>'b'}
3) try to save
there should be a validation message that this is not a valid json/yaml but an exception is received:
(<unknown>): did not find expected ',' or '}' while parsing a flow mapping at line 1 column 1


Related issues

Related to Foreman - Refactor #10232: move validations and casting out of lookup keys and values into single-responsibility classesClosed2015-04-22

Associated revisions

Revision 706de3cf (diff)
Added by Tom Caspy over 3 years ago

fixes #11862 - validating that casted hash is valid

Catch parse errors correctly under Ruby 1.9.3, and ensure the uncasted
value is displayed back in the UI if it fails to parse.

Revision f2f1db82 (diff)
Added by Tom Caspy over 3 years ago

fixes #11862 - validating that casted hash is valid

Catch parse errors correctly under Ruby 1.9.3, and ensure the uncasted
value is displayed back in the UI if it fails to parse.

(cherry picked from commit 706de3cff65f9d9f549f077bf9be7560fd61233f)

History

#1 Updated by Dominic Cleal almost 4 years ago

I can't reproduce this to determine if it's a regression. All of my attempts simply fail validation on the default value field. Could you confirm when it was introduced please, and some more details about how to reproduce? (e.g. which UI or API, logs, stack trace)

#2 Updated by Tom Caspy almost 4 years ago

Reproduction steps:
  1. edit puppetclass
  2. click on smart variable
  3. add a new smart variable of type "hash"
  4. input a hash which isn't a valid json or yaml (i.e. '{"foo" => "bar"}' or something similar)
  5. submit and see exception

Expected result - show a validation message saying this isn't a valid hash.
Expected UX - have a key-value editor which turns into a valid json on submit and save the user the trouble (out of scope of this ticket but idea worth mentioning)

#3 Updated by Ori Rabin almost 4 years ago

  • Assignee changed from Tom Caspy to Ori Rabin

#4 Updated by Ori Rabin almost 4 years ago

  • Assignee changed from Ori Rabin to Tom Caspy

#5 Updated by Ori Rabin almost 4 years ago

In 1.9 this was invalid for a hash but you would get a validation message and not an exception.

#6 Updated by Dominic Cleal almost 4 years ago

  • Related to Refactor #10832: Make LookupKey an STI for puppet and variable keys added

#7 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 63

#8 Updated by Ori Rabin almost 4 years ago

  • Related to Refactor #10232: move validations and casting out of lookup keys and values into single-responsibility classes added

#9 Updated by Ori Rabin almost 4 years ago

  • Related to deleted (Refactor #10832: Make LookupKey an STI for puppet and variable keys)

#10 Updated by The Foreman Bot almost 4 years ago

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

#11 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) changed from 63 to 104

#12 Updated by Tom Caspy over 3 years ago

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

Also available in: Atom PDF