From 76ec64d3d08d93723e886e63cbec923c3b09aabe Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Sat, 8 Mar 2014 18:21:00 -0500 Subject: [PATCH] oo-diagnostics: Fix test_node_mco_log when no log Make test_node_mco_log fail gracefully when the node mcollective log file is absent. Before this commit, the test would hang because it would run a sed command with no input file provided. This commit fixes bug 1077664. --- common/bin/oo-diagnostics | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/bin/oo-diagnostics b/common/bin/oo-diagnostics index b69fe80b813..6bc680d6057 100755 --- a/common/bin/oo-diagnostics +++ b/common/bin/oo-diagnostics @@ -772,6 +772,12 @@ class OODiag # create a tmp file with all of the unique log statements after most recent mcollective start logfile = "#{@scl_prefix}mcollective.log" logfile = [ "/var/log/openshift/node/#{logfile}", "/var/log/#{logfile}" ].find {|f| File.exist? f} + if logfile.nil? || logfile.empty? + do_fail <<-"FAIL" + No node mcollective log file found. + FAIL + skip_test + end tmpfile = Tempfile.new("oodiag-mco-#{$$}").path system %Q! sed -n 'H; /INFO.*The Marionette Collective.*started logging/h; ${g;p;}' #{logfile} | sed 's|^\w, \[[^]]*\]||' | sort -u > #{tmpfile} ! # if no restart seen, just use the whole thing