diff --git a/perl-xCAT/xCAT/FSPcfg.pm b/perl-xCAT/xCAT/FSPcfg.pm index 8d963fe27..971f0c6fa 100644 --- a/perl-xCAT/xCAT/FSPcfg.pm +++ b/perl-xCAT/xCAT/FSPcfg.pm @@ -190,11 +190,11 @@ sub parse_args { $request->{arg} = [$arg]; my $res = xCAT::PPCcfg::parse_args($request, @_); if (ref($res) eq 'ARRAY') { - my $check_cmd = &check_command($command, \%rsp); - if (!defined($check_cmd)) { + my $check_cmd = &check_command($command, \%rsp); + if (!defined($check_cmd)) { return $res; - } else { - return ([$_[0], "'$command' is only supported by type $check_cmd."]); + } else { + return ([$_[0], "'$command' is only supported by type $check_cmd."]); } } else { push @ppc_cmds, $command; @@ -233,6 +233,8 @@ sub parse_args { if ( $result ) { return( usage($result) ); } + } elsif ($_ =~ /_passwd$/) { + return( usage("No argument specified for '$_'")); } } #################################### diff --git a/perl-xCAT/xCAT/PPCcfg.pm b/perl-xCAT/xCAT/PPCcfg.pm index 33eabb85c..d65520a23 100644 --- a/perl-xCAT/xCAT/PPCcfg.pm +++ b/perl-xCAT/xCAT/PPCcfg.pm @@ -158,13 +158,18 @@ sub parse_args { if ( $result ) { return( usage($result) ); } + } elsif ($_ =~ /_passwd$/) { + return( usage("No argument specified for '$_'")); } } { - my $result = parse_dev_option( $request, \%cmds); - if ($result) { - return ( usage($result)); - } + if ($request->{dev} eq '1' && $request->{other} eq '1') { + return ( usage("Invalid command arrays")); + } +# my $result = parse_dev_option( $request, \%cmds); +# if ($result) { +# return ( usage($result)); +# } } #################################### # Return method to invoke @@ -310,7 +315,15 @@ sub parse_option { return( "New password couldn't be empty for user 'HMC'" ); } } - + + if ( $command eq 'dev' or $command eq 'celogin1' ) { + if ($value !~ /^(enable|disable)$/i ) { + return( "Invalid argument '$value'" ); + } + $request->{dev} = 1; + } else { + $request->{other} = 1; + } return undef; }