2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00

Fix sytax errors reported by perltidy

This commit is contained in:
Mark Gurevich 2016-07-25 08:56:18 -04:00
parent 0c9cb53fd4
commit db9a71750e
41 changed files with 127 additions and 173 deletions

View File

@ -990,7 +990,7 @@ sub setobjdefs
}
xCAT::MsgUtils->message("I", $rsp, $::callback);
$checkedattrs{$attr_name} = 1;
if ($invalidattr->{$attr_name}->{valid} ne 1) {
if ($invalidattr->{$attr_name}->{valid} != 1) {
$invalidattr->{$attr_name}->{valid} = 0;
$invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'";
}
@ -999,7 +999,7 @@ sub setobjdefs
}
if (!($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) && !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/)) {
if ($invalidattr->{$attr_name}->{valid} ne 1) {
if ($invalidattr->{$attr_name}->{valid} != 1) {
$invalidattr->{$attr_name}->{valid} = 0;
$invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'";
@ -1126,7 +1126,7 @@ sub setobjdefs
my $rsp;
foreach my $att (keys %$invalidattr) {
if ($invalidattr->{$att}->{valid} ne 1) {
if ($invalidattr->{$att}->{valid} != 1) {
my $tt = $invalidattr->{$att}->{valid};
push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition}.";
xCAT::MsgUtils->message("E", $rsp, $::callback);

View File

@ -1874,11 +1874,11 @@ sub query_cec_info_actions {
if (@$values[1] =~ /^$/) {
next;
}
if ($usage eq 1 or $usage eq 2) {
if ($usage == 1 or $usage == 2) {
&parse_part_get_info(\%hash, @$values[1], $lparid);
}
if ($usage eq 0 or $usage eq 2) {
if ($usage == 0 or $usage == 2) {
if ($lparid) {
if ($action eq "lpar_lhea_mac") {
my @output = split /\n/, @$values[1];
@ -1941,10 +1941,10 @@ sub query_cec_info_actions {
push @array, [ $name, @$values[1], @$values[2] ];
}
}
if ($usage eq 0 or $usage eq 2) {
if ($usage == 0 or $usage == 2) {
#return $data;
if ($usage eq 2) {
if ($usage == 2) {
%$lpar_hash = %hash;
}
return \@array;

View File

@ -99,12 +99,12 @@ sub nc_msg
my $msg = shift;
my $rsp;
if ($verbose eq 1) {
if ($verbose == 1) {
$rsp->{data}->[0] = $msg;
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
}
if ($verbose eq 2) {
if ($verbose == 2) {
$rsp->{data}->[0] = $msg;
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
@ -468,7 +468,7 @@ sub get_phandle {
}
],
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
# Next, the 'ls' command is sent. The result is a display of the entire
# device tree. The code then looks at the
@ -552,7 +552,7 @@ sub get_phandle {
}
],
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
if ($result[2] =~ /(\w*)\:(\s*)\/(\S*)/) {
my $x1 = $1;
@ -698,7 +698,7 @@ sub get_adap_prop {
# state 7, done
$done[7] = 1;
while ($done[$state] eq 0) {
while ($done[$state] == 0) {
nc_msg($verbose, "Status: command is $cmd[$state]\n");
send_command($verbose, $rconsole, $cmd[$state]);
@result = ();
@ -706,7 +706,7 @@ sub get_adap_prop {
$timeout,
[ qr/$pattern[$state]/i,
sub {
if ($state eq 1) {
if ($state == 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting adapter property for phandle=$phandle.\n");
$state = 7;
@ -750,12 +750,12 @@ sub get_adap_prop {
}
]
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
# After state 3, the network type is parsed and the connector
# type extracted. If the type hasn't been found, add it to
# the list of supported connector types.
if ($state eq 4) {
if ($state == 4) {
# Build the adapter properties from the string
#regexp .*,(.*),(.*),(.*) $nw_type dummy nw_speed nw_conn nw_duplex
@ -784,7 +784,7 @@ sub get_adap_prop {
# state variable is left alone. if not, the state variable is
# set to 2, causing a loop back to the step where the
# decode-string command is sent.
if ($state eq 5) {
if ($state == 5) {
if ($result[3] =~ /2 > \.s \w+ (\w*)/) {
$state = 2 if ($1 != 0);
}
@ -899,14 +899,14 @@ sub get_mac_addr {
# state 4, all done
$done[4] = 1;
while ($done[$state] eq 0) {
while ($done[$state] == 0) {
@result = ();
send_command($verbose, $rconsole, $cmd[$state]);
@result = $rconsole->expect(
$timeout,
[ qr/$pattern[$state]/ =>
sub {
if ($state eq 1) {
if ($state == 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle.\n");
$rconsole->clear_accum();
@ -990,11 +990,11 @@ sub get_mac_addr {
}
],
);
return undef if ($rc eq 1);
return undef if ($rc == 1);
}
# if the state is 0, 1, or 2, an error occurred and the join will fail
if ($state eq 4) {
if ($state == 4) {
if ($result[2] =~ /dump-mac\s*(\w*)\s*ok/) {
$mac_address = $1;
}
@ -1097,7 +1097,7 @@ sub get_adaptr_loc {
$timeout,
[ qr/$pattern[$state]/ =>
sub {
if ($state eq 1) {
if ($state == 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting adapter location for phandle=$phandle.");
$rconsole->clear_accum();
@ -1178,7 +1178,7 @@ sub get_adaptr_loc {
}
],
);
return undef if ($rc eq 1);
return undef if ($rc == 1);
}
# Did we find one or more adapters?
@ -1353,7 +1353,7 @@ sub ping_server {
# Get the list of properties for this adapter
#
$adap_prop_list_array = get_adap_prop($phandle, $rconsole, $node, $verbose);
if ($adap_prop_list_array eq 1) {
if ($adap_prop_list_array == 1) {
nc_msg($verbose, "ERROR return from get_adap_prop\n");
return 1;
}
@ -1444,23 +1444,23 @@ sub ping_server {
],
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
if ($state eq 1) {
if ($state == 1) {
$adap_conn = $adap_conn_list[$j];
$cmd[1] = "\" ethernet,$adap_speed,$adap_conn,$adap_duplex\" encode-string \" chosen-network-type\" property\r";
nc_msg($verbose, "Status: Trying connector type $adap_conn\n");
$j++;
}
if ((($tty_do_ping eq 1) && ($state eq 4)) || ($tty_do_ping != 1) && ($state eq 3)) {
if ((($tty_do_ping == 1) && ($state == 4)) || ($tty_do_ping != 1) && ($state == 3)) {
$ping_debug = $result[2];
}
if ((($tty_do_ping eq 1) && ($state eq 5)) || ($tty_do_ping != 1) && ($state eq 4)) {
if (($tty_do_ping eq 1) && ($state eq 5)) {
if ((($tty_do_ping == 1) && ($state == 5)) || ($tty_do_ping != 1) && ($state == 4)) {
if (($tty_do_ping == 1) && ($state == 5)) {
#$ping_rc = $result[2];
$stack_level = length($result[4]);
} elsif (($state eq 4) && ($tty_do_ping != 1) && ($result[2] =~ /PING SUCCESS/)) {
} elsif (($state == 4) && ($tty_do_ping != 1) && ($result[2] =~ /PING SUCCESS/)) {
$ping_rc = 0;
#} elsif ( $result[2] =~ /unknown word/ ) {
@ -1497,7 +1497,7 @@ sub ping_server {
if ($ping_rc eq 0) {
nc_msg($verbose, "# $full_path_name ping successful.\n");
} elsif ($ping_rc eq 1) {
} elsif ($ping_rc == 1) {
nc_msg($verbose, "# $full_path_name ping unsuccessful.\n");
nc_msg($verbose, "# $full_path_name ping unsuccessful.\n");
nc_msg($verbose, "$ping_debug\n");
@ -1711,7 +1711,7 @@ sub set_disk_boot {
[ qr/$pattern[$state]/ =>
sub {
$rconsole->clear_accum();
if ($state eq 4) {
if ($state == 4) {
if ($expect_out[6] eq "None") {
$state = 8;
}
@ -1744,7 +1744,7 @@ sub set_disk_boot {
}
],
);
if ($rc eq 1) {
if ($rc == 1) {
return 1;
} else {
return 0;
@ -1898,25 +1898,25 @@ sub boot_network {
sub {
$rconsole->clear_accum();
my @expect_out = shift;
if ($state eq 2) {
if ($set_boot_order eq 1) {
if ($state == 2) {
if ($set_boot_order == 1) {
########################################
# Set network as boot device
########################################
$cmd[3] = "setenv boot-device $net_device[$newstate[3]]\r";
} elsif ($set_boot_order eq 2) {
} elsif ($set_boot_order == 2) {
########################################
# Set network as 1st boot device,disk as 2nd boot device
########################################
$boot_device_bk = $expect_out[1];
$cmd[3] = "setenv boot-device $net_device[$newstate[3]] $boot_device_bk\r";
} elsif ($set_boot_order eq 3) {
} elsif ($set_boot_order == 3) {
########################################
# Set disk as 1st boot device,network as 2nd boot device
########################################
$boot_device_bk = $expect_out[1];
$cmd[3] = "setenv boot-device $boot_device_bk $net_device[$newstate[3]]\r";
} elsif ($set_boot_order eq 4) {
} elsif ($set_boot_order == 4) {
########################################
# set disk as boot device
########################################
@ -1973,7 +1973,7 @@ sub boot_network {
}
],
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
}
return 0;
}
@ -2363,7 +2363,7 @@ sub Firmware_Dump {
}
],
);
return 1 if ($rc eq 1);
return 1 if ($rc == 1);
}
return 0;
}
@ -2846,7 +2846,7 @@ sub lparnetbootexp
return [1];
}
unless ($output =~ /Success/) {
if ($retry_count eq 3) {
if ($retry_count == 3) {
nc_msg($verbose, "Power off failed, msg is $output.\n");
return [1];
}
@ -2874,7 +2874,7 @@ sub lparnetbootexp
return [1];
}
unless ($output =~ /Success/) {
if ($retry_count eq 3) {
if ($retry_count == 3) {
nc_msg($verbose, "Power off failed, msg is $output.\n");
return [1];
}
@ -2988,7 +2988,7 @@ sub lparnetbootexp
sub {
$rconsole->send("\r");
$retry_count++;
if ($retry_count eq 9) {
if ($retry_count == 9) {
nc_msg($verbose, "Timeout waiting for ok prompt; exiting.\n");
$rconsole->soft_close();
$rc = 1;
@ -3003,7 +3003,7 @@ sub lparnetbootexp
}
],
);
return [1] if ($rc eq 1);
return [1] if ($rc == 1);
}
@ -3033,10 +3033,10 @@ sub lparnetbootexp
nc_msg($verbose, "begin to run get_phandle");
while (!$done) {
my $result = get_phandle($rconsole, $node, $verbose);
if ($result eq 1) {
if ($result == 1) {
$retry_count++;
$rconsole->send("\r");
if ($retry_count eq 3) {
if ($retry_count == 3) {
nc_msg($verbose, "Unable to obtain network adapter information. Quitting.\n");
return [1];
}
@ -3053,7 +3053,7 @@ sub lparnetbootexp
##############################
nc_msg($verbose, "begin to run multiple_open_dev");
my $result = xCAT::LparNetbootExp->multiple_open_dev($rconsole, $node, $verbose);
if ($result eq 1) {
if ($result == 1) {
nc_msg($verbose, "Unable to obtain network adapter information. Quitting.\n");
return [1];
}
@ -3230,7 +3230,7 @@ sub lparnetbootexp
}
$mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose);
if ($macaddress =~ /$mac_address/) {
if (($discovery eq 1) && !$discoverynoping) {
if (($discovery == 1) && !$discoverynoping) {
unless ($adap_type[$i] eq "hfi-ent") {
$ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip);
}
@ -3281,7 +3281,7 @@ sub lparnetbootexp
for ($i = 0 ; $i < $adapter_found ; $i++) {
nc_msg($verbose, " begint to boot from first adapter in the device tree \n");
if ($adap_type[$i] eq $list_type) {
if (($discovery eq 1) && !$discoverynoping) {
if (($discovery == 1) && !$discoverynoping) {
$ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip);
unless ($ping_rc eq 0) {
return [1];
@ -3318,7 +3318,7 @@ sub lparnetbootexp
# Need to retry network boot because of intermittant network failure
# after partition reboot. Force partition to stop at Open Firmware prompt.
###########################################################################
if ($result eq 5) {
if ($result == 5) {
$timeout = 300;
$rconsole->expect(
@ -3360,7 +3360,7 @@ sub lparnetbootexp
}
],
);
return [1] if ($rc eq 1);
return [1] if ($rc == 1);
nc_msg($verbose, "# bootp sent over network.\n");
$rc = Boot($rconsole, $node, $verbose); #, @expect_out);
unless ($rc eq 0) {

View File

@ -770,7 +770,7 @@ sub classful_networks_for_net_and_mask
my @results;
my $bitstoeven = (8 - ($mask % 8));
if ($bitstoeven eq 8) { $bitstoeven = 0; }
if ($bitstoeven == 8) { $bitstoeven = 0; }
my $resultmask = $mask + $bitstoeven;
if ($given_mask)
{
@ -828,7 +828,7 @@ sub my_hexnets
}
(my $curnet, my $maskbits) = split /\//, $elems[2];
my $bitstoeven = (4 - ($maskbits % 4));
if ($bitstoeven eq 4) { $bitstoeven = 0; }
if ($bitstoeven == 4) { $bitstoeven = 0; }
my $padbits = (32 - ($bitstoeven + $maskbits));
my $numchars = int(($maskbits + $bitstoeven) / 4);
my $curmask = 2**$maskbits - 1 << (32 - $maskbits);

View File

@ -1209,7 +1209,7 @@ sub get_host {
if ($tmpmtm eq $mtm and $tmpsn eq $sn and $tmptype eq $type) {
if ($oldnode =~ /^Server\-/) { #judge if need to change node's name
if ($oldnode =~ /(\-A)$/) {
$nodename = s/(\-A)$//;
$nodename =~ s/(\-A)$//;
# should send a warning here
$$flagref = 1;

View File

@ -1261,7 +1261,7 @@ sub check_nicips {
$nic = $nic_and_ips[0];
$nic_ip = $nic_and_ips[1];
if (exists $nics_hash{$nic} or $len ne 2) {
if (exists $nics_hash{$nic} or $len != 2) {
$errmsg = "The specified nicips is incorrect. It must be formatted correctly, in the form: <nic1>!<nic-ip1>,<nic2>!<nic-ip2>,...";
return (1, "", $errmsg);
}

View File

@ -1982,8 +1982,8 @@ sub web_summary {
while (my ($key, $value) = each(%{$attrs})) {
web_attrcount($value->[0]->{'os'}, \%oshash);
web_attrcount($value->[0]->{'arch'}, \%archhash);
web_attrcount($value->[0]->{'provmethod'},, \%provhash);
web_attrcount($value->[0]->{'nodetype'},, \%typehash);
web_attrcount($value->[0]->{'provmethod'}, \%provhash);
web_attrcount($value->[0]->{'nodetype'}, \%typehash);
}
$attrs = $nodelistTab->getNodesAttribs(\@nodes, ['status']);

View File

@ -182,7 +182,7 @@ if ((!$imagename) && (!$os)) {
}
}
if ($#oses eq -1) {
if ($#oses == -1) {
print "There are no OS repositories in $installdir. Please run copycds for the OS first.\n";
exit 1;
}
@ -260,7 +260,7 @@ if ((!$imagename) && (!$profile)) {
$seen{$f}++;
}
@profiles = sort keys %seen;
if ($#profiles eq -1) {
if ($#profiles == -1) {
print "There are no profiles in $::XCATROOT/share/xcat/netboot/$osfamily.\n";
exit 1;
}
@ -287,7 +287,7 @@ if ((!$imagename) && (!$profile)) {
$match = 1;
}
}
if ($match eq 1) {
if ($match == 1) {
last;
}
}

View File

@ -770,7 +770,7 @@ sub classful_networks_for_net_and_mask
my @results;
my $bitstoeven = (8 - ($mask % 8));
if ($bitstoeven eq 8) { $bitstoeven = 0; }
if ($bitstoeven == 8) { $bitstoeven = 0; }
my $resultmask = $mask + $bitstoeven;
if ($given_mask)
{
@ -828,7 +828,7 @@ sub my_hexnets
}
(my $curnet, my $maskbits) = split /\//, $elems[2];
my $bitstoeven = (4 - ($maskbits % 4));
if ($bitstoeven eq 4) { $bitstoeven = 0; }
if ($bitstoeven == 4) { $bitstoeven = 0; }
my $padbits = (32 - ($bitstoeven + $maskbits));
my $numchars = int(($maskbits + $bitstoeven) / 4);
my $curmask = 2**$maskbits - 1 << (32 - $maskbits);

View File

@ -826,7 +826,7 @@ if (
}
if ($::HELP) { &usage; exit; }
if (isHMC() && ($ENV{'DC_ENVIRONMENT'} ne 1))
if (isHMC() && ($ENV{'DC_ENVIRONMENT'} != 1))
{
print "mkresources is not supported on HMC.\n";
}

View File

@ -364,8 +364,10 @@ sub delete_user_account { #provide enough data to construct an /etc/passwd looki
}
}
=cut
=head3 add_user_account
example: add_user_account(username=>'fred',fullname=>'fred the great');
=cut
sub add_user_account {
@ -479,10 +481,11 @@ sub add_user_account {
return { password => $newpassword };
}
=cut
add_host_account
=head3 add_host_account
Arguments are in a hash:
node=>name of machine to add
=cut
sub add_host_account {

View File

@ -670,7 +670,7 @@ sub windows_net_cfg {
}
$interface_cfg .= '<IpAddress wcm:action="add" wcm:keyValue="' . $num++ . '">' . $ip . "/$netmask" . '</IpAddress>';
}
if ($num eq 1) {
if ($num == 1) {
# no correct IP with correct network is found
next;

View File

@ -417,7 +417,6 @@ sub deconfig {
(return code, message)
=cut
=cut
#--------------------------------------------------------------------------------
sub deconfigSNMP {
return (0, "");

View File

@ -406,7 +406,7 @@ sub processArgs
}
}
if (defined($::args) && @{$::args}) {
if (scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
if (scalar(@{$::args}) == 1 and $::args->[0] eq '-S')
{
if ($::command eq "lsdef") {
push @ARGV, "-t";
@ -3649,7 +3649,7 @@ sub defls
my @def_nodes = keys %defhash;
my $hidden_nodes = $listtab->getNodesAttribs(\@def_nodes, ['hidden']);
foreach my $n (keys %{$hidden_nodes}) {
if (defined($hidden_nodes->{$n}->[0]->{'hidden'}) && $hidden_nodes->{$n}->[0]->{'hidden'} eq 1) {
if (defined($hidden_nodes->{$n}->[0]->{'hidden'}) && $hidden_nodes->{$n}->[0]->{'hidden'} == 1) {
delete $defhash{$n};
}
}

View File

@ -5175,7 +5175,7 @@ sub chk_resolv_conf
last;
}
}
if (!$nfsvers || ($nfsvers eq 3))
if (!$nfsvers || ($nfsvers == 3))
{
my $ecmd = qq~/usr/sbin/rmnfsexp -d $install_dir/nim/resolv_conf/$resolv_conf_name/resolv.conf -B 2>/dev/null~;
xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $nimprime, $ecmd, 0);
@ -7426,7 +7426,7 @@ sub updatespot
chomp $sharedinstall;
if ($sharedinstall eq "sns") {
my $rc = xCAT::InstUtils->dolitesetup($image, \%imghash, \@nodelist, $callback, $subreq);
if ($rc eq 1) { # error
if ($rc == 1) { # error
my $rsp;
push @{ $rsp->{data} }, qq{Could not complete the statelite setup.};
xCAT::MsgUtils->message("E", $rsp, $callback);
@ -8796,7 +8796,7 @@ qq~mkdir -m 644 -p $install_dir/nim/scripts; cp $install_dir/postscripts/xcataix
last;
}
}
if (!$nfsvers || ($nfsvers eq 3))
if (!$nfsvers || ($nfsvers == 3))
{
# make sure we clean up the /etc/exports file of NFSv3 exports
my $ecmd = qq~/usr/sbin/rmnfsexp -d $install_dir/nim/scripts/xcataixscript -B 2>/dev/null~;
@ -11260,7 +11260,7 @@ sub mkdsklsnode
}
my $rc = xCAT::InstUtils->dolitesetup($image, \%imagehash, \@osinodes, $callback, $subreq);
if ($rc eq 1) { # error
if ($rc == 1) { # error
my $rsp;
push @{ $rsp->{data} }, qq{Could not complete the statelite setup.};
xCAT::MsgUtils->message("E", $rsp, $callback);
@ -12405,7 +12405,7 @@ sub mkdsklsnode
my $xcatmaster = $objhash{$tnode}{'xcatmaster'};
$xcatmasterhash{$xcatmaster} = 1;
}
if (scalar(keys %snhash) ne 2)
if (scalar(keys %snhash) != 2)
{
$setuphanfserr++;
my $rsp;
@ -12414,7 +12414,7 @@ sub mkdsklsnode
xCAT::MsgUtils->message("E", $rsp, $callback);
}
if (scalar(keys %xcatmasterhash) ne 1)
if (scalar(keys %xcatmasterhash) != 1)
{
my %masteriphash = ();
foreach my $master (keys %xcatmasterhash)
@ -12422,7 +12422,7 @@ sub mkdsklsnode
my $xcatmasterip = xCAT::NetworkUtils->getipaddr($master);
$masteriphash{$xcatmasterip} = 1;
}
if (scalar(keys %masteriphash) ne 1)
if (scalar(keys %masteriphash) != 1)
{
$setuphanfserr++;
my $rsp;

View File

@ -292,7 +292,7 @@ sub isallchassis {
}
foreach (1 .. 14) {
my $tmp = $session->get([ $bladexistsoid . ".$_" ]);
if ($tmp eq 1) { $bladesinchassis++ }
if ($tmp == 1) { $bladesinchassis++ }
}
my $count = keys %{ $mpahash{$mpa}->{nodes} };
if ($count >= $bladesinchassis) { $allinchassis++; return 1 }; #commands that affect entire are okayed, i.e eventlog clear
@ -498,7 +498,7 @@ m/Severity:(\S+)\s+Source:(\S+)\s+Name:\S*\s+Date:(\S+)\s+Time:(\S+)\s+Text:(.+)
$data = $session->set($varbind);
if ($session->{ErrorStr}) { return (1, $session->{ErrorStr}); }
$didchassis = 1;
if ($varbind->[2] eq 1) {
if ($varbind->[2] == 1) {
return 0, "eventlog cleared";
}
}
@ -1001,7 +1001,7 @@ sub vitals {
if (grep /temp/, @vitems) {
for my $idx (6 .. 20) {
if ($idx eq 11) {
if ($idx == 11) {
next;
}
push @bindlist, [ ".1.3.6.1.4.1.2.3.51.2.22.1.5.3.1.$idx", $slot ];
@ -1429,14 +1429,14 @@ sub populateblowervitals {
my $idx = $_->[1];
my $tmp_type = $_->[0];
$tmp_type =~ s/^.*\.(\d*)$/$1/;
if ($tmp_type eq 3) {
if ($tmp_type == 3) {
$blowerstats{$idx}->{percentage} = $_->[2];
$blowerstats{$idx}->{percentage} =~ s/^(\d*)%.*$/$1/;
} elsif ($tmp_type eq 4) {
} elsif ($tmp_type == 4) {
$blowerstats{$idx}->{state} = $_->[2];
} elsif ($tmp_type eq 5) {
} elsif ($tmp_type == 5) {
$blowerstats{$idx}->{rpm} = $_->[2];
} elsif ($tmp_type eq 6) {
} elsif ($tmp_type == 6) {
$blowerstats{$idx}->{cstate} = $_->[2];
}
}
@ -1525,7 +1525,7 @@ sub rscan {
foreach (1 .. 14) {
my $tmp = $session->get([ $bladexistsoid . ".$_" ]);
if ($tmp eq 1) {
if ($tmp == 1) {
my $type = $session->get([ $blademtmoid, $_ ]);
if ($session->{ErrorStr}) {
return (1, $session->{ErrorStr});
@ -3779,7 +3779,7 @@ sub bladecmd {
if ($slot > 0 and not $slot =~ /:/) {
my $tmp = $session->get([ $bladexistsoid . ".$slot" ]);
if ($session->{ErrorStr}) { return (1, $session->{ErrorStr}); }
unless ($tmp eq 1) { return (1, "Target bay empty"); }
unless ($tmp == 1) { return (1, "Target bay empty"); }
}
if ($command eq "rbeacon") {
return beacon(@args);

View File

@ -82,7 +82,7 @@ sub process_request
return 2;
}
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
return 2;
}

View File

@ -537,7 +537,7 @@ sub addnode
unless ($node_server) {
my @nxtsrvd = xCAT::NetworkUtils->my_ip_facing($node);
unless ($nxtsrvd[0]) { $nxtsrv = $nxtsrvd[1]; }
elsif ($nxtsrvd[0] eq 1) { $callback->({ error => [ $nxtsrvd[1] ] }); }
elsif ($nxtsrvd[0] == 1) { $callback->({ error => [ $nxtsrvd[1] ] }); }
else {
$callback->({ error => ["Unable to determine the tftpserver for $node"], errorcode => [1] });
return;

View File

@ -107,7 +107,7 @@ sub setstate {
my $ipfn;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
if ($ipfnd[0] eq 1) {
if ($ipfnd[0] == 1) {
$::callback->(
{
error => [ $ipfnd[1] ],
@ -115,7 +115,7 @@ sub setstate {
});
return;
}
elsif ($ipfnd[0] eq 2) {
elsif ($ipfnd[0] == 2) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};

View File

@ -110,7 +110,7 @@ sub ximport {
};
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}
@ -157,7 +157,7 @@ sub xexport {
};
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}

View File

@ -1172,7 +1172,7 @@ sub addkit
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}
@ -1508,7 +1508,7 @@ sub rmkit
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}
@ -1929,7 +1929,7 @@ sub addkitcomp
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}
@ -2481,7 +2481,7 @@ sub rmkitcomp
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}
@ -3403,7 +3403,7 @@ sub chkkitcomp
unless (defined($request->{arg})) { $xusage->(1); return; }
@ARGV = @{ $request->{arg} };
if ($#ARGV eq -1) {
if ($#ARGV == -1) {
$xusage->(1);
return;
}

View File

@ -3425,29 +3425,6 @@ sub guestcmd {
return rscan($node, @args);
}
=cut
} elsif ($command eq "rvitals") {
return vitals(@args);
} elsif ($command =~ /r[ms]preset/) {
return resetmp(@args);
} elsif ($command eq "rspconfig") {
return mpaconfig($mpa,$user,$pass,$node,$slot,@args);
} elsif ($command eq "rbootseq") {
return bootseq(@args);
} elsif ($command eq "switchblade") {
return switchblade(@args);
} elsif ($command eq "getmacs") {
return getmacs(@args);
} elsif ($command eq "rinv") {
return inv(@args);
} elsif ($command eq "reventlog") {
return eventlog(@args);
} elsif ($command eq "rscan") {
return rscan(\@args);
}
=cut
return (1, "$command not a supported command by kvm method");
}

View File

@ -290,7 +290,7 @@ sub parse_args {
#############################################
# Check for node range
#############################################
if (scalar(@ARGV) eq 1) {
if (scalar(@ARGV) == 1) {
my @nodes = xCAT::NodeRange::noderange(@ARGV);
foreach (@nodes) {
push @filternodes, $_;

View File

@ -701,7 +701,7 @@ sub parseLiteFiles {
my @res = grep { $_ =~ m/\Q$parent\E$/ } @entries;
my $found = scalar @res;
if ($found eq 1) { # $parent is found in @entries
if ($found == 1) { # $parent is found in @entries
# handle $res[0];
my @tmpresentry = split /\s+/, $res[0];
shift @tmpresentry;

View File

@ -108,7 +108,7 @@ sub setstate {
my $ipfn;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
if ($ipfnd[0] eq 1) {
if ($ipfnd[0] == 1) {
$::callback->(
{
error => [ $ipfnd[1] ],
@ -116,7 +116,7 @@ sub setstate {
});
return;
}
elsif ($ipfnd[0] eq 2) {
elsif ($ipfnd[0] == 2) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};

View File

@ -919,7 +919,7 @@ Usage:
}
if (@discoverednodes) {
unless ($long) {
push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE',, 'METHOD', 'MTM', 'SERIAL');
push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL');
}
foreach (@discoverednodes) {
push @{ $rsp->{data} }, "$_";

View File

@ -490,8 +490,8 @@ sub writeframe {
my $num1 = int((int($num) - $fnum) / $framesperhmc) + $umb;
my $num2 = length($$hmchash{'primary-start'}) - length($num1);
$FRAMESFP{$nn}{sfp} = $hmcbase . $num1 . $hmcattch if ($num2 <= 0);
$FRAMESFP{$nn}{sfp} = $hmcbase . '0' . $num1 . $hmcattch if ($num2 eq 1);
$FRAMESFP{$nn}{sfp} = $hmcbase . '00' . $num1 . $hmcattch if ($num2 eq 2);
$FRAMESFP{$nn}{sfp} = $hmcbase . '0' . $num1 . $hmcattch if ($num2 == 1);
$FRAMESFP{$nn}{sfp} = $hmcbase . '00' . $num1 . $hmcattch if ($num2 == 2);
}
$tables{'ppc'}->setNodesAttribs(\%FRAMESFP);
}
@ -533,10 +533,10 @@ sub writechildren {
} else {
$trange = 1;
}
$ranges{'A-0'} = $trange if ($tt eq 0);
$ranges{'A-1'} = $trange if ($tt eq 1);
$ranges{'B-0'} = $trange if ($tt eq 2);
$ranges{'B-1'} = $trange if ($tt eq 3);
$ranges{'A-0'} = $trange if ($tt == 0);
$ranges{'A-1'} = $trange if ($tt == 1);
$ranges{'B-0'} = $trange if ($tt == 2);
$ranges{'B-1'} = $trange if ($tt == 3);
$tt++;
}
if ($DELETENODES) {

View File

@ -2227,7 +2227,7 @@ sub sfsSLconfig
# dolitesetup to update the shared_root table files
# - updates files in the sopot and shared_root resour
my $rc = xCAT::InstUtils->dolitesetup($i, \%imghash, \@{ $osinodes{$i} }, $callback, $sub_req);
if ($rc eq 1) { # error
if ($rc == 1) { # error
my $rsp;
push @{ $rsp->{data} }, "Could not complete the statelite setup.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);

View File

@ -719,11 +719,11 @@ sub parseLiteFiles {
$parent .= "/" unless ($parent =~ m/\/$/);
@res = grep { $_ =~ m/\Q$parent\E$/ } @entries;
$found = scalar @res;
last if ($found eq 1);
last if ($found == 1);
$parent = dirname $parent;
}
if ($found eq 1) { # $parent is found in @entries
if ($found == 1) { # $parent is found in @entries
# handle $res[0];
my @tmpresentry = split /\s+/, $res[0];
shift @tmpresentry; # remove the imgname in @tmpresentry

View File

@ -1947,7 +1947,7 @@ sub nodels
foreach my $rnode (@$nodes) {
unless (defined($listHash->{$rnode}->[0]->{hidden})) {
push(@newnodes, $rnode);
} elsif ($listHash->{$rnode}->[0]->{hidden} ne 1) {
} elsif ($listHash->{$rnode}->[0]->{hidden} != 1) {
push(@newnodes, $rnode);
}
}
@ -2181,7 +2181,7 @@ sub nodels
foreach my $rnode (@nodes) {
unless (defined($listHash->{$rnode}->[0]->{hidden})) {
push(@newnodes, $rnode);
} elsif ($listHash->{$rnode}->[0]->{hidden} ne 1) {
} elsif ($listHash->{$rnode}->[0]->{hidden} != 1) {
push(@newnodes, $rnode);
}
}

View File

@ -586,29 +586,6 @@ sub guestcmd {
return getvmcons($node, @args);
}
=cut
} elsif ($command eq "rvitals") {
return vitals(@args);
} elsif ($command =~ /r[ms]preset/) {
return resetmp(@args);
} elsif ($command eq "rspconfig") {
return mpaconfig($mpa,$user,$pass,$node,$slot,@args);
} elsif ($command eq "rbootseq") {
return bootseq(@args);
} elsif ($command eq "switchblade") {
return switchblade(@args);
} elsif ($command eq "getmacs") {
return getmacs(@args);
} elsif ($command eq "rinv") {
return inv(@args);
} elsif ($command eq "reventlog") {
return eventlog(@args);
} elsif ($command eq "rscan") {
return rscan(\@args);
}
=cut
return (1, "$command not a supported command by xen method");
}

View File

@ -100,7 +100,7 @@ sub setstate {
my $ipfn;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
if ($ipfnd[0] eq 1) {
if ($ipfnd[0] == 1) {
$::YABOOT_callback->(
{
error => [ $ipfnd[1] ],
@ -108,7 +108,7 @@ sub setstate {
});
return;
}
elsif ($ipfnd[0] eq 2) {
elsif ($ipfnd[0] == 2) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};

View File

@ -171,7 +171,7 @@ foreach (@$output) {
if ($line =~ /^mic(\d+):/) {
$line =~ s/^mic(\d+):/MICMSG:$miccfg{$1}{'name'}:/;
}
print $line. "\n";
print $line . "\n";
}
}

View File

@ -127,7 +127,7 @@ until ($quit) {
my $strp = 0xf0;
my $archp = 0;
while ($strp < $#package) {
if ($package[$strp] eq 60) {
if ($package[$strp] == 60) {
$archp = $strp + 0x11;
last;
} else {
@ -240,12 +240,12 @@ until ($quit) {
}
if (($num - 5) % 16 eq 0) {
syslog("info", $msg);
print $msg. "\n";
print "$msg \n";
$msg = "";
}
$num++;
}
print $msg. "\n";
print "$msg \n";
}
}

View File

@ -54,7 +54,7 @@ sub getans {
$password = $rsp->{node}->[0]->{bmcpass}->[0];
if (exists $rsp->{node}->[0]->{error}) {
my $error = $rsp->{node}->[0]->{error}->[0];
print $error. "\n";
print "$error\n";
}
}
}

View File

@ -574,7 +574,7 @@ if (symlink($repo, "$path/repo") eq 0) {
exit;
}
if ($surrogate eq 1) {
if ($surrogate == 1) {
output("Creating tar");
my $tarme = "";
if (-d "$instroot/netboot/toolscenter") {

View File

@ -35,7 +35,7 @@ sub getVlanMask {
#foreach (@xs){
# print $_ . "\n";
#}
unless (scalar(@xs) eq 7) {
unless (scalar(@xs) == 7) {
print "Could not get vlan mask for $vlan\n";
}
@ -121,7 +121,7 @@ sub connectToSwitch {
#ERROR:
print "Failed to communicate with $switch\n";
print $SNMP::Session::ErrorStr . "\n";
print "$SNMP::Session::ErrorStr\n";
#xCAT::MsgUtils->message("S","Failed to communicate with $switch");
}
@ -259,7 +259,7 @@ sub addNodeToVlan {
#print Dumper($v2);
$session->set($v2);
if ($session->{ErrorStr}) {
print "Error! " . $session->{ErrorStr} . "\n";
print "Error! $session->{ErrorStr} \n";
}
#######################################

View File

@ -178,7 +178,7 @@ if ($DILIMITER) {
print "# Hostname:Status:Network-Interfaces:\n";
foreach (sort @statusoutput) {
print $_. ":\n";
print "$_ :\n";
}
exit 0;

View File

@ -1347,7 +1347,6 @@ else {
sub isGET { return uc($requestType) eq "GET"; }
sub isPost { return uc($requestType) eq "POST"; }
sub isPut { return uc($requestType) eq "PUT"; }
sub isPost { return uc($requestType) eq "POST"; }
sub isPatch { return uc($requestType) eq "PATCH"; }
sub isDelete { return uc($requestType) eq "DELETE"; }

View File

@ -1524,7 +1524,6 @@ else {
sub isGET { return uc($requestType) eq "GET"; }
sub isPost { return uc($requestType) eq "POST"; }
sub isPut { return uc($requestType) eq "PUT"; }
sub isPost { return uc($requestType) eq "POST"; }
sub isPatch { return uc($requestType) eq "PATCH"; }
sub isDelete { return uc($requestType) eq "DELETE"; }

View File

@ -444,7 +444,7 @@ sub Get_Files_Recursive
}
else
{ my $dirpath = $dir . '/' . $direntry . "\n";
print $dir. '/' . $direntry . "\n";
print $dirpath;
#print $dir."\n";
push(@filespath, glob("$dirpath"));