Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Nov 5, 2024
1 parent b099a16 commit 0a36219
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libvirtnbdbackup/restore/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ def restore( # pylint: disable=too-many-branches

if args.adjust_config is True:
restConfig = vmconfig.removeUuid(restConfig.decode())
restConfig = vmconfig.setVMName(args, restConfig)
restConfig = vmconfig.setVMName(args, restConfig.decode())

return restConfig
3 changes: 1 addition & 2 deletions libvirtnbdbackup/restore/vmconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def removeUuid(vmConfig: str) -> bytes:
"""Remove the auto generated UUID from the config file to allow
for restore into new name"""
tree = xml.asTree(vmConfig)

try:
logging.info("Removing uuid setting from vm config.")
uuid = tree.xpath("uuid")[0]
Expand All @@ -65,7 +64,7 @@ def removeUuid(vmConfig: str) -> bytes:
return xml.ElementTree.tostring(tree, encoding="utf8", method="xml")


def setVMName(args: Namespace, vmConfig: bytes) -> bytes:
def setVMName(args: Namespace, vmConfig: str) -> bytes:
"""Change / set the VM name to be restored"""
tree = xml.asTree(vmConfig)
name = tree.xpath("name")[0]
Expand Down

0 comments on commit 0a36219

Please sign in to comment.