[PATCH aeolus-configure] Bug 860780 - output from aeolus-restart-services is misleading, reports both success and failure

Steve Linabery slinaber at redhat.com
Fri Sep 28 17:30:13 UTC 2012


addresses https://bugzilla.redhat.com/show_bug.cgi?id=860780

These three scripts were sometime producing confusing output. We were invoking
`service foo stop` for example which often outputs the string '[FAILED]' even
though the process exits with status 0. So our script would output something
thoroughly confusing like 'Success: [FAILED]'.

Better to discard the output of `service foo {action}` in the case when the
subprocess exits 0. We will still output what we get from STDOUT when the
subprocess exits non-zero.
---
 bin/aeolus-check-services   |    2 +-
 bin/aeolus-restart-services |    2 +-
 bin/aeolus-services         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/aeolus-check-services b/bin/aeolus-check-services
index eb35550..9409ce9 100755
--- a/bin/aeolus-check-services
+++ b/bin/aeolus-check-services
@@ -35,7 +35,7 @@ init_scripts.each do |script|
         cmd = "service #{script} status"
 	out = `#{cmd}`
 	if $?.to_i == 0
-		puts " \e[1;32mSuccess:\e[0m #{out.strip}"
+		puts " \e[1;32mSuccess:\e[0m"
 	else
                 exit_status = 1
 		puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
diff --git a/bin/aeolus-restart-services b/bin/aeolus-restart-services
index bd0f5b0..940507e 100755
--- a/bin/aeolus-restart-services
+++ b/bin/aeolus-restart-services
@@ -36,7 +36,7 @@ def perform(action, svcs)
     puts "\n# #{cmd} ..."
     out = `#{cmd}`
     if $?.to_i == 0
-      puts " \e[1;32mSuccess:\e[0m #{out.strip}"
+      puts " \e[1;32mSuccess:\e[0m"
     else
       puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
     end
diff --git a/bin/aeolus-services b/bin/aeolus-services
index adfc9a8..adba6cc 100755
--- a/bin/aeolus-services
+++ b/bin/aeolus-services
@@ -48,7 +48,7 @@ def perform(action, svcs)
     cmd = "service #{script} #{action}"
     out = `#{cmd}`
     if $?.to_i == 0
-      puts " \e[1;32mSuccess:\e[0m #{out.strip}"
+      puts " \e[1;32mSuccess:\e[0m"
     else
       puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
     end
-- 
1.7.7.6




More information about the aeolus-devel mailing list