Could not set smart-variable

Hello

I have this in my manifest file:

$udp_send_channel = [
{ mcast_join => '239.2.11.71', port => 8649, ttl => 1 }
],
$udp_recv_channel = [
{ mcast_join => '239.2.11.71', port => 8649, bind => '239.2.11.71' }
],
$tcp_accept_channel = [ { port => 8649 } ],

When I override it value like this:
[{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}]

The foreman will report error message: (<unknown>): did not find
expected ',' or '}' while parsing a flow mapping at line 1 column 2

But when I set value is [ { port => 8649 } ]
Then the foreman will change the value to: [{"port=>8649"=>nil}]

How to override this kind of array value?

Best Regards
Xiaofei

Hello
I override the value of "udp_recv_channel" to this:

  • {port: 8649, mcast_join: "239.2.11.71", bind: "239.2.11.71"}

The data type can be array or yaml.
Then submit successfully. But I look into the value changed to :

[{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}]

If I submit again it will show the array message : (<unknown>): did not
find expected ',' or '}' while parsing a flow mapping at line 1 column 2
If I want to change the value I must change it to yaml first.
Is this a bug or not.
Xiaofei

··· On Tuesday, March 11, 2014 4:52:31 PM UTC+8, Yan Xiaofei wrote: > > Hello > > I have this in my manifest file: > > $udp_send_channel = [ > { mcast_join => '239.2.11.71', port => 8649, ttl => 1 } > ], > $udp_recv_channel = [ > { mcast_join => '239.2.11.71', port => 8649, bind => '239.2.11.71' } > ], > $tcp_accept_channel = [ { port => 8649 } ], > > When I override it value like this: > [{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}] > > The foreman will report error message: (): did not find > expected ',' or '}' while parsing a flow mapping at line 1 column 2 > > But when I set value is [ { port => 8649 } ] > Then the foreman will change the value to: [{"port=>8649"=>nil}] > > How to override this kind of array value? > > Best Regards > Xiaofei > >

Hello
When I override the smart variables's value to this:
type: yaml
value: - {port=>8649, mcast_join=>239.2.11.71, bind=>239.2.11.71}

Then I can submit it, but after submit the value type change to array. And
the value change back to : [{"port"=>8649, "bind"=>"239.2.11.71",
"mcast_join"=>"239.2.11.71"}]
Why it change back the value?
My foreman version is 1.3.0-1.

Xiaofei

··· On Tuesday, March 11, 2014 3:21:27 PM UTC+4, Yan Xiaofei wrote: > > Hello > I override the value of "udp_recv_channel" to this: > > - {port: 8649, mcast_join: "239.2.11.71", bind: "239.2.11.71"} > > The data type can be array or yaml. > Then submit successfully. But I look into the value changed to : > > [{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}] > > If I submit again it will show the array message : (): did not > find expected ',' or '}' while parsing a flow mapping at line 1 column 2 > If I want to change the value I must change it to yaml first. > Is this a bug or not. > Xiaofei > On Tuesday, March 11, 2014 4:52:31 PM UTC+8, Yan Xiaofei wrote: >> >> Hello >> >> I have this in my manifest file: >> >> $udp_send_channel = [ >> { mcast_join => '239.2.11.71', port => 8649, ttl => 1 } >> ], >> $udp_recv_channel = [ >> { mcast_join => '239.2.11.71', port => 8649, bind => '239.2.11.71' } >> ], >> $tcp_accept_channel = [ { port => 8649 } ], >> >> When I override it value like this: >> [{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}] >> >> The foreman will report error message: (): did not find >> expected ',' or '}' while parsing a flow mapping at line 1 column 2 >> >> But when I set value is [ { port => 8649 } ] >> Then the foreman will change the value to: [{"port=>8649"=>nil}] >> >> How to override this kind of array value? >> >> Best Regards >> Xiaofei >> >>

You might be seeing a combination of two bugs.

Bug #2726: Smart Class Parameter - over-ride match value unable to set yaml - Foreman which was fixed in Foreman
1.4.1 and prevented the smart variable being saved due to bad validation.

Bug #4639: Syntax of arrays in parameters changed when edit is changed. - Foreman which isn't fixed, where the
syntax is being shown with "=>" which aren't valid JSON or YAML (it's
Ruby syntax). Sounds like your original reported issue.

··· -- Dominic Cleal Red Hat Engineering

On 14/03/14 06:37, Yan Xiaofei wrote:

Hello
When I override the smart variables’s value to this:
type: yaml
value: - {port=>8649, mcast_join=>239.2.11.71, bind=>239.2.11.71}

Then I can submit it, but after submit the value type change to array.
And the value change back to : [{“port”=>8649, “bind”=>“239.2.11.71”,
“mcast_join”=>“239.2.11.71”}]
Why it change back the value?
My foreman version is 1.3.0-1.

Xiaofei

On Tuesday, March 11, 2014 3:21:27 PM UTC+4, Yan Xiaofei wrote:

Hello 
I override the value of "udp_recv_channel" to this:

- {port: 8649, mcast_join: "239.2.11.71", bind: "239.2.11.71"}

The data type can be array or yaml.
Then submit successfully. But I look into the value changed to :

 [{"port"=>8649, "bind"=>"239.2.11.71", "mcast_join"=>"239.2.11.71"}]

If I submit again it will show the array message : (<unknown>): did
not find expected ',' or '}' while parsing a flow mapping at line 1
column 2 
If I want to change the value I must change it to yaml first.
Is this a bug or not.
Xiaofei 
On Tuesday, March 11, 2014 4:52:31 PM UTC+8, Yan Xiaofei wrote:

    Hello

    I have this in my manifest file:

      $udp_send_channel   = [
        { mcast_join => '239.2.11.71', port => 8649, ttl => 1 }
      ],
      $udp_recv_channel   = [
        { mcast_join => '239.2.11.71', port => 8649, bind =>
    '239.2.11.71' }
      ],
      $tcp_accept_channel = [ { port => 8649 } ],

    When I override it value like this:
         [{"port"=>8649, "bind"=>"239.2.11.71",
    "mcast_join"=>"239.2.11.71"}]

    The foreman will report error message:  (<unknown>): did not
    find expected ',' or '}' while parsing a flow mapping at line 1
    column 2

    But when I set value   is   [ { port => 8649 } ]
    Then the foreman will change the value to: [{"port=>8649"=>nil}]

    How to override this kind of array value?

    Best Regards
    Xiaofei


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Hello Dominic,

I use json format resolve this problem.
Here is what i set :

[{"port":"8649","mcast_join":"239.2.11.71","bind":"239.2.11.71"}]

于 2014/3/14 16:46, Dominic Cleal wrote:

··· > You might be seeing a combination of two bugs. > > http://projects.theforeman.org/issues/2726 which was fixed in Foreman > 1.4.1 and prevented the smart variable being saved due to bad validation. > > http://projects.theforeman.org/issues/4639 which isn't fixed, where the > syntax is being shown with "=>" which aren't valid JSON or YAML (it's > Ruby syntax). Sounds like your original reported issue. >