diff --git a/libraries/consul_execute.rb b/libraries/consul_execute.rb index 4a24c569..75a4f232 100644 --- a/libraries/consul_execute.rb +++ b/libraries/consul_execute.rb @@ -16,7 +16,7 @@ class ConsulExecute < Chef::Resource default_action(:run) attribute(:command, kind_of: String, name_attribute: true) - attribute(:environment, kind_of: String, default: { 'PATH' => '/usr/local/bin:/usr/bin:/bin' }) + attribute(:environment, kind_of: Hash, default: { 'PATH' => '/usr/local/bin:/usr/bin:/bin' }) attribute(:options, option_collector: true, default: {}) action(:run) do diff --git a/libraries/consul_service.rb b/libraries/consul_service.rb index 0da2b834..5a9db0b4 100644 --- a/libraries/consul_service.rb +++ b/libraries/consul_service.rb @@ -38,7 +38,7 @@ class ConsulService < Chef::Resource attribute(:data_dir, kind_of: String, default: lazy { node['consul']['config']['data_dir'] }) # @!attribute config_dir # @return [String] - attribute(:config_dir, kind_of: String, default: lazy { node['consul']['config']['config_dir'] }) + attribute(:config_dir, kind_of: String, default: lazy { node['consul']['service']['config_dir'] }) # @!attribute nssm_params # @return [String] attribute(:nssm_params, kind_of: Hash, default: lazy { node['consul']['service']['nssm_params'] }) diff --git a/templates/default/sysvinit.service.erb b/templates/default/sysvinit.service.erb index f17bdcc1..552b821e 100755 --- a/templates/default/sysvinit.service.erb +++ b/templates/default/sysvinit.service.erb @@ -64,7 +64,7 @@ _start() { daemon \ --pidfile=$pidfile \ --user=$user \ - " { $exec <%= @daemon_options %> &>> $logfile & } ; echo \$! >| $pidfile " + " { $exec <%= @daemon_options %> >> $logfile 2>&1 & } ; echo \$! >| $pidfile " RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile diff --git a/test/integration/helpers/serverspec/spec_helper.rb b/test/integration/helpers/serverspec/spec_helper.rb index c1fddf06..c606a37c 100644 --- a/test/integration/helpers/serverspec/spec_helper.rb +++ b/test/integration/helpers/serverspec/spec_helper.rb @@ -6,3 +6,12 @@ set :backend, :cmd set :os, family: 'windows' end + +# Tells serverspec to use a login shell for running chkconfig/service, +# which prevents false error reports on Centos 5. +begin + if File.read("/etc/redhat-release") =~ /release 5\./ + Specinfra.configuration.login_shell = true + end +rescue SystemCallError +end