From ceba3e9ebd31f2bac9f0a924df16fc1ee77fdbc9 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 14 Nov 2012 11:05:51 +0000 Subject: Define macros correctly when only one host is present. --- bin/custodian-enqueue | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index 4678562..9a261b7 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -209,13 +209,26 @@ class MonitorConfig elsif ( line =~ /\s(is|are)\s+(.*)\.+$/ ) # - # Literal list. + # Literal list of hosts # - tmp = $2.dup.split( /\s+and\s+/ ) - tmp.each do |entry| - val.push( entry ) + hosts = $2.dup + + # + # If there is " and " then tokenize + # + if ( hosts =~ /\s+and\s+/ ) + tmp = hosts.split( /\s+and\s+/ ) + tmp.each do |entry| + val.push( entry ) + end + else + # + # Otherwise a single host + # + val.push( hosts ) end + end @MACROS[name] = val -- cgit v1.2.1