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

Modify the default consoleondemand based on the global setting

This commit fix the bug that consoleondemand works incorrectly.
This commit is contained in:
chenglch
2017-12-08 11:41:00 +08:00
parent ddeb14f358
commit 77b1757352

View File

@ -227,7 +227,12 @@ sub gen_request_data {
my ($cons_map, $siteondemand) = @_;
my (@openbmc_nodes, $data);
while (my ($k, $v) = each %{$cons_map}) {
my $ondemaind = \1;
my $ondemand;
if ($siteondemand) {
$ondemand = \1;
} else {
$ondemand = \0;
}
my $cmd;
my $cmeth = $v->{cons};
if ($cmeth eq "openbmc") {
@ -248,14 +253,14 @@ sub gen_request_data {
}
if (defined($v->{consoleondemand})) {
# consoleondemand attribute for node can be "1", "yes", "0" and "no"
if ((($v->{consoleondemand} eq "1") || lc($v->{consoleondemand}) eq "yes") && !$siteondemand) {
$ondemaind = \1;
if (($v->{consoleondemand} eq "1") || lc($v->{consoleondemand}) eq "yes") {
$ondemand = \1;
}
elsif ((($v->{consoleondemand} eq "0") || lc($v->{consoleondemand}) eq "no") && $siteondemand) {
$ondemaind = \0;
elsif (($v->{consoleondemand} eq "0") || lc($v->{consoleondemand}) eq "no") {
$ondemand = \0;
}
}
$data->{$k}->{ondemand} = $ondemaind;
$data->{$k}->{ondemand} = $ondemand;
}
if (@openbmc_nodes) {
my $passwd_table = xCAT::Table->new('passwd');