Merge pull request #785 from srvg/bug/openiscsi-emptylist
open_iscsi: return devicenodes as empty list if no LUN's
This commit is contained in:
commit
aa747818d9
1 changed files with 23 additions and 26 deletions
|
@ -108,6 +108,7 @@ import time
|
|||
|
||||
ISCSIADM = 'iscsiadm'
|
||||
|
||||
|
||||
def compare_nodelists(l1, l2):
|
||||
|
||||
l1.sort()
|
||||
|
@ -206,9 +207,6 @@ def target_device_node(module, target):
|
|||
# a given target...
|
||||
|
||||
devices = glob.glob('/dev/disk/by-path/*%s*' % target)
|
||||
if len(devices) == 0:
|
||||
return None
|
||||
else:
|
||||
devdisks = []
|
||||
for dev in devices:
|
||||
# exclude partitions
|
||||
|
@ -333,17 +331,17 @@ def main():
|
|||
result['nodes'] = nodes
|
||||
|
||||
if login is not None:
|
||||
loggedon = target_loggedon(module,target)
|
||||
loggedon = target_loggedon(module, target)
|
||||
if (login and loggedon) or (not login and not loggedon):
|
||||
result['changed'] |= False
|
||||
if login:
|
||||
result['devicenodes'] = target_device_node(module,target)
|
||||
result['devicenodes'] = target_device_node(module, target)
|
||||
elif not check:
|
||||
if login:
|
||||
target_login(module, target)
|
||||
# give udev some time
|
||||
time.sleep(1)
|
||||
result['devicenodes'] = target_device_node(module,target)
|
||||
result['devicenodes'] = target_device_node(module, target)
|
||||
else:
|
||||
target_logout(module, target)
|
||||
result['changed'] |= True
|
||||
|
@ -371,7 +369,6 @@ def main():
|
|||
module.exit_json(**result)
|
||||
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
|
|
Loading…
Reference in a new issue