[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:18 UTC 2009


The following commit has been merged in the master branch:
commit 3281f2b73ff20d72dca2f6a5063eb1ce23eb4ab2
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Oct 7 18:29:47 2008 -0500

    Fixed #1633 - Added support for --detailed-exits to bin/puppet
    which causes puppet to produce different exit codes depending
    on whether there were changes or failures in the transaction.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/CHANGELOG b/CHANGELOG
index 854b027..3deef6f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,8 @@
 
     Fixed #1354 - yum provider problems with RHEL 3
 
+    Fixed #1633 - Added support for --detailed-exits to bin/puppet
+
     Fixed #381 - Allow Allow multiple overrides in one statement
 
     Fixing #947 - pluginsync no longer fails poorly when no plugins exist
diff --git a/bin/puppet b/bin/puppet
index 9429025..f3d8c25 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -8,7 +8,7 @@
 # = Usage
 #
 #   puppet [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
-#               [-l|--logdest <file>] <file>
+#               [--detailed-exitcodes] [-l|--logdest <file>] <file>
 #
 # = Description
 #
@@ -31,6 +31,11 @@
 # debug::
 #   Enable full debugging.
 #
+# detailed-exitcodes::
+#   Provide transaction information via exit codes.  If this is enabled, an exit
+#   code of '2' means there were changes, and an exit code of '4' means that there
+#   were failures during the transaction.
+#
 # help::
 #   Print this help message
 #
@@ -72,6 +77,7 @@ options = [
     [ "--loadclasses", "-L",		GetoptLong::NO_ARGUMENT ],
     [ "--verbose",  "-v",			GetoptLong::NO_ARGUMENT ],
     [ "--use-nodes",    			GetoptLong::NO_ARGUMENT ],
+    [ "--detailed-exitcodes",		GetoptLong::NO_ARGUMENT ],
     [ "--version",  "-V",           GetoptLong::NO_ARGUMENT ]
 ]
 
@@ -87,7 +93,8 @@ options = {
     :logfile => false,
     :loadclasses => false,
     :logset => false,
-    :code => nil
+    :code => nil,
+    :detailed_exits => false,
 }
 
 
@@ -118,6 +125,8 @@ begin
                 options[:code] = arg
             when "--loadclasses"
                 options[:loadclasses] = true
+            when "--detailed-exitcodes"
+                options[:detailed_exits] = true
             when "--logdest"
                 begin
                     Puppet::Util::Log.newdestination(arg)
@@ -208,6 +217,7 @@ end
 
 begin
     # Compile our catalog
+    starttime = Time.now
     catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
 
     # Translate it to a RAL catalog
@@ -217,8 +227,18 @@ begin
 
     catalog.finalize
 
+    catalog.retrieval_duration = Time.now - starttime
+
     # And apply it
-    catalog.apply
+    transaction = catalog.apply
+
+    status = 0
+    if not Puppet[:noop] and options[:detailed_exits] then
+        transaction.generate_report
+    	status |= 2 if transaction.report.metrics["changes"][:total] > 0
+        status |= 4 if transaction.report.metrics["resources"][:failed] > 0
+    end
+    exit(status)
 rescue => detail
     if Puppet[:trace]
         puts detail.backtrace

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list