[katello-devel] PATCH: katello-configure: Exit with nonzero status if error was seen in puppet execution.

Jan Pazdziora jpazdziora at redhat.com
Wed Nov 2 14:47:33 UTC 2011


Hello,

please consider for review patch which adds nonzero exit status if
error was seen in katello-configure during puppet execution.

>From 528d1c8c9c38f9889abb9d5a2c75eb85e4537c4d Mon Sep 17 00:00:00 2001
From: Jan Pazdziora <jpazdziora at redhat.com>
Date: Wed, 2 Nov 2011 15:35:26 +0100
Subject: [PATCH 1/2] Exit with nonzero status if error was seen in puppet
 execution.

---
 puppet/bin/katello-configure |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/puppet/bin/katello-configure b/puppet/bin/katello-configure
index eea8ab3..4c911cf 100644
--- a/puppet/bin/katello-configure
+++ b/puppet/bin/katello-configure
@@ -229,6 +229,7 @@ commands_by_logfiles = {
 puppet_logfile_filename = log_directory + '/main.log'
 puppet_logfile = IO.open(IO::sysopen(puppet_logfile_filename, Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT))
 puts "The top-level log file is [#{puppet_logfile_filename}]"
+seen_err = false
 begin
 	IO.popen(puppet_cmd, 'w+') do |f|
 		f.puts "include katello"
@@ -249,6 +250,7 @@ begin
 					t.kill
 					puts "\n  Failed, please check [#{processing_logfile}]"
 					processing_logfile = nil
+					seen_err = true
 				end
 			end
 			if line =~ /\]: Executing \'(.+)/
@@ -272,5 +274,12 @@ begin
 	end
 rescue => e
 	$stderr.puts 'Error: ' + e.message
+	seen_err = true
 end
 puppet_logfile.close
+
+if seen_err
+	exit 6
+end
+
+exit
-- 
1.7.4.4

Thank you,

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat




More information about the katello-devel mailing list