From 5fdab86af34c719046b7095cf1c0d1747294f7ea Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 8 Sep 2015 11:36:19 -0700 Subject: [PATCH] Add -m to smart.pl that prints output for humans Signed-off-by: Dan Mick --- roles/testnode/files/libexec/smart.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/testnode/files/libexec/smart.pl b/roles/testnode/files/libexec/smart.pl index f55870ee..7a826864 100644 --- a/roles/testnode/files/libexec/smart.pl +++ b/roles/testnode/files/libexec/smart.pl @@ -213,10 +213,20 @@ $result = 2 if $crit; my $out = "No real disks found on machine"; $out = "All $drives drives happy as clams" if $drives; -if (@out) -{ - $out = join('; ', @out); -} +if ($ARGV[0] =~ /-m/) { + if (@out) { + foreach my $line (@out) { + print $line, "\n"; + } + } else { + print "$out\n"; + } +} else { + if (@out) + { + $out = join('; ', @out); + } -print "$out\n"; + print "$out\n"; +} exit $result; -- 2.47.3