ovirt_vm: Fix getting console parameter (#63325)

Previously if the ovirt_vm module was executed without graphical_console
parameter, the task failed with "NoneType has no attribute 'get'". The
problem was that we obtained the graphical_console by
self.param('graphical_console', dict()), which returned None, in case
graphical_console is not passed instead of empty dict. So we must
change the line to self.param('graphical_console') or dict().
This commit is contained in:
Ondra Machacek 2019-10-10 10:32:00 +02:00 committed by ansibot
parent 38d1025d58
commit f2e5e6de23

View file

@ -1387,7 +1387,7 @@ class VmsModule(BaseModule):
template = self.__get_template_with_version()
cluster = self.__get_cluster()
snapshot = self.__get_snapshot()
display = self.param('graphical_console', dict())
display = self.param('graphical_console') or dict()
disk_attachments = self.__get_storage_domain_and_all_template_disks(template)
@ -1592,7 +1592,7 @@ class VmsModule(BaseModule):
cpu_mode = getattr(entity.cpu, 'mode')
vm_display = entity.display
provided_vm_display = self.param('graphical_console', {})
provided_vm_display = self.param('graphical_console') or dict()
return (
check_cpu_pinning() and
check_custom_properties() and