Bug #17087
closedUpdating default_value of a hash/array smart class parameter with a non string value should return an error message
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
Updated by Dominic Cleal almost 8 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.)
Updated by Tomáš Strachota almost 8 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.
Updated by Ori Rabin almost 8 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)
Updated by Ori Rabin almost 8 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.
Updated by The Foreman Bot almost 8 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
Updated by Vincent Lamers over 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!
Updated by Ori Rabin over 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.
Updated by Vincent Lamers over 7 years ago
thanks. It's indeed GUI related.
I'll open an new ticket.
Updated by Ori Rabin over 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset cade5cc2bad75d71eab1b9d0c458e831c1a6380a.
Updated by Marek Hulán over 7 years ago
- Translation missing: en.field_release set to 240
Updated by Ivan Necas over 7 years ago
- Target version changed from 1.10.3 to 1.14.1
Updated by Tomáš Strachota over 6 years ago
- Related to Bug #22753: Some API parameters are wrongly documented as enum types added