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.
pull/67544/head
Nijin Ashok 4 years ago committed by GitHub
parent 0f56ac018b
commit 214bf8dc0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save