From f2e5e6de23692d7fd7804d2a16ad6a8883917c71 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Thu, 10 Oct 2019 10:32:00 +0200 Subject: [PATCH] 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(). --- lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index 47abe608d33..8974c7e46d7 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -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