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.
This commit is contained in:
Nijin Ashok 2020-02-18 23:26:15 +05:30 committed by GitHub
parent 0f56ac018b
commit 214bf8dc0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'),
)
],
),