From: Ondrej Lichtner <olichtne(a)redhat.com>
This is mostly important for printing DeviceResult objects which can
happen after a recipe execution when the device doesn't exist anymore.
In such a case the name attribute can't be accessed and throws an
exception.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Devices/RemoteDevice.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Devices/RemoteDevice.py b/lnst/Devices/RemoteDevice.py
index 652e193..f11fa65 100644
--- a/lnst/Devices/RemoteDevice.py
+++ b/lnst/Devices/RemoteDevice.py
@@ -164,7 +164,7 @@ class RemoteDevice(object):
for k, v in [
("machine", self._machine.get_id()),
("id", self._id),
- ("name", self.name),
+ ("name", self.name if not self.deleted else
"<deleted>"),
("ifindex", self.ifindex),
]
]
--
2.23.0