Strange behavior in chef-server


#1

Hi,

I am running chef 0.8.4 on both server and client and I see the following behaviors:

  • updating attributes in a role, uploading to the server and launching chef-client does not trigger the templates to be regenerated, only a modification of the ‘source’ file seems to trigger it.

  • The server seems to send strange arguments:

override_attributes “haproxy” => {
:backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],
:listenip => ‘IP’
}

is passed as:
“haproxy”=>{“listenip”=>“173.203.240.198”, “check”=>“check.txt”, “backends”=>[{“name”=>“ws1”, “ip”=>“IP1”}, {“name”=>“ws1”, “ip”=>“IP1”}]}

and

“haproxy”=>{“listenip”=>“173.203.240.198”, “backends”=>{“0”=>{“name”=>“ws1”, “ip”=>“IP1”}, “1”=>{“name”=>“ws2”, “ip”=>“IP2”}}}}

in another section, I haven’t been able to isolate the parent, the dump is too big and I have format errors.

Thanks

–Gilles


#2

More info for the second issue, using knife I have a better output.

The duplicate ws1 entry is in the ‘attribute’ section, the correct list is in the ‘default’ section.

It seems the record in the ‘attribute’ section comes form the node itself. Now my new settings are in the override section (appears like this in the web-ui too) but the knife output puts them in ‘default’.

If the client received them in the ‘default’ section then this could explain my first problem, the templates not being regenerated.

I have been able to change the value in the ‘attribute’ section or delete them from the web-ui. I have also changed the template a bit to force a new compilation and it seems that the attributes get duplicated:

passing

:backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],

produces

real servers

    server ws1 IP1 check slowstart 1000
    server ws2 IP2 check slowstart 1000
    server ws1 IP1 check slowstart 1000
    server ws2 IP2 check slowstart 1000

this is my template:

real servers

<% @node[:haproxy][:backends].each do |backend| -%>
server <%= backend[:name] %> <%= backend[:ip] %> check slowstart 1000
<%end-%>

I’ll continue to investigate, in the meantime if someone think about something :slight_smile:

Thanks

–Gilles

On Mar 3, 2010, at 7:31 PM, Gilles Devaux wrote:

Hi,

I am running chef 0.8.4 on both server and client and I see the following behaviors:

  • updating attributes in a role, uploading to the server and launching chef-client does not trigger the templates to be regenerated, only a modification of the ‘source’ file seems to trigger it.

  • The server seems to send strange arguments:

override_attributes “haproxy” => {
:backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],
:listenip => ‘IP’
}

is passed as:
“haproxy”=>{“listenip”=>“173.203.240.198”, “check”=>“check.txt”, “backends”=>[{“name”=>“ws1”, “ip”=>“IP1”}, {“name”=>“ws1”, “ip”=>“IP1”}]}

and

“haproxy”=>{“listenip”=>“173.203.240.198”, “backends”=>{“0”=>{“name”=>“ws1”, “ip”=>“IP1”}, “1”=>{“name”=>“ws2”, “ip”=>“IP2”}}}}

in another section, I haven’t been able to isolate the parent, the dump is too big and I have format errors.

Thanks

–Gilles


#3

I have solved the first issue, my bad between ‘default’ and ‘override’

I have also solved the second issue but I believe there is a bug in the client when dealing with arrays

if the role file defines:
backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],

after upload and update on the client
then knife node show NODE > dump.json

returns
"haproxy": {
“listenip”: “173.203.240.198”,
“backends”: [
{
“name”: “ws1”,
“ip”: “173.203.240.235”
},
{
“name”: “ws2”,
“ip”: “173.203.240.235”
},
{
“name”: “ws1”,
“ip”: “173.203.240.235”
},
{
“name”: “ws2”,
“ip”: “173.203.240.235”
}
]
for the ‘attribute’ section

-> the list is duplicated

When I define the role file as follow:
:backends =>
{
:ws1 => “173.203.240.235”,
:ws2 => “173.203.240.235”
},

and change the template accordingly

Then everything works as expected

Thanks

–Gilles

On Mar 3, 2010, at 9:07 PM, Gilles Devaux wrote:

More info for the second issue, using knife I have a better output.

The duplicate ws1 entry is in the ‘attribute’ section, the correct list is in the ‘default’ section.

It seems the record in the ‘attribute’ section comes form the node itself. Now my new settings are in the override section (appears like this in the web-ui too) but the knife output puts them in ‘default’.

If the client received them in the ‘default’ section then this could explain my first problem, the templates not being regenerated.

I have been able to change the value in the ‘attribute’ section or delete them from the web-ui. I have also changed the template a bit to force a new compilation and it seems that the attributes get duplicated:

passing

:backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],

produces

real servers

   server ws1 IP1 check slowstart 1000
   server ws2 IP2 check slowstart 1000
   server ws1 IP1 check slowstart 1000
   server ws2 IP2 check slowstart 1000

this is my template:

real servers

<% @node[:haproxy][:backends].each do |backend| -%>
server <%= backend[:name] %> <%= backend[:ip] %> check slowstart 1000
<%end-%>

I’ll continue to investigate, in the meantime if someone think about something :slight_smile:

Thanks

–Gilles

On Mar 3, 2010, at 7:31 PM, Gilles Devaux wrote:

Hi,

I am running chef 0.8.4 on both server and client and I see the following behaviors:

  • updating attributes in a role, uploading to the server and launching chef-client does not trigger the templates to be regenerated, only a modification of the ‘source’ file seems to trigger it.

  • The server seems to send strange arguments:

override_attributes “haproxy” => {
:backends => [
{ :name => “ws1”, :ip => “IP” },
{ :name => “ws2”, :ip => “IP2” }
],
:listenip => ‘IP’
}

is passed as:
“haproxy”=>{“listenip”=>“173.203.240.198”, “check”=>“check.txt”, “backends”=>[{“name”=>“ws1”, “ip”=>“IP1”}, {“name”=>“ws1”, “ip”=>“IP1”}]}

and

“haproxy”=>{“listenip”=>“173.203.240.198”, “backends”=>{“0”=>{“name”=>“ws1”, “ip”=>“IP1”}, “1”=>{“name”=>“ws2”, “ip”=>“IP2”}}}}

in another section, I haven’t been able to isolate the parent, the dump is too big and I have format errors.

Thanks

–Gilles