diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index f2531a52b..e97670de3 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -380,7 +380,7 @@ sub processArgs { my $gotattrs = 0; - if (defined(@{$::args})) { + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } else { if ($::command eq "lsdef") { @@ -391,8 +391,9 @@ sub processArgs return 2; } } - if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S') - { + if ( defined ($::args) && @{$::args} ) { + if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S') + { if ($::command eq "lsdef") { push @ARGV, "-t"; push @ARGV, "node"; @@ -400,6 +401,7 @@ sub processArgs } else { return 2; } + } } if ($::command eq "lsdef") { diff --git a/xCAT-server/lib/xcat/plugins/FIP.pm b/xCAT-server/lib/xcat/plugins/FIP.pm index 144de0c9c..343b64a80 100644 --- a/xCAT-server/lib/xcat/plugins/FIP.pm +++ b/xCAT-server/lib/xcat/plugins/FIP.pm @@ -232,8 +232,7 @@ sub parse_args my $args = $request->{arg}; my $gotattrs = 0; my %opt =(); - - if (defined(@{$args})) { + if ( defined ($args) && @{$args}) { @ARGV = @{$args}; } else { return 2; diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index a2da8b590..bc678607b 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -624,7 +624,7 @@ sub nimnodeset my $Sname = xCAT::InstUtils->myxCATname(); - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -1800,7 +1800,7 @@ sub chkosimage my $image_name; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -2267,7 +2267,7 @@ sub mknimimage my $dump_name; my $install_dir = xCAT::TableUtils->getInstallDir(); - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -5705,7 +5705,7 @@ sub prermnimimage my @servicenodes = (); # pass back list of service nodes my %imagedef; # pass back image def hash - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -6215,7 +6215,7 @@ sub rmnimimage %allsn = %{$nodehash}; } - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -7822,7 +7822,7 @@ sub prenimnodecust @nodelist = @$nodes; } - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -8060,7 +8060,7 @@ sub nimnodecust @nodelist = @$nodes; } - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -8217,7 +8217,7 @@ sub prenimnodeset my $subreq = shift; my $error = 0; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -9944,7 +9944,7 @@ sub define_SN_resource } my %attrs; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -10983,7 +10983,7 @@ sub mkdsklsnode # - just set global for now $::callback = $callback; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -12993,7 +12993,7 @@ sub make_SN_resource } my %attrs; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -13653,7 +13653,7 @@ sub prermdsklsnode { my $callback = shift; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } @@ -13763,7 +13763,7 @@ sub rmdsklsnode # - just set global for now $::callback = $callback; - if (defined(@{$::args})) + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 88bfc4161..201136968 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1332,7 +1332,7 @@ sub fpc_firmxfer_watch { return; } my $percent = 0; - if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) { + if ($rsp->{data} and (scalar(@{$rsp->{data}}) > 0)) { $percent = $rsp->{data}->[0]; } #$callback->({sinfo=>"$percent%"}); diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index ab46f7d58..0d6912c54 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -3563,8 +3563,7 @@ sub create_error_response { #----------------------------------------------------------------------------- sub lskit_processargs { - - if ( defined( @{$::args} ) ) { + if ( defined ($::args) && @{$::args} ){ @ARGV = @{$::args}; } @@ -3665,7 +3664,7 @@ sub lskit_processargs { #----------------------------------------------------------------------------- sub lskitcomp_processargs { - if ( defined( @{$::args} ) ) { + if ( defined ($::args) && @{$::args} ){ @ARGV = @{$::args}; } @@ -3758,7 +3757,7 @@ sub lskitcomp_processargs { #----------------------------------------------------------------------------- sub lskitdeployparam_processargs { - if ( defined( @{$::args} ) ) { + if ( defined ($::args) && @{$::args} ){ @ARGV = @{$::args}; } diff --git a/xCAT-server/lib/xcat/plugins/kmodules.pm b/xCAT-server/lib/xcat/plugins/kmodules.pm index 15a769427..3b350ae2f 100644 --- a/xCAT-server/lib/xcat/plugins/kmodules.pm +++ b/xCAT-server/lib/xcat/plugins/kmodules.pm @@ -192,7 +192,7 @@ sub lskmodules_usage { #----------------------------------------------------------------------------- sub processArgs { - if ( defined( @{$::args} ) ) { + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } diff --git a/xCAT-server/lib/xcat/plugins/rollupdate.pm b/xCAT-server/lib/xcat/plugins/rollupdate.pm index c038d371b..52f4d49ce 100644 --- a/xCAT-server/lib/xcat/plugins/rollupdate.pm +++ b/xCAT-server/lib/xcat/plugins/rollupdate.pm @@ -250,7 +250,7 @@ sub runrollupdate_usage { sub processArgs { my $gotattrs = 0; - if ( defined( @{$::args} ) ) { + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } else { diff --git a/xCAT-server/lib/xcat/plugins/xcat2nim.pm b/xCAT-server/lib/xcat/plugins/xcat2nim.pm index f1ea2b4cc..38c72cbc7 100644 --- a/xCAT-server/lib/xcat/plugins/xcat2nim.pm +++ b/xCAT-server/lib/xcat/plugins/xcat2nim.pm @@ -199,7 +199,7 @@ sub prexcat2nim my @nodelist=(); # pass back list of nodes - if applicable my @servicenodes=(); # pass back list of service nodes - if applicable - if (defined(@{$::args})) { + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } else { &xcat2nim_usage($callback); @@ -359,7 +359,7 @@ sub processArgs my $gotattrs = 0; - if (defined(@{$::args})) { + if ( defined ($::args) && @{$::args} ) { @ARGV = @{$::args}; } else { return 3;