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

Chef Zero Fails to Start - lsof can't find pid #11

Closed
harlanbarnes opened this issue Jul 3, 2013 · 4 comments
Closed

Chef Zero Fails to Start - lsof can't find pid #11

harlanbarnes opened this issue Jul 3, 2013 · 4 comments

Comments

@harlanbarnes
Copy link

After I sorted out #10 , it still wouldn't start. It looks like it came down to this line:

pid = %x[ lsof -i tcp:#{port} | grep ruby | awk '{print $2}' ]

For whatever reason, my lsof was setting the "command" to be "chef-zero" instead of ruby. Thus, I was getting this:

[harlan@clay zabbix]$ lsof -i tcp:4000
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
chef-zero 19379 harlan    9u  IPv4 283915      0t0  TCP clay.local:4000 (LISTEN)

which the above line was never finding. So I just did this and it worked:

pid = %x[ lsof -i tcp:#{port} | grep 'chef-zero' | awk '{print $2}' ]

Maybe something like this handles both?

pid = %x[ lsof -i tcp:#{port} | grep -E 'ruby|chef-zero' | awk '{print $2}' ]

Both this and #10 are no big deal. I'm good to go for now. Just a heads up in case anyone else gets this.

@andrewgross
Copy link
Contributor

Interesting. It is pretty fragile way to find the PID, I'll see if I can think of anything better than your suggestion.

@andrewgross
Copy link
Contributor

Copping out for now as scanning through the process list can be maddening and error prone. I will push this change out soon.

@andrewgross
Copy link
Contributor

Fixed in 0.2.5

@abathur
Copy link

abathur commented Jul 21, 2013

Andrew--I was looking into what it would take to get this plugin working on Windows. I'm not really familiar with Ruby so I'll spare both of us an attempt at pushing changes. When I was looking into the lsof/PID issue I found an SO question linking this blog post: http://unethicalblogger.com/2011/11/12/popen-can-suck-it.html which may give you a better way to get at the PID using proc.pid.

As an aside to the issue here, downstream I ran into windows compatibility issues with file paths.

b-dean added a commit to b-dean/vagrant-chef-zero that referenced this issue Jul 22, 2013
…gphilis#11) by using chef-zero's start in background functionality.

Make sure provision runs on vagrant reload as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants