From b9b0240543145e977903d2763b24a5832d5351db Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 28 Feb 2012 02:03:07 -0500 Subject: [PATCH] Continued ans-command output upgrades, fixed output_dest back again --- bin/ans-command | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/ans-command b/bin/ans-command index 90f16cb6c4..e1c855c08f 100755 --- a/bin/ans-command +++ b/bin/ans-command @@ -108,10 +108,17 @@ def main(args): hostname, rc, msg ) else: - print "%s | rc=%s >>" % (hostname, rc) - print stdout + buf = '' + buf += "%s | rc=%s >>\n" % (hostname, rc) + buf += stdout if stderr: - print stderr + buf += stderr + print buf + if options.output_dest: + path = os.path.join(options.output_dest, hostname) + fd = open(path, "w+") + fd.write(buf) + fd.close() if results['dark']: error_print('Hosts which could not be contacted or did not respond:')