mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
imgimport/imgexport better messages and option handling
This commit is contained in:
parent
4e2ea01358
commit
e0fec1a85d
@ -21,7 +21,7 @@ SYNOPSIS
|
||||
|
||||
\ **imgexport [-h| -**\ **-help]**\
|
||||
|
||||
\ **imgexport**\ \ *image_name*\ [\ *destination*\ ] [[\ **-e | -**\ **-extra**\ \ *file:dir*\ ] ... ] [\ **-p | -**\ **-postscripts**\ \ *node_name*\ ] [\ **-v | -**\ **-verbose**\ ]
|
||||
\ **imgexport**\ \ *image_name*\ [\ *destination*\ ] [\ **-e | -**\ **-extra**\ \ *file:dir*\ ] ... ] [\ **-p | -**\ **-postscripts**\ \ *node_name*\ ] [\ **-R | -**\ **-remotehost**\ \ *user@host*\ ] [\ **-v | -**\ **-verbose**\ ]
|
||||
|
||||
|
||||
***********
|
||||
@ -90,6 +90,12 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
\ **-R|-**\ **-remotehost**\ \ *user@host*\
|
||||
|
||||
Export the image to remote host. Passwordless ssh must be setup to the remote host.
|
||||
|
||||
|
||||
|
||||
\ **-v|-**\ **-verbose**\
|
||||
|
||||
Verbose output.
|
||||
@ -132,7 +138,7 @@ EXAMPLES
|
||||
imgexport foo
|
||||
|
||||
|
||||
foo.tgz will be built in the current working directory. Make sure that you have enough space in the directory that you are in to run imgexport if you have a big image to tar up.
|
||||
foo.tgz will be built in the current working directory. Make sure that you have enough space in the directory that you are in to run imgexport, if you have a big image to tar up.
|
||||
|
||||
2. To include extra files with your image:
|
||||
|
||||
|
@ -21,7 +21,7 @@ SYNOPSIS
|
||||
|
||||
\ **imgimport [-h|-**\ **-help]**\
|
||||
|
||||
\ **imgimport**\ \ *bundle_file_name*\ [\ **-p | -**\ **-postscripts**\ \ *nodelist*\ ] [\ **-f | -**\ **-profile**\ \ *new_profile*\ ] [\ **-v | -**\ **-verbose**\ ]
|
||||
\ **imgimport**\ \ *bundle_file_name*\ [\ **-p | -**\ **-postscripts**\ \ *nodelist*\ ] [\ **-f | -**\ **-profile**\ \ *new_profile*\ ] [\ **-R | -**\ **-remotehost**\ \ *user@host*\ ] [\ **-v | -**\ **-verbose**\ ]
|
||||
|
||||
|
||||
***********
|
||||
@ -109,6 +109,12 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
\ **-R|-**\ **-remotehost**\ \ *user@host*\
|
||||
|
||||
Import the image from remote host. Passwordless ssh must be setup to the remote host.
|
||||
|
||||
|
||||
|
||||
\ **-v|-**\ **-verbose**\
|
||||
|
||||
Verbose output.
|
||||
|
@ -6,7 +6,7 @@ B<imgexport> - Exports an xCAT image.
|
||||
|
||||
B<imgexport [-h| --help]>
|
||||
|
||||
B<imgexport> I<image_name> [I<destination>] [[B<-e>|B<--extra> I<file:dir>] ... ] [B<-p>|B<--postscripts> I<node_name>] [B<-v>|B<--verbose>]
|
||||
B<imgexport> I<image_name> [I<destination>] [B<-e>|B<--extra> I<file:dir>] ... ] [B<-p>|B<--postscripts> I<node_name>] [B<-R>|B<--remotehost> I<user@host>] [B<-v>|B<--verbose>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@ -65,6 +65,10 @@ Display usage message.
|
||||
|
||||
Get the names of the postscripts and postbootscripts for the given node and pack them into the image.
|
||||
|
||||
=item B<-R|--remotehost> I<user@host>
|
||||
|
||||
Export the image to remote host. Passwordless ssh must be setup to the remote host.
|
||||
|
||||
=item B<-v|--verbose>
|
||||
|
||||
Verbose output.
|
||||
@ -92,7 +96,7 @@ The output bundle file name.
|
||||
|
||||
imgexport foo
|
||||
|
||||
foo.tgz will be built in the current working directory. Make sure that you have enough space in the directory that you are in to run imgexport if you have a big image to tar up.
|
||||
foo.tgz will be built in the current working directory. Make sure that you have enough space in the directory that you are in to run imgexport, if you have a big image to tar up.
|
||||
|
||||
2. To include extra files with your image:
|
||||
|
||||
|
@ -6,7 +6,7 @@ B<imgimport> - Imports an xCAT image or configuration file into the xCAT tables
|
||||
|
||||
B<imgimport [-h|--help]>
|
||||
|
||||
B<imgimport> I<bundle_file_name> [B<-p>|B<--postscripts> I<nodelist>] [B<-f>|B<--profile> I<new_profile>] [B<-v>|B<--verbose>]
|
||||
B<imgimport> I<bundle_file_name> [B<-p>|B<--postscripts> I<nodelist>] [B<-f>|B<--profile> I<new_profile>] [B<-R>|B<--remotehost> I<user@host>] [B<-v>|B<--verbose>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@ -82,6 +82,10 @@ Display usage message.
|
||||
|
||||
Import the postscripts. The postscripts contained in the image will be set in the postscripts table for I<nodelist>.
|
||||
|
||||
=item B<-R|--remotehost> I<user@host>
|
||||
|
||||
Import the image from remote host. Passwordless ssh must be setup to the remote host.
|
||||
|
||||
=item B<-v|--verbose>
|
||||
|
||||
Verbose output.
|
||||
|
@ -123,7 +123,7 @@ sub ximport {
|
||||
'R|remotehost=s' => \$remoteHost,
|
||||
'p|postscripts=s' => \$nodes,
|
||||
'f|profile=s' => \$new_profile,
|
||||
'n|nozip' => \$nozip
|
||||
'n|nozip' => \$nozip
|
||||
);
|
||||
|
||||
if ($help) {
|
||||
@ -131,8 +131,14 @@ sub ximport {
|
||||
return;
|
||||
}
|
||||
|
||||
# first extract the bundle
|
||||
extract_bundle($request, $callback, $nodes, $new_profile, $remoteHost, $nozip );
|
||||
if ($#ARGV == -1) {
|
||||
# if no arguments left after processing the options, then bundle name is missing
|
||||
$xusage->(1);
|
||||
} else {
|
||||
# first extract the bundle
|
||||
my $bundle = shift @ARGV;
|
||||
extract_bundle($request, $callback, $bundle, $nodes, $new_profile, $remoteHost, $nozip );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1067,10 +1073,10 @@ sub make_bundle {
|
||||
if (defined $remoteHost) {
|
||||
my $remoteFile = $remoteHost . ':' . $remoteDest;
|
||||
|
||||
$callback->({ data => ["Moving the image bundle to the remote system location $remoteDest"] });
|
||||
$callback->({ data => ["Moving the image bundle to the remote system location $remoteFile"] });
|
||||
$rc = system("/usr/bin/scp -B $dest $remoteFile");
|
||||
if ($rc) {
|
||||
$callback->({ error => ["Unable to copy the image bundle $bundleName to the remote host"], errorcode => [1] });
|
||||
$callback->({ error => ["Unable to copy the image bundle $bundleName to the remote host (Maybe passwordless ssh was not setup?)"], errorcode => [1] });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1114,20 +1120,18 @@ sub extract_bundle {
|
||||
|
||||
#print Dumper($request);
|
||||
my $callback = shift;
|
||||
my $bundle = shift;
|
||||
my $nodes = shift;
|
||||
my $new_profile = shift;
|
||||
my $remoteHost = shift;
|
||||
my $nozip = shift;
|
||||
|
||||
@ARGV = @{ $request->{arg} };
|
||||
my $xml;
|
||||
my $data;
|
||||
my $datas;
|
||||
my $error = 0;
|
||||
my $bundleCopy;
|
||||
|
||||
my $bundle = shift @ARGV;
|
||||
|
||||
# Determine the current working directory.
|
||||
my $dir = $request->{cwd}; #getcwd;
|
||||
$dir = $dir->[0];
|
||||
@ -1152,10 +1156,10 @@ sub extract_bundle {
|
||||
my $remoteFile = "$remoteHost:$bundle";
|
||||
$bundleCopy = `/bin/mktemp $workDir/imgimport.$$.XXXXXX`;
|
||||
chomp($bundleCopy);
|
||||
$callback->({ data => ["Obtaining the image bundle from the remote system"] });
|
||||
$callback->({ data => ["Obtaining the image bundle from the remote system $remoteFile"] });
|
||||
my $rc = system("/usr/bin/scp -v -B $remoteFile $bundleCopy");
|
||||
if ($rc != 0) {
|
||||
$callback->({ error => ["Unable to copy the image bundle $bundle from the remote host"], errorcode => [1] });
|
||||
$callback->({ error => ["Unable to copy the image bundle $bundle from the remote host (Maybe passwordless ssh was not setup?)"], errorcode => [1] });
|
||||
$rc = system("rm -rf $bundleCopy");
|
||||
if ($rc) {
|
||||
$callback->({ error => ["Failed to remove the local copy of the remote image bundle $bundleCopy"], errorcode => [1] });
|
||||
|
Loading…
x
Reference in New Issue
Block a user