summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
committerLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
commit40375a8fc34dbd85d87f507ba72c7394b25b7271 (patch)
treeefd5a93980b042b73322bd31e6fdb41203d07576 /ext
parent93eeff59d807261ed154cc104e318ae604602430 (diff)
parent8f5800f0608dff46407cb5f23ee73f314fe051e8 (diff)
downloadpuppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.gz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.xz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.zip
Merge branch '0.24.x' into merging
Conflicts: test/ral/type/filesources.rb
Diffstat (limited to 'ext')
-rwxr-xr-xext/bin/sleeper67
-rwxr-xr-xext/module_puppet2
2 files changed, 68 insertions, 1 deletions
diff --git a/ext/bin/sleeper b/ext/bin/sleeper
new file mode 100755
index 000000000..980d66ac1
--- /dev/null
+++ b/ext/bin/sleeper
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby -w
+
+###
+# sleep indefinitely as a debug
+
+require 'getoptlong'
+
+#-----------------------------------------------------------------
+def daemonize
+ outfile = "/tmp/sleeperout"
+ if pid = fork()
+ Process.detach(pid)
+ sleep 1
+ # verify that we didn't have any problems starting the daemon
+ if FileTest.exists?(outfile)
+ $stderr.puts "Sleeper failed: %s" % File.read(outfile)
+ File.unlink(outfile)
+ exit(14)
+ else
+ exit(0)
+ end
+ end
+ Process.setsid
+ Dir.chdir("/")
+ begin
+ $stdin.reopen "/dev/null"
+ $stdout.reopen "/dev/null", "a"
+ $stderr.reopen $stdin
+ rescue => detail
+ File.open(outfile, "w") { |f|
+ f.puts detail
+ }
+ exit(12)
+ end
+end
+#-----------------------------------------------------------------
+
+debug = false
+
+result = GetoptLong.new(
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
+)
+
+result.each { |opt,arg|
+ case opt
+ when "--help"
+ puts "There is no help yet"
+ exit
+ when "--debug"
+ debug = true
+ else
+ raise "Invalid option '#{opt}'"
+ end
+}
+
+trap(:INT) {
+ exit
+}
+
+unless debug
+ daemonize()
+end
+
+# Sleep for no more than two minutes
+sleep 120
+exit
diff --git a/ext/module_puppet b/ext/module_puppet
index 978d660cc..8609e4411 100755
--- a/ext/module_puppet
+++ b/ext/module_puppet
@@ -180,7 +180,7 @@ node.classes = classes
begin
# Compile our configuration
- catalog = Puppet::Node::Catalog.find(node.name, :node => node)
+ catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
rescue => detail
if Puppet[:trace]
puts detail.backtrace