From 0a3621981c81a6c1844aa3c09674bcc81130167e Mon Sep 17 00:00:00 2001 From: ma Date: Tue, 5 Nov 2024 14:53:50 +0100 Subject: [PATCH] fix types --- libvirtnbdbackup/restore/disk.py | 2 +- libvirtnbdbackup/restore/vmconfig.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libvirtnbdbackup/restore/disk.py b/libvirtnbdbackup/restore/disk.py index 86429a91..e41bde39 100644 --- a/libvirtnbdbackup/restore/disk.py +++ b/libvirtnbdbackup/restore/disk.py @@ -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 diff --git a/libvirtnbdbackup/restore/vmconfig.py b/libvirtnbdbackup/restore/vmconfig.py index 6f8e4acc..bf4b0690 100644 --- a/libvirtnbdbackup/restore/vmconfig.py +++ b/libvirtnbdbackup/restore/vmconfig.py @@ -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] @@ -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]