-Implement a '-d' argument to makeconservercf to allow removal of entries rather than refresh or addition

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2645 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-01-23 04:16:03 +00:00
parent 427da91a34
commit 36da395f3a
2 changed files with 23 additions and 4 deletions

View File

@ -4,7 +4,7 @@ B<makeconservercf> - creates the conserver configuration file from info in the x
=head1 SYNOPSIS
B<makeconservercf> [B<-l|--local>] [I<noderange>]
B<makeconservercf> [B<-l|--local|-d|--delete>] [I<noderange>]
B<makeconservercf> [B<-h|--help|-v|--version>]
@ -26,6 +26,10 @@ all relevant management/service nodes. If -l is specified, it will only create
=over 10
=item B<-d|--delete>
Delete rather than add or refresh the nodes specified as a noderange.
=item B<-l|--local>
Only run B<makeconservercf> locally and create the local /etc/conserver.cf. The default is to also

View File

@ -13,13 +13,14 @@ my @cservers = qw(mrv cyclades);
my %termservers; #list of noted termservers
my $usage_string=
" makeconservercf noderange
" makeconservercf [-d|--delete] noderange
makeconservercf [-l|--local]
makeconservercf -h|--help
makeconservercf -v|--version
-l|--local The conserver gets set up only on the local host.
The default goes down to all the conservers on
the server nodes and set them up.
the server nodes and set them up
-d|--delete Conserver has the relevant entries for the given noderange removed immediately from configuration
-h|--help Display this usage statement.
-v|--version Display the version number.";
@ -207,6 +208,16 @@ sub makeconservercf {
my $req = shift;
%termservers = (); #clear hash of existing entries
my $cb = shift;
my $extrargs = $req->{arg};
my @exargs=($req->{arg});
if (ref($extrargs)) {
@exargs=@$extrargs;
}
@ARGV=@exargs;
$Getopt::Long::ignorecase=0;
#$Getopt::Long::pass_through=1;
my $delmode;
GetOptions('d|delete' => \$delmode);
my $nodes = $req->{node};
my $svboot=0;
if (exists($req->{svboot})) { $svboot=1;}
@ -279,7 +290,7 @@ sub makeconservercf {
dotsent($_,\@filecontent);
$termservers{$_->{termserver}}=1; #prevent needless cycles being burned
}
donodeent($_,\@filecontent);
donodeent($_,\@filecontent,$delmode);
}
}
}
@ -369,6 +380,7 @@ sub donodeent {
my $cfgent = shift;
my $node = $cfgent->{node};
my $content = shift;
my $delmode = shift;
my $idx=0;
my $toidx=-1;
my $skip = 0;
@ -391,6 +403,9 @@ sub donodeent {
}
$skip = $skipnext;
}
if ($delmode) {
return;
}
push @$content,"#xCAT BEGIN $node CONS\n";
push @$content,"console $node {\n";
#if ($cfgent->{cons}