Issue with hash-in-array for Foreman 1.3/1.4

Hi,

I have a problem using https://github.com/echocat/puppet-graphite under
foreman, specifically with:

gr_storage_schemas (array) override with:

[{"name"=>"default", "retentions"=>"60s:1d,5m:1w,1h:5y", "pattern"=>".*"}]

(which is the default that I've put in the class itself):

I get an error when I override the class parameter with the same default.

(<unknown>): found unexpected ':' while scanning a plain scalar at line 1
column 34

If you feel this is an error with Foreman itself, please open a new issue
with Foreman ticketing system<Issues - Foreman>,
You would probably need to attach the Full trace<https://10.6.181.126/puppetclasses/137#>and relevant log entries.
Psych::SyntaxError
(<unknown>): found unexpected ':' while scanning a plain scalar at line 1
column 34

app/models/lookup_key.rb:225:in rescue in load_yaml_or_json&#39; app/models/lookup_key.rb:222:inload_yaml_or_json'
app/models/lookup_key.rb:232:in cast_value_array&#39; app/models/lookup_key.rb:124:incast_validate_value'
app/models/lookup_key.rb:179:in validate_and_cast_default_value&#39; app/controllers/puppetclasses_controller.rb:39:inupdate'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'

it's basically an array of hash(es) but I have no clue where is the :

Is there an issue converting the array/hash to yaml and that in fact is the
problem?

Any clues/hints/links are appreciated

Thanks.

This looks like Bug #4639: Syntax of arrays in parameters changed when edit is changed. - Foreman where our
edit form is rendering a Ruby or Puppet-style array syntax, while
Foreman only supports YAML or JSON style.

Try changing it to a JSON format with colons instead of "=>" key/value
separators.

··· -- Dominic Cleal Red Hat Engineering

On 27/03/14 14:23, Catalin Muresan wrote:

Hi,

I have a problem using https://github.com/echocat/puppet-graphite under
foreman, specifically with:

gr_storage_schemas (array) override with:

[{“name”=>“default”, “retentions”=>“60s:1d,5m:1w,1h:5y”, “pattern”=>".*"}]

(which is the default that I’ve put in the class itself):

I get an error when I override the class parameter with the same default.

(): found unexpected ‘:’ while scanning a plain scalar at line
1 column 34

If you feel this is an error with Foreman itself, please open a new
issue with Foreman ticketing system
http://theforeman.org/projects/foreman/issues, You would probably need
to attach the Full trace https://10.6.181.126/puppetclasses/137# and
relevant log entries.

/Psych::SyntaxError/
(): found unexpected ‘:’ while scanning a plain scalar at line
1 column 34

app/models/lookup_key.rb:225:in rescue in load_yaml_or_json' app/models/lookup_key.rb:222:inload_yaml_or_json’
app/models/lookup_key.rb:232:in cast_value_array' app/models/lookup_key.rb:124:incast_validate_value’
app/models/lookup_key.rb:179:in validate_and_cast_default_value' app/controllers/puppetclasses_controller.rb:39:inupdate’
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread’

it’s basically an array of hash(es) but I have no clue where is the :

Is there an issue converting the array/hash to yaml and that in fact is
the problem?

Any clues/hints/links are appreciated

Yea, that worked (JSON), and it's displayed (with the patch applied) in
ruby format.
It's a bit confusing since the Parameter type is array (not json or yaml).
I was going to say that this should be mentioned but after I clicked the
little "i" which had the explanation.

Thanks!

··· On Thursday, 27 March 2014 17:46:47 UTC, Dominic Cleal wrote: > > This looks like http://projects.theforeman.org/issues/4639 where our > edit form is rendering a Ruby or Puppet-style array syntax, while > Foreman only supports YAML or JSON style. > > Try changing it to a JSON format with colons instead of "=>" key/value > separators. > > -- > Dominic Cleal > Red Hat Engineering > > On 27/03/14 14:23, Catalin Muresan wrote: > > Hi, > > > > I have a problem using https://github.com/echocat/puppet-graphite under > > foreman, specifically with: > > > > gr_storage_schemas (array) override with: > > > > [{"name"=>"default", "retentions"=>"60s:1d,5m:1w,1h:5y", > "pattern"=>".*"}] > > > > (which is the default that I've put in the class itself): > > > > I get an error when I override the class parameter with the same > default. > > > > (): found unexpected ':' while scanning a plain scalar at line > > 1 column 34 > > > > If you feel this is an error with Foreman itself, please open a new > > issue with Foreman ticketing system > > , You would probably > need > > to attach the Full trace and > > relevant log entries. > > > > /Psych::SyntaxError/ > > *(): found unexpected ':' while scanning a plain scalar at line > > 1 column 34* > > app/models/lookup_key.rb:225:in `rescue in load_yaml_or_json' > > app/models/lookup_key.rb:222:in `load_yaml_or_json' > > app/models/lookup_key.rb:232:in `cast_value_array' > > app/models/lookup_key.rb:124:in `cast_validate_value' > > app/models/lookup_key.rb:179:in `validate_and_cast_default_value' > > app/controllers/puppetclasses_controller.rb:39:in `update' > > app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' > > > > it's basically an array of hash(es) but I have no clue where is the : > > > > Is there an issue converting the array/hash to yaml and that in fact is > > the problem? > > > > Any clues/hints/links are appreciated > > > >