summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Thouvenin <gthouvenin@mirantis.com>2016-03-23 15:17:53 +0100
committerGuillaume Thouvenin <gthouvenin@mirantis.com>2016-03-24 11:23:18 +0100
commitf2999dc55970ddccaa07ffc4e3c318ff5f172fef (patch)
tree7abbeaab9fb557e98988d766b41d9ee6410b7bf8
parenta18563ffe633de82012076225aed2630faa5ebdd (diff)
Avoid forks when starting hekad0.8.1rc1
We must avoid to fork process when starting the Heka daemon because if we kill the wrapper, the Heka daemon is detached and re-attach to the init process. This can create several Heka daemon. To avoid this we need to use exec and avoid the usage of sudo. Fixes-bug: #1561109 (cherry picked from commit f0ba5e5077cdb63e7a4d2ccdd395465ee29fe34a) Conflicts: deployment_scripts/puppet/modules/heka/spec/classes/heka_spec.rb Change-Id: Idbfab2de92b993d1e5124de5bff44c4b09a88bb4
Notes
Notes (review): Verified+1: Plugins CI <plugins.ci@mirantis.com> Code-Review+2: Swann Croiset <scroiset@mirantis.com> Workflow+1: Guillaume Thouvenin <gthouvenin@mirantis.com> Workflow+1: Swann Croiset <scroiset@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 24 Mar 2016 10:40:26 +0000 Reviewed-on: https://review.openstack.org/296990 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/stable/0.8
-rw-r--r--deployment_scripts/puppet/modules/heka/spec/classes/heka_spec.rb36
-rw-r--r--deployment_scripts/puppet/modules/heka/templates/hekad.upstart.conf.erb2
-rw-r--r--deployment_scripts/puppet/modules/heka/templates/hekad_wrapper.erb2
3 files changed, 38 insertions, 2 deletions
diff --git a/deployment_scripts/puppet/modules/heka/spec/classes/heka_spec.rb b/deployment_scripts/puppet/modules/heka/spec/classes/heka_spec.rb
new file mode 100644
index 0000000..a1984e8
--- /dev/null
+++ b/deployment_scripts/puppet/modules/heka/spec/classes/heka_spec.rb
@@ -0,0 +1,36 @@
1# Copyright 2015 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14require 'spec_helper'
15
16describe 'heka' do
17 let(:facts) do
18 {:kernel => 'Linux', :operatingsystem => 'Ubuntu',
19 :osfamily => 'Debian'}
20 end
21
22 describe 'with defaults' do
23 it { is_expected.to contain_user('heka') }
24 it { is_expected.to contain_file('/etc/init/hekad.conf') \
25 .with_content(/--user heka/) }
26 end
27
28 describe 'with user => "root"' do
29 let(:params) do
30 {:run_as_root => true}
31 end
32 it { is_expected.to contain_file('/etc/init/hekad.conf') }
33 it { is_expected.not_to contain_file('/etc/init/hekad.conf') \
34 .with_content(/--user/) }
35 end
36end
diff --git a/deployment_scripts/puppet/modules/heka/templates/hekad.upstart.conf.erb b/deployment_scripts/puppet/modules/heka/templates/hekad.upstart.conf.erb
index 601e455..6b69307 100644
--- a/deployment_scripts/puppet/modules/heka/templates/hekad.upstart.conf.erb
+++ b/deployment_scripts/puppet/modules/heka/templates/hekad.upstart.conf.erb
@@ -17,5 +17,5 @@ end script
17script 17script
18 # https://bugs.launchpad.net/lma-toolchain/+bug/1543289 18 # https://bugs.launchpad.net/lma-toolchain/+bug/1543289
19 ulimit -n 102400 19 ulimit -n 102400
20 exec <%= @run_as_root ? "" : "sudo -u #{ @heka_user }" %> <%= @hekad_wrapper %> 2>><%= @log_file %> 20 exec start-stop-daemon --start <%= @run_as_root ? "" : " --user #{ @heka_user }" %> --exec <%= @hekad_wrapper %> 2>><%= @log_file %>
21end script 21end script
diff --git a/deployment_scripts/puppet/modules/heka/templates/hekad_wrapper.erb b/deployment_scripts/puppet/modules/heka/templates/hekad_wrapper.erb
index e233e75..9a93d09 100644
--- a/deployment_scripts/puppet/modules/heka/templates/hekad_wrapper.erb
+++ b/deployment_scripts/puppet/modules/heka/templates/hekad_wrapper.erb
@@ -6,4 +6,4 @@ HEKAD="/usr/bin/hekad"
6<%= @pre_script %> 6<%= @pre_script %>
7<% end -%> 7<% end -%>
8 8
9$HEKAD -config=<%= @config_dir %> 9exec $HEKAD -config=<%= @config_dir %>