@@ -339,17 +339,16 @@ void AnswerFile::loadNetwork(
339339 network.con_interface = m_keyfile.getString (networkSection, " interface" );
340340 convertNetworkAddressAndValidate (
341341 networkSection, " ip_address" , network.con_ip_addr );
342- network.con_mac_addr = m_keyfile.getString (networkSection, " mac_address" );
342+ network.con_mac_addr = m_keyfile.getString (networkSection, " mac_address" , " " );
343343 convertNetworkAddressAndValidate (
344344 networkSection, " subnet_mask" , network.subnet_mask );
345- network.domain_name = m_keyfile.getString (networkSection, " domain_name" );
345+ network.domain_name = m_keyfile.getString (networkSection, " domain_name" , " " );
346346 convertNetworkAddressAndValidate (
347347 networkSection, " gateway" , network.gateway );
348348
349- if (m_keyfile.getStringOpt (networkSection, " nameservers" )) {
349+ if (auto opt = m_keyfile.getStringOpt (networkSection, " nameservers" )) {
350350 std::vector<std::string> nameservers;
351- boost::split (nameservers,
352- m_keyfile.getString (networkSection, " nameservers" ),
351+ boost::split (nameservers, opt.value (),
353352 boost::is_any_of (" , " ), boost::token_compress_on);
354353
355354 network.nameservers = nameservers;
@@ -431,6 +430,7 @@ void AnswerFile::loadSystemSettings()
431430AFNode AnswerFile::loadNode (const std::string& section)
432431{
433432 AFNode node;
433+ LOG_DEBUG (" Loading node {}" , section);
434434
435435 if (section == " node" ) {
436436 node.prefix = m_keyfile.getString (section, " prefix" );
@@ -451,16 +451,19 @@ AFNode AnswerFile::loadNode(const std::string& section)
451451 }
452452 }
453453
454- node.hostname = m_keyfile.getString (section, " hostname" );
455- node.root_password = m_keyfile.getString (section, " node_root_password" );
456- node.sockets = m_keyfile.getString (section, " sockets" );
457- node.cores_per_socket = m_keyfile.getString (section, " cores_per_socket" );
458- node.threads_per_core = m_keyfile.getString (section, " threads_per_core" );
459- node.bmc_address = m_keyfile.getString (section, " bmc_address" );
460- node.bmc_username = m_keyfile.getString (section, " bmc_username" );
461- node.bmc_password = m_keyfile.getString (section, " bmc_password" );
462- node.bmc_serialport = m_keyfile.getString (section, " bmc_serialport" );
463- node.bmc_serialspeed = m_keyfile.getString (section, " bmc_serialspeed" );
454+ // Initialize with empty strings if the values are not found, the remaining
455+ // of the code is assuming that
456+ node.hostname = m_keyfile.getString (section, " hostname" , " " );
457+ node.root_password = m_keyfile.getString (section, " node_root_password" , " " );
458+ node.sockets = m_keyfile.getString (section, " sockets" , " " );
459+ node.cores_per_socket = m_keyfile.getString (section, " cores_per_socket" , " " );
460+ node.threads_per_core = m_keyfile.getString (section, " threads_per_core" , " " );
461+ node.bmc_address = m_keyfile.getString (section, " bmc_address" , " " );
462+ node.bmc_username = m_keyfile.getString (section, " bmc_username" , " " );
463+ node.bmc_password = m_keyfile.getString (section, " bmc_password" , " " );
464+ node.bmc_serialport = m_keyfile.getString (section, " bmc_serialport" , " " );
465+ node.bmc_serialspeed = m_keyfile.getString (section, " bmc_serialspeed" , " " );
466+ LOG_DEBUG (" Node loaded {}" , section);
464467
465468 return node;
466469}
@@ -503,10 +506,10 @@ void AnswerFile::loadNodes()
503506 nodelist | std::views::filter (is_node_number)) {
504507 auto nodeCounter = node_counter (nodeSection);
505508
506- LOG_TRACE (" Configure {}" , nodeSection)
507509 AFNode newNode = loadNode (nodeSection);
508510
509511 if (newNode.hostname ->empty ()) {
512+ LOG_DEBUG (" Node configured {}" , newNode.hostname .value ());
510513 if (generic.prefix ->empty ()) {
511514 throw std::invalid_argument (
512515 fmt::format (" Section node.{} must have a 'hostname' key or "
0 commit comments