mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-03 21:02:34 +00:00 
			
		
		
		
	git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5068 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			64 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
package xCAT_plugin::offline;
 | 
						|
BEGIN
 | 
						|
{
 | 
						|
	$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
 | 
						|
}
 | 
						|
use lib "$::XCATROOT/lib/perl";
 | 
						|
use xCAT::Table;
 | 
						|
use Getopt::Long;
 | 
						|
use File::Basename;
 | 
						|
use File::Path;
 | 
						|
use File::Copy;
 | 
						|
use File::Find;
 | 
						|
use Cwd;
 | 
						|
use File::Temp;
 | 
						|
use xCAT::SvrUtils;
 | 
						|
use Data::Dumper;
 | 
						|
Getopt::Long::Configure("bundling");
 | 
						|
Getopt::Long::Configure("pass_through");
 | 
						|
 | 
						|
my $verbose = "0";
 | 
						|
 | 
						|
sub handled_commands {
 | 
						|
        return {
 | 
						|
                "offline" => "offline"
 | 
						|
        }
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
# function to handle request.  Basically, get the information
 | 
						|
# about the image and then do the action on it.  Is that vague enough?
 | 
						|
sub process_request {
 | 
						|
	my $request = shift;
 | 
						|
	my $callback = shift;
 | 
						|
	my $doreq = shift;
 | 
						|
 | 
						|
	GetOptions(
 | 
						|
		"version|v" => \$version,
 | 
						|
	);
 | 
						|
 | 
						|
	if ($version) {
 | 
						|
		my $version = xCAT::Utils->Version();
 | 
						|
		$callback->({info=>[$version]});
 | 
						|
		return;
 | 
						|
	}
 | 
						|
	if ($help) {
 | 
						|
		$callback->({info=>["This command really doesn't do anything"]});
 | 
						|
		return;
 | 
						|
	}
 | 
						|
 | 
						|
	if($request->{node}){
 | 
						|
		$noderange = $request->{node};
 | 
						|
	}else{
 | 
						|
		$callback->({error=>["No nodes specified in request for offline"]});
 | 
						|
	}
 | 
						|
	
 | 
						|
 | 
						|
	my @nodes = @{$noderange};
 | 
						|
	foreach my $n (@nodes){
 | 
						|
		$callback->({info=>["$n: offline"]});
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
1;
 |