sensu / uchiwa-chef

Other
33 stars 40 forks source link

sensu config block of uchiwa.json not generating properly with chef 13 #63

Open JHBoricua opened 6 years ago

JHBoricua commented 6 years ago

Cookbook version

1.4.0

Chef-client version

version 13.7.16

Platform Details

Ubuntu 16.04.3

Scenario:

The /etc/sensu/uchiwa.json file being generated by chef-client when executing this recipe has an empty 'sensu' section. It seemst that the ['uchiwa']['api'] settings are not getting parsed by the default recipe.

Steps to Reproduce:

The cookbook is being run with default settings with the exception of these three changed attributes:

default['uchiwa']['version'] = '1.1.3-2' default['uchiwa']['settings']['user'] = 'myuserchoice' default['uchiwa']['settings']['pass'] = 'mypasswordchoice'

The "API Setting's" section in the attributes file has been left untouched.

Expected Result:

The dashboard should be populated.

Actual Result:

The dashboard is empty. If I manually enter the values for the sensu section in the uchiwa.json file and restart the service the dashboard populates, but the next chef run blows away the sensu settings from the json file.

This is what the uchiwa.json file looks like after chef runs:

linuxadmin@sensu01:~$ sudo cat /etc/sensu/uchiwa.json
{
  "uchiwa": {
    "user": "myadmin",
    "pass": "mypass",
    "refresh": 5,
    "host": "0.0.0.0",
    "port": 3000
  },
  "sensu": [

  ]
}
majormoses commented 6 years ago

Does this work with chef 12? I am running it with chef 12 and it works as expected:

sudo cat /etc/sensu/uchiwa.json
{
  "uchiwa": {
    "user": "admin",
    "pass": "<REDACTED>",
    "refresh": 5,
    "host": "0.0.0.0",
    "port": 3000
  },
  "sensu": [
    {
      "name": "Sensu",
      "host": "127.0.0.1",
      "url": "http://127.0.0.1:4567",
      "path": "",
      "ssl": false,
      "timeout": 5
    }
  ]
}

The only attributes I touch are:

node['uchiwa']['settings']['pass'] = SecureRandom.urlsafe_base64(16)
node['uchiwa']['version'] = '0.26.3-1'
node['uchiwa']['install_method'] = 'http'
JHBoricua commented 6 years ago

I downgraded this particular server to Chef Client 12.21.31 and the uchiwa.json file got properly created. So it seems to be an issue if you're running chef client version 13.

thomasriley commented 6 years ago

Pretty sure I used the Uchiwa cookbook with a Chef 13.x version a couple of months back with success. I will double check that fact and report back.

majormoses commented 6 years ago

it might be a hidden breaking change somewhere in chef 13 then. I had similar (as in fun breaking changes that were not doccumented) problems in chef 12.