From 33aeb981c1bd5639c52014e32149bf846ff2cc6c Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 10 Jul 2009 20:26:28 +0000 Subject: [PATCH] changeed -s flag in monadd command to be consistent with other commands git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3759 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/pods/man1/monadd.1.pod | 6 ++--- xCAT-server/lib/xcat/plugins/monctrlcmds.pm | 26 ++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/xCAT-client/pods/man1/monadd.1.pod b/xCAT-client/pods/man1/monadd.1.pod index db15b45ce..1af28f860 100644 --- a/xCAT-client/pods/man1/monadd.1.pod +++ b/xCAT-client/pods/man1/monadd.1.pod @@ -22,7 +22,7 @@ This command is used to register a monitoring plug-in module to monitor the xCAT I is the name of the monitoring plug-in module. For example, if the the I is called I, then the actual file name that the xcatd looks for is I. Use I command to list all the monitoring plug-in modules that can be used. -I is the monitoring plug-in specific settings. It is used to customize the behavior of the plug-in or configure the 3rd party software. Format: I<[key-value],[key=value]...> Please note that the square brackets are needed here. Use I command to look for the possbile setting keys for a plug-in module. +I is the monitoring plug-in specific settings. It is used to customize the behavior of the plug-in or configure the 3rd party software. Format: I<-s key-value -s key=value ...> Please note that the square brackets are needed here. Use I command to look for the possbile setting keys for a plug-in module. =head1 OPTIONS @@ -31,7 +31,7 @@ B<-h | --help> Display usage message. B<-n | --nodestatmon> Indicate that this monitoring plug-in will be used for feeding the node liveness status to the xCAT I table. -B<-s | --settings> Specifies the plug-in specific settings. These settings will be used by the plug-in to customize certain entities for the plug-in or the third party monitoring software. e.g. [mon_interval=10],[toggle=1]. +B<-s | --settings> Specifies the plug-in specific settings. These settings will be used by the plug-in to customize certain entities for the plug-in or the third party monitoring software. e.g. -s mon_interval=10 -s toggle=1. B<-v | --version > Command Version. @@ -60,7 +60,7 @@ This will also add the I to the I table. To view the 3. To register xcatmon plug-in module to feed the node liveness status to xCAT's I table, enter: - monaddt rmcmon -n -s [ping-interval=2] + monaddt rmcmon -n -s ping-interval=2 where 2 is the number of minutes between the pings. diff --git a/xCAT-server/lib/xcat/plugins/monctrlcmds.pm b/xCAT-server/lib/xcat/plugins/monctrlcmds.pm index a02eea71d..161ac362e 100644 --- a/xCAT-server/lib/xcat/plugins/monctrlcmds.pm +++ b/xCAT-server/lib/xcat/plugins/monctrlcmds.pm @@ -849,10 +849,10 @@ sub monadd { $rsp->{data}->[3]= " name is the name of the monitoring plug-in module to be added."; $rsp->{data}->[4]= " Use 'monls -a' command to list all the monitoring plug-in names."; $rsp->{data}->[5]= " settings is used by the monitoring plug-in to customize its behavior."; - $rsp->{data}->[6]= " Format: [key1=value1],[key2=value2]... "; + $rsp->{data}->[6]= " Format: -s key1=value1 -s key2=value2 ... "; $rsp->{data}->[7]= " Please note that the square brackets are needed. "; $rsp->{data}->[7]= " Use 'monls name -d' command to look for the possible settings for a plug-in."; - $rsp->{data}->[8]= " Example: monadd xcatmon -n -s [ping-interval=10]"; + $rsp->{data}->[8]= " Example: monadd xcatmon -n -s ping-interval=10"; $cb->($rsp); } @@ -865,7 +865,7 @@ sub monadd { 'h|help' => \$::HELP, 'v|version' => \$::VERSION, 'n|nodestatmon' => \$::NODESTATMON, - 's|settings=s' => \$settings)) + 's|settings=s@' => \$settings)) { &monadd_usage($callback); return 1; @@ -952,11 +952,21 @@ sub monadd { my $table1=xCAT::Table->new("monsetting", -create => 1,-autocommit => 1); my %key_col1 = (name=>$pname); #parse the settings. Setting format: key="value",key="value".... - while ($settings =~ s/^\[([^\[\]\=]*)=([^\[\]]*)\](,)*//) { - $key_col1{key}=$1; - my %setting_hash=(); - $setting_hash{value}=$2; - $table1->setAttribs(\%key_col1, \%setting_hash); + foreach (@$settings) { + if (/^\[(.*)\]$/) { #backward compatible + while (s/^\[([^\[\]\=]*)=([^\[\]]*)\](,)*//) { + $key_col1{key}=$1; + my %setting_hash=(); + $setting_hash{value}=$2; + $table1->setAttribs(\%key_col1, \%setting_hash); + } + } else { + /^([^\=]*)=(.*)/; + $key_col1{key}=$1; + my %setting_hash=(); + $setting_hash{value}=$2; + $table1->setAttribs(\%key_col1, \%setting_hash); + } } $table1->close(); }