sensu / sensu-go-chef

Chef Library Cookbook for Sensu Go
https://sensu.io
MIT License
11 stars 22 forks source link

sensu_ctl resource cannot run multiple times with configure action set #85

Closed adsk-mcnultt closed 3 years ago

adsk-mcnultt commented 4 years ago

Chef Version

Latest version of the sensu-go-chef cookbook.

Input

Resource declaration in my cookbook

sensu_ctl 'default' do
  username 'admin'
  password 'P@ssw0rd!'
  action [:install, :configure]
end

Output

* sensu_ctl[default] action configure
           - Reconfiguring sensuctl
           * execute[configure sensuctl] action run

             ================================================================================
             Error executing action `run` on resource 'execute[configure sensuctl]'
             ================================================================================

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Command execution failed. STDOUT/STDERR suppressed for sensitive resource
================================================================================
           Error executing action `configure` on resource 'sensu_ctl[default]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           execute[configure sensuctl] (/tmp/kitchen/cache/cookbooks/sensu-go/resources/ctl.rb line 108) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/docker_host/recipes/configure_sensu.rb

            26: sensu_ctl 'default' do
            27:   username 'admin'
            28:   password 'P@ssw0rd!'
            29:   action [:install, :configure]
            30: end
            31:

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/docker_host/recipes/configure_sensu.rb:26:in `from_file'

           sensu_ctl("default") do
             action [:install, :configure]
             default_guard_interpreter :default
             declared_type :sensu_ctl
             cookbook_name "docker_host"
             recipe_name "configure_sensu"
             username "admin"
             password "*sensitive value suppressed*"
           end

Impact

Subsequent chef runs fail after successfully converging and configuring sensuctl the first time.

Expected Behavior

Chef runs should continue to succeed after sensu_ctl configure action has been called.

Actual Behavior

Sensuctl attempts to reconfigure itself after being initially configured and fails. Removing the "configure" action from the resource results in successful converge.

Steps to Reproduce your problem

Run chef again after configuring sensuctl the first time.

adsk-mcnultt commented 4 years ago

This may be similar/related to #63.

webframp commented 3 years ago

I'm unable to reproduce this with latest versions of sensu.

After running kitchen converge default-ubuntu-1804 twice on master I have these files created:

root@dokken:~# ll .config/sensu/sensuctl/
total 16
drwxr-xr-x 2 root root 4096 Oct 25 23:30 ./
drwxr-xr-x 3 root root 4096 Oct 25 23:30 ../
-rw-r--r-- 1 root root  863 Oct 25 23:30 cluster
-rw-r--r-- 1 root root   51 Oct 25 23:30 profile

Closing now as part of issue cleanup, but please re-open with any additional information as needed and I can investigate!