Project

General

Profile

Actions

Bug #7764

closed

only generation of JSON objects or arrays allowed

Added by Spencer Owen about 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

If you attempt to create a smart parameter on a brand new install of foreman 1.6 on cent 6.5, you will get the following error.

only generation of JSON objects or arrays allowed

I've attached screenshots.

Steps to reproduce:

- Add the puppetlabs ntp module

- Add a smart parameter to override the 'servers' parameter with a value like 'time2.google.com'

- Change the prameter type from string to array

- Click apply

I'm happy to provide any additional information.


Files


Related issues 1 (0 open1 closed)

Related to Foreman - Refactor #9553: remove dump_in_quirks_modeClosedTomer Brisker02/25/2015Actions

Updated by Spencer Owen about 10 years ago

Full trace

I've also tried setting this as an array. (See screenshot), however it gives the same error.

JSON::GeneratorError
only generation of JSON objects or arrays allowed
app/models/lookup_key.rb:125:in `value_before_type_cast'
app/models/lookup_key.rb:119:in `default_value_before_type_cast'
app/views/lookup_keys/_fields.html.erb:17:in `_app_views_lookup_keys__fields_html_erb___1529588934913538750_77196500'
app/views/puppetclasses/_form.html.erb:55:in `block (2 levels) in _app_views_puppetclasses__form_html_erb___2785295828738098368_41843320'
app/views/puppetclasses/_form.html.erb:54:in `block in _app_views_puppetclasses__form_html_erb___2785295828738098368_41843320'
app/helpers/layout_helper.rb:257:in `form_for'
app/views/puppetclasses/_form.html.erb:3:in `_app_views_puppetclasses__form_html_erb___2785295828738098368_41843320'
app/views/puppetclasses/edit.html.erb:3:in `_app_views_puppetclasses_edit_html_erb___3029618563862301220_71364300'
app/controllers/application_controller.rb:293:in `process_error'
app/controllers/puppetclasses_controller.rb:35:in `update'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

If I look at just the 'servers' parameter, it appears to reset back to the incorrect 'string' value every time I try and change it. (see screenshot 2014-10-01 11.43.46 where type is 'string')

Actions #2

Updated by Spencer Owen about 10 years ago

I was able to work around the issue by completly deleting the 'servers' paramter from the foreman.

I then uninstalled and reinstalled the module, which appears to have reset all the parameters back to defaults.

This still is a bug, the foreman shouldn't have let me put invalid parameters in, or atleast should have let me undo my mistake, not crash.

Actions #3

Updated by Raul Laansoo almost 10 years ago

Spencer Owen wrote:

I was able to work around the issue by completly deleting the 'servers' paramter from the foreman.

I then uninstalled and reinstalled the module, which appears to have reset all the parameters back to defaults.

This still is a bug, the foreman shouldn't have let me put invalid parameters in, or atleast should have let me undo my mistake, not crash.

Stumbled on the same issue. Fix for me was to provide default value for the type. For example for arrays you should enter [] for empty array. Maybe when changing type Foreman should also provide default 'empty' value for non-string types?

Actions #4

Updated by Corey Osman almost 10 years ago

Just hit this bug as well. Unable to work around this issue because I am using the use puppet default feature which greys out the default value.

I have noticed this when the parameter value in the puppet code is set to an inherited value like $class::params::value1. Foreman thinks this is a string but it should be rendered as a variable which could be any type. Currently there is no way for foreman to check the type of the inherited value so it gives up and sets it to a string.

Actions #5

Updated by Corey Osman almost 10 years ago

Corey Osman wrote:

Just hit this bug as well. Unable to work around this issue because I am using the use puppet default feature which greys out the default value.

I have noticed this when the parameter value in the puppet code is set to an inherited value like $class::params::value1. Foreman thinks this is a string but it should be rendered as a variable which could be any type. Currently there is no way for foreman to check the type of the inherited value so it gives up and sets it to a string.

Actually, the work around for anyone also using the "use puppet default" feature is to do the following:

1. click override
2. keep use puppet default UNCHECKED
3. change the default value to a default value you want. Example for Array: [], Example for Hash: {}
4. change the parameter type to match your default value array = [], hash = {}
5. click submit
6. Go back and edit, and then check use puppet default (only if you desire this setting)
7. click submit (again)

Actions #6

Updated by Dominic Cleal almost 10 years ago

  • Category set to Parameters
Actions #7

Updated by The Foreman Bot almost 10 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2195 added
  • Pull request deleted ()
Actions #8

Updated by Dominic Cleal almost 10 years ago

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

PR was closed.

Actions #9

Updated by The Foreman Bot almost 10 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2202 added
  • Pull request deleted ()
Actions #10

Updated by Shlomi Zadok almost 10 years ago

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

Updated by Marek Hulán almost 10 years ago

Actions #12

Updated by Bryan Kearney almost 10 years ago

  • Bugzilla link set to 1195212
Actions #13

Updated by Dominic Cleal almost 10 years ago

  • Assignee set to Shlomi Zadok
  • Translation missing: en.field_release set to 28
Actions

Also available in: Atom PDF