From 214bf8dc0bd40388cab0b56ae24098785fd5454d Mon Sep 17 00:00:00 2001 From: Nijin Ashok Date: Tue, 18 Feb 2020 23:26:15 +0530 Subject: [PATCH] Fix KeyError for iSCSI parameters (#67463) The required parameters for the LUN mapping for destination LUN is address, port and iqn. However if the user doesn't pass parameters like CHAP authentication parameters, we will get KeyError. The patch fixes the same. --- lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index ade2f1d230a..b02cc864492 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -2207,13 +2207,13 @@ def _get_lun_mappings(module): ['iscsi', 'fcp']) else None, logical_units=[ otypes.LogicalUnit( - id=lunMapping['dest_logical_unit_id'], - port=lunMapping['dest_logical_unit_port'], - portal=lunMapping['dest_logical_unit_portal'], - address=lunMapping['dest_logical_unit_address'], - target=lunMapping['dest_logical_unit_target'], - password=lunMapping['dest_logical_unit_password'], - username=lunMapping['dest_logical_unit_username'], + id=lunMapping.get('dest_logical_unit_id'), + port=lunMapping.get('dest_logical_unit_port'), + portal=lunMapping.get('dest_logical_unit_portal'), + address=lunMapping.get('dest_logical_unit_address'), + target=lunMapping.get('dest_logical_unit_target'), + password=lunMapping.get('dest_logical_unit_password'), + username=lunMapping.get('dest_logical_unit_username'), ) ], ),