Fixed a bug that prevented install manifests from being saved.

Signed-off-by: digimer <mkelly@alteeve.ca>
This commit is contained in:
digimer 2024-05-28 14:27:16 -04:00
parent f08df75384
commit a3ac5cf7f8
2 changed files with 50 additions and 2 deletions

View File

@ -426,6 +426,14 @@ sub generate_manifest
my $subnet_value = $parameter->{$subnet_key} // $anvil->data->{cgi}{$subnet_key}{value};
my $gateway_key = $network_name."_gateway";
my $gateway_value = $parameter->{$gateway_key} // $anvil->data->{cgi}{$gateway_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:network_key' => $network_key,
's2:network_value' => $network_value,
's3:subnet_key' => $subnet_key,
's4:subnet_value' => $subnet_value,
's5:gateway_key' => $gateway_key,
's6:gateway_value' => $gateway_value,
}});
$manifest_xml .= ' <network name="'.$network_name.'" network="'.$network_value.'" subnet="'.$subnet_value.'" gateway="'.$gateway_value.'" />'."\n";
@ -435,6 +443,10 @@ sub generate_manifest
# Record the network
my $ip_key = $machine."_".$network_name."_ip";
my $ip_value = ($parameter->{$ip_key} // $anvil->data->{cgi}{$ip_key}{value}) // "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:ip_key' => $ip_key,
's2:ip_value' => $ip_value,
}});
$machines->{$machine}{network}{$network_name} = $ip_value;
@ -444,6 +456,10 @@ sub generate_manifest
# Get the IP.
my $ipmi_ip_key = $machine."_ipmi_ip";
my $ipmi_ip_value = ($parameter->{$ipmi_ip_key} // $anvil->data->{cgi}{$ipmi_ip_key}{value}) // "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:ipmi_ip_key' => $ipmi_ip_key,
's2:ipmi_ip_value' => $ipmi_ip_value,
}});
$machines->{$machine}{ipmi_ip} = $ipmi_ip_value;
@ -452,6 +468,10 @@ sub generate_manifest
{
my $ups_key = $machine."_ups_".$ups_name;
my $ups_value = ($parameter->{$ups_key} // $anvil->data->{cgi}{$ups_key}{value}) // "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:ups_key' => $ups_key,
's2:ups_value' => $ups_value,
}});
$machines->{$machine}{ups}{$ups_name} = $ups_value ? "1" : "0";
}
@ -461,6 +481,10 @@ sub generate_manifest
{
my $fence_key = $machine."_fence_".$fence_name;
my $fence_value = ($parameter->{$fence_key} // $anvil->data->{cgi}{$fence_key}{value}) // "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:fence_key' => $fence_key,
's2:fence_value' => $fence_value,
}});
$machines->{$machine}{fence}{$fence_name} = $fence_value;
}
@ -538,6 +562,7 @@ sub generate_manifest
manifest_name => $anvil_name,
manifest_xml => $manifest_xml,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manifest_uuid => $manifest_uuid }});
return($manifest_uuid, $anvil_name);
}

View File

@ -861,6 +861,7 @@ sub create_manifest
$anvil->Database->get_fences({debug => 2});
# This is common for all Anvil! systems we might be building
### CGI is legacy
$anvil->data->{cgi}{prefix}{value} = $anvil->data->{base}{prefix};
$anvil->data->{cgi}{domain}{value} = $anvil->data->{base}{domain};
$anvil->data->{cgi}{mtu}{value} = $anvil->data->{base}{mtu};
@ -874,6 +875,19 @@ sub create_manifest
"cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value},
}});
my $network_dns = $anvil->data->{base}{dns};
my $domain = $anvil->data->{base}{domain};
my $network_mtu = $anvil->data->{base}{mtu};
my $network_ntp = $anvil->data->{base}{ntp};
my $name_prefix = $anvil->data->{base}{prefix};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
network_dns => $network_dns,
domain => $domain,
network_mtu => $network_mtu,
network_ntp => $network_ntp,
name_prefix => $name_prefix,
}});
foreach my $anvil_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}})
{
$anvil->data->{cgi}{sequence}{value} = $anvil_number;
@ -1055,8 +1069,17 @@ sub create_manifest
}
}
}
# Now generate the manifest.
my ($manifest_uuid, $manifest_name) = $anvil->Striker->generate_manifest({debug => 2});
my ($manifest_uuid, $manifest_name) = $anvil->Striker->generate_manifest({
debug => 2,
network_dns => $network_dns,
domain => $domain,
network_mtu => $network_mtu,
network_ntp => $network_ntp,
name_prefix => $name_prefix,
padded_sequence => $padded_sequence,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
manifest_uuid => $manifest_uuid,
manifest_name => $manifest_name,