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

serverspec process not working corretly #1206

Closed
kplimack opened this issue Mar 14, 2017 · 5 comments
Closed

serverspec process not working corretly #1206

kplimack opened this issue Mar 14, 2017 · 5 comments

Comments

@kplimack
Copy link

kplimack commented Mar 14, 2017

Description

this is really an issue for serverspec, but they dont accept issues.
https://github.com/mizzy/specinfra/blob/c8a97ef154684452ba059beee4cddbc8e62258c2/lib/specinfra/command/base/process.rb#L4

the process matcher will grab the first thing that partially matches the process that you are looking for.
so if you have

haproxy  15473 15466  0 11:49 ?        00:00:00 /usr/sbin/haproxy-master
haproxy  15481 15461  0 11:49 ?        00:00:00 /usr/sbin/haproxy -Ds -f /etc/haproxy/conf.d/jira.cfg -p /var/run/haproxy-jira.pid
haproxy  15484 15473  0 11:49 ?        00:00:00 /usr/sbin/haproxy -Ds -f /etc/haproxy/conf.d/confluence.cfg -p /var/run/haproxy-confluence.pid

and you try to write an audit with

describe process('haproxy') do
  its(:user) { should eq 'haproxy' }
  its(:args) { should contain '-Ds -f /etc/haproxy/conf.d/jira.cfg -p /var/run/haproxy-jira.pid' }
end

you will not be able to match the args, because the process is actually matching haproxy-master, the first one to grep for haproxy.

Kitchen Version

Chef Development Kit Version: 1.2.22
chef-client version: 12.18.31
delivery version: master (0b746cafed65a9ea1a79de3cc546e7922de9187c)
berks version: 5.6.3
kitchen version: 1.15.0
specinfra (2.67.2, 2.66.7)
serverspec (2.38.0)

@coderanger
Copy link
Contributor

As you said, this is an issue with serverspec/specinfra and we can't really do anything about it.

@kplimack
Copy link
Author

@coderanger got any advise on ways to move forwards? I can't be the only one hitting this bug.

@coderanger
Copy link
Contributor

Use a command resource and pgrep instead? Or command('ps something | grep something'). It's all just commands in the end.

@MarkGibbons
Copy link
Contributor

I use a command resource.

@kplimack
Copy link
Author

thanks for the advise, thats what I was thinking, too.
pretty lame bug, though

@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants