Project

General

Profile

Actions

Bug #17087

closed

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

Added by Ori Rabin over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
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 1 (0 open1 closed)

Related to Foreman - Bug #22753: Some API parameters are wrongly documented as enum typesClosedTomáš Strachota03/02/2018Actions
Actions #1

Updated by Dominic Cleal over 7 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.)

Actions #2

Updated by Tomáš Strachota over 7 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.

Actions #3

Updated by Ori Rabin over 7 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)
Actions #4

Updated by Ori Rabin over 7 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.

Actions #5

Updated by The Foreman Bot over 7 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
Actions #6

Updated by Ori Rabin over 7 years ago

  • Target version set to 1.10.3
Actions #7

Updated by Ori Rabin over 7 years ago

  • Bugzilla link set to 1411069
Actions #8

Updated by Vincent Lamers about 7 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!

Actions #9

Updated by Ori Rabin about 7 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.

Actions #10

Updated by Vincent Lamers about 7 years ago

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

Actions #11

Updated by Ori Rabin almost 7 years ago

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

Updated by Marek Hulán almost 7 years ago

  • translation missing: en.field_release set to 240
Actions #13

Updated by Ivan Necas almost 7 years ago

  • Target version changed from 1.10.3 to 1.14.1
Actions #14

Updated by Tomáš Strachota about 6 years ago

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

Also available in: Atom PDF