From 0cd7c5a6a0f4badb37cf9d3fcda9dd160502538e Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 25 Jun 2008 15:37:19 +0000 Subject: [PATCH] Fix no cmd line args bug. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1761 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 6 +++- xCAT-server/lib/xcat/plugins/aixinstall.pm | 35 +++++++++++++++++--- xCAT-server/lib/xcat/plugins/xcat2nim.pm | 6 +++- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e678bd743..f1c296781 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -194,7 +194,11 @@ sub processArgs { my $gotattrs = 0; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + return 2; + } if (scalar(@ARGV) <= 0) { return 2; diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index e318a78cc..0c92e2b03 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -172,7 +172,12 @@ sub nimnodeset # - just set global for now $::callback=$callback; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + &nimnodeset_usage($callback); + return 0; + } # parse the options if(!GetOptions( @@ -532,7 +537,12 @@ sub mknimimage my $root_name; my $dump_name; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + &mknimimage_usage($callback); + return 0; + } # parse the options Getopt::Long::Configure("no_pass_through"); @@ -1622,7 +1632,12 @@ sub rmnimimage { my $callback = shift; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + &rmnimimage_usage($callback); + return 0; + } # parse the options Getopt::Long::Configure("no_pass_through"); @@ -2523,7 +2538,12 @@ sub mkdsklsnode # - just set global for now $::callback=$callback; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + &mkdsklsnode_usage($callback); + return 0; + } # parse the options if(!GetOptions( @@ -2948,7 +2968,12 @@ sub rmdsklsnode # - just set global for now $::callback=$callback; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + &rmdsklsnode_usage($callback); + return 0; + } # parse the options if(!GetOptions( diff --git a/xCAT-server/lib/xcat/plugins/xcat2nim.pm b/xCAT-server/lib/xcat/plugins/xcat2nim.pm index 10350d5e7..b8467af8e 100644 --- a/xCAT-server/lib/xcat/plugins/xcat2nim.pm +++ b/xCAT-server/lib/xcat/plugins/xcat2nim.pm @@ -139,7 +139,11 @@ sub processArgs { my $gotattrs = 0; - @ARGV = @{$::args}; + if (defined(@{$::args})) { + @ARGV = @{$::args}; + } else { + return 3; + } my %ObjTypeHash;