bcd: make recovery modifications optional

Ignore recovery disable if no Recovery node is found in the BCD.
master v1.3.2-19
Alejandro Sirgo Rica 2024-09-10 15:00:04 +02:00
parent 084650e4b1
commit f31e55fea4
1 changed files with 5 additions and 1 deletions

View File

@ -85,7 +85,11 @@ def _match_node_with_type_data(hive, entry_node):
def disable_recovery_field(hive, entry_node):
recovery_node = get_node_child_from_path(hive, entry_node, f'Elements/{BCDEntryElement.RECOVERY_ENABLED.value}')
try:
recovery_node = get_node_child_from_path(hive, entry_node, f'Elements/{BCDEntryElement.RECOVERY_ENABLED.value}')
except:
logging.info("no Recovery entry is found, skipping")
return
recovery_value = {'key': 'Element', 't': RegistryType.BINARY.value, 'value': b'\x00'}
hive.node_set_value(recovery_node, recovery_value)