Project

General

Profile

Bug #17087

Updating default_value of a hash/array smart class parameter with a non string value should return an error message

Added by Ori Rabin about 2 years ago. Updated 4 months ago.

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

Description

Sending default_value as a hash/array fails through the api but doesn't give any error message.
Sending:

"default_value": "['a','b']" 

will work but
"default_value": ['a','b']

will fail with no error message


Related issues

Related to Foreman - Bug #22753: Some API parameters are wrongly documented as enum typesClosed2018-03-02

Associated revisions

Revision cade5cc2 (diff)
Added by Ori Rabin over 1 year ago

Fixes #17087 - default and overrides values converted to string

History

#1 Updated by Dominic Cleal about 2 years ago

default_value is defined as taking a string input in the API, the user shouldn't really be passing non-string values (arrays, hashes, ints, bools). It should probably be a string representation matching the UI. Or is some conversion happening prior to it reaching the model?

(Logs showing the issue may make this clearer.)

#2 Updated by Tomáš Strachota about 2 years ago

I agree that when it's defined as string, it should take only strings. Better error message would be appreciated though, but I'd prefer to handle it as a generic issue for the whole api.

#3 Updated by Ori Rabin about 2 years ago

  • Subject changed from Updating default_value of a hash/array smart class parameter fails in the api to Updating default_value of a hash/array smart class parameter with a non string value should return an error message
  • Description updated (diff)

#4 Updated by Ori Rabin about 2 years ago

I updated the description.
I agree with Tomas, Setting does allow to send an array as a value so this needs an error message or to change.

#5 Updated by The Foreman Bot almost 2 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ori Rabin
  • Pull request https://github.com/theforeman/foreman/pull/4137 added

#6 Updated by Ori Rabin almost 2 years ago

  • Target version set to 1.10.3

#7 Updated by Ori Rabin almost 2 years ago

  • Bugzilla link set to 1411069

#8 Updated by Vincent Lamers almost 2 years ago

I'm running foreman 1.13.3-1. I'm having issues with overriding hashes (smart class parameter).. Yaml looks good but after I change the environment of the host I'll get a error 'value is invalid hash'. That happens to all the hashes which I want to override. It only happens after I try to change the environment of a host. Is this bug related to this? Many thanks!

#9 Updated by Ori Rabin almost 2 years ago

Is your update through the api or UI? this bug is an api bug so if you're updating through the UI it's not related.
If it is unrelated please open a new issue with a description of steps and if possible attach screenshots or examples of the values.

#10 Updated by Vincent Lamers almost 2 years ago

thanks. It's indeed GUI related.
I'll open an new ticket.

#11 Updated by Ori Rabin over 1 year ago

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

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

  • Legacy Backlogs Release (now unused) set to 240

#13 Updated by Ivan Necas over 1 year ago

  • Target version changed from 1.10.3 to 1.14.1

#14 Updated by Tomáš Strachota 9 months ago

  • Related to Bug #22753: Some API parameters are wrongly documented as enum types added

Also available in: Atom PDF