Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop_apache attribute is not being respected #554

Open
jasmeralia opened this issue Sep 19, 2017 · 1 comment
Open

stop_apache attribute is not being respected #554

jasmeralia opened this issue Sep 19, 2017 · 1 comment
Labels
Feature Request Enhancement to existing functionality or new functionality hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event

Comments

@jasmeralia
Copy link
Contributor

jasmeralia commented Sep 19, 2017

Cookbook version

8.0.0

Chef-client version

13.3.42

Platform Details

bento/ubuntu-14.04

Scenario:

I'm using the nagios cookbook to write out the various configuration files for my environment, but I have a few tweaks as I'm actually then loading those configs into Shinken running inside a Docker container. After updating the newest cookbook version while testing Chef 13 fixes, I'm hitting an issue where it tries to stop the apache service because I am using nginx, even though I have node['nagios']['server']['stop_apache'] set to false. Looking at the code there does not seem to be any guards around this:

service node['apache']['service_name'] do
  action [:disable, :stop]
  notifies :start, 'service[nginx]', :delayed
  notifies :restart, 'service[nagios]', :delayed
end

This is problematic, as Apache processes are seen on the host, but running inside the container, so trying to stop Apache throws this error:
There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand.

Expected Result:

The cookbook does not try to stop the Apache service.

Actual Result:

================================================================================
Error executing action `stop` on resource 'service[apache2]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/apache2 stop ----
STDOUT: * Stopping web server apache2
* 
* There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand.
STDERR: 
---- End output of /etc/init.d/apache2 stop ----
Ran /etc/init.d/apache2 stop returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/nagios/recipes/nginx.rb
 
117: service node['apache']['service_name'] do
118:   action [:disable, :stop]
119:   notifies :start, 'service[nginx]', :delayed
120:   notifies :restart, 'service[nagios]', :delayed
121: end
122: 
 
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/nagios/recipes/nginx.rb:117:in `from_file'
 
service("apache2") do
  action [:disable, :stop]
  default_guard_interpreter :default
  service_name "apache2"
  enabled false
  running true
  masked nil
  pattern "apache2"
  declared_type :service
  cookbook_name "nagios"
  recipe_name "nginx"
end
 
System Info:
------------
chef_version=13.3.42
platform=ubuntu
platform_version=14.04
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-client worker: ppid=18625;start=20:56:11;
executable=/opt/chef/bin/chef-client
@github-actions
Copy link

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

@github-actions github-actions bot added the Stale label Sep 30, 2020
@xorimabot xorimabot removed the Stale label Sep 30, 2020
@ramereth ramereth added Feature Request Enhancement to existing functionality or new functionality hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event labels Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Enhancement to existing functionality or new functionality hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event
Projects
None yet
Development

No branches or pull requests

3 participants