Closed sean-kang closed 8 years ago
does the package defaults write this out or does it rely on something internal in sensu to have /tmp as default? if not thee default is already going to /tmp and I think that the template should only include it if the chef attribute is specified.
@majormoses is correct - it's best if the template only sets the option if the attribute is set. We may be changing the default tempfile directory in one of the upcoming releases. It's a possibility that the location may differ depending on the host platform.
Aside from adjusting that, 👍 on this change.
LGTM
My only question here is whether the export
is necessary. I think we can accept this change and then remove the export later if needed.
Closes #486
This adds "export SENSU_LOADED_TEMPFILE_DIR=some_dir" to /etc/default/sensu.
Description
In some linux distros and hardened systems, /tmp directory is regularly cleaned. When Sensu loses files such as "sensu_server_loaded_files" in /tmp directory, its handlers will fail with the following error.
{"timestamp":"2016-08-21T11:38:46.043506+0000","level":"info","message":"handler output","handler":{"type":"pipe","command":"handler-hipchat.rb","name":"hipchat"},"output":["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/utils.rb:7:in
read': No such file or directory @ rb_sysopen - /tmp/sensu_server_loaded_files (Errno::ENOENT)\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/utils.rb:7:in
config_files'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/utils.rb:20:insettings'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-handler.rb:104:in
filter_repeated'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-handler.rb:30:infilter'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-handler.rb:54:in
block in class:Handler'\n"]}To resolve the problem, an environment variable SENSU_LOADED_TEMPFILE_DIR was introduced to Sensu by the following commit.
https://github.com/sensu/sensu-settings/commit/c21d471a40ce9c1991f8a38d19bfe28efd387703
This pull request is to add a new attribute that sets up the environment variable in Sensu config file.
Motivation and Context
https://github.com/sensu/sensu-chef/issues/486
How Has This Been Tested?
I have tested the following suites in test-kitchen.
Screenshots (if appropriate):
Types of changes
Checklist: