Project

General

Profile

Bug #14476

Caster fails with incorrect exception trying to cast invalid real from string

Added by Tomer Brisker almost 4 years ago. Updated over 1 year ago.

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

Description

attempting to cast a string that isn't a valid real number leads to the exception:

Error while parsing smartvar
 | NoMethodError: undefined method `cast_value_integer' for #<Foreman::Parameters::Caster:0x000000107a4da0>
 | /home/tbrisker/foreman/app/services/foreman/parameters/caster.rb:84:in `cast_real'
 | /home/tbrisker/foreman/app/services/foreman/parameters/caster.rb:33:in `casted_value'
 | /home/tbrisker/foreman/app/services/foreman/parameters/caster.rb:17:in `cast!'
 | /home/tbrisker/foreman/app/models/lookup_value.rb:71:in `validate_and_cast_value'
... snipped rest of stacktrace


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 b953c6ae (diff)
Added by Tomer Brisker almost 4 years ago

Fixes #14476 - Correctly handle casting of invalid real param values

Revision 7b1b0ec7 (diff)
Added by Tomer Brisker almost 4 years ago

Fixes #14476 - Correctly handle casting of invalid real param values

(cherry picked from commit b953c6ae5390adb93e44c6778017373795c9bc63)

History

#1 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/3390 added

#2 Updated by Anonymous almost 4 years ago

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

#3 Updated by Dominic Cleal almost 4 years ago

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

#4 Updated by Dominic Cleal almost 4 years ago

  • Category set to Smart Variables
  • Legacy Backlogs Release (now unused) set to 141

Also available in: Atom PDF