Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

vmdkops_admin CLI: tenant_access_add/tenant_access_set runs into "IndexError: list index out of range" while using inexistent datastore name #868

Closed
shuklanirdesh82 opened this issue Jan 20, 2017 · 1 comment

Comments

@shuklanirdesh82
Copy link
Contributor

Steps to reproduce (The reported issue can be reproduced easily)

  1. create tenant T1 and make sure tenant is created successfully
    vmdkops_admin.py tenant create --name T9
  2. add datastore access rule to T1 by passing inexistent datastore name
vmdkops_admin.py tenant access add --name T9 --datastore d1
  1. proper error message should be observed like we get for invalid tenant name Tenant T99 does not exist
  2. repeat step#2 by correcting the datastore name
  3. make sure the datastore rule has been added to tenant
  4. update access rule for the recently added datastore to T1 by passing non-exist datastore name
  5. expects a valid error/exception

Current behavior: step#2 and step#6 runs into following exception instead of a valid message.

On ESX: when T9 is a valid tenant name and 'd1' is non-exist datastore name

[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access add --name T9 --datastore d1
Traceback (most recent call last):
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 968, in <module>
    main()
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 46, in main
    args.func(args)
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 907, in tenant_access_add
    volume_totalsize=args.volume_totalsize
  File "/usr/lib/vmware/vmdkops/Python/auth_api.py", line 373, in _tenant_access_add
    volume_totalsize=volume_totalsize)
  File "/usr/lib/vmware/vmdkops/Python/auth_api.py", line 147, in generate_privileges
    datastore_url = vmdk_utils.get_datastore_url(datastore)
  File "/usr/lib/vmware/vmdkops/Python/vmdk_utils.py", line 316, in get_datastore_url
    return res[0]
IndexError: list index out of range

/CC @kerneltime @tusharnt @ashahi1

@pdhamdhere pdhamdhere added this to the v1 GA milestone Feb 1, 2017
@pdhamdhere pdhamdhere modified the milestones: 0.12, v1 GA Feb 9, 2017
@lipingxue lipingxue assigned pshahzeb and unassigned lipingxue and pshahzeb Feb 15, 2017
@pshahzeb
Copy link
Contributor

This is fixed. See the output below in case of non existing datastore.

[root@sc-rdops-vm04-dhcp-106-149:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access add --name T9 --datastore d134234
Datastore d134234 does not exist

Tried both steps 2 and 6 mentioned in description.

Relevant calls to check datastore existence in both tenant_access_add and tenant_access_set
as follows:

    error_info = check_datastore(datastore)
    if error_info:
        return error_info

This was fixed in #859

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

4 participants