summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSeth Vargo <sethvargo@gmail.com>2013-12-15 18:24:21 -0500
committerSeth Vargo <sethvargo@gmail.com>2013-12-17 12:17:04 -0500
commit0aaabe6b325fee332422bd03c94eab3eacefbc60 (patch)
tree0bdb656722c1b92bb89d38732372d7a3cc7d74a2 /bin
parent0d5e08883fa9608c328cf57c12a77b492ddf8500 (diff)
downloadchef-zero-0aaabe6b325fee332422bd03c94eab3eacefbc60.tar.gz
Remove puma and clean up threading
This commit removes all instances of the Puma webserver, since it has known issues on a number of supported platforms and adds significant branching logic to the code. This commit also re-defines what it means when the server is "running". In the past, "running" has meant the web server is up. Testing has revealed that web servers actually lie and say they are running, even if they are not accepting requests. The new `running?` method uses OpenURI to access a known URL on the server. WEBrick does not support running on a socket, so the `--socket` option has also been removed.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chef-zero17
1 files changed, 8 insertions, 9 deletions
diff --git a/bin/chef-zero b/bin/chef-zero
index aa2dd56..6d6884f 100755
--- a/bin/chef-zero
+++ b/bin/chef-zero
@@ -1,5 +1,8 @@
#!/usr/bin/env ruby
+# Trap interrupts to quit cleanly.
+Signal.trap('INT') { exit 1 }
+
require 'rubygems'
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
@@ -20,10 +23,6 @@ OptionParser.new do |opts|
options[:port] = value
end
- opts.on("--socket PATH", String, "Unix socket path to listen on") do |value|
- options[:socket] = value
- end
-
opts.on("--[no-]generate-keys", "Whether to generate actual keys or fake it (faster). Default: false.") do |value|
options[:generate_real_keys] = value
end
@@ -50,12 +49,12 @@ end.parse!
server = ChefZero::Server.new(options)
if options[:daemon]
- unless Process.respond_to?('daemon')
- abort 'Process.deamon requires Ruby >= 1.9'
- else
+ if Process.respond_to?(:daemon)
Process.daemon(true)
- server.start(:publish => true)
+ server.start(true)
+ else
+ abort 'Process.daemon requires Ruby >= 1.9'
end
else
- server.start(:publish => true)
+ server.start(true)
end