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

Lower case input "true" passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" is misinterpreted as false. #918

Closed
shuklanirdesh82 opened this issue Feb 16, 2017 · 0 comments · Fixed by #968

Comments

@shuklanirdesh82
Copy link
Contributor

vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE fails to validate input value for ALLOW_VALUE; while setting a datastore-tenant access with such value operation always succeed.

Tested with latest from master

[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py status
Version: 0.10.e7acd33-0.0.1

Steps to reproduce:

  1. Create Tenant T1
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant create --name T1
tenant create succeeded
  1. Validate Tenant is created successfully
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant ls
  1. make sure there is no access set for the tenant
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access ls --name T1
Datastore  Allow_create  Max_volume_size  Total_size  
---------  ------------  ---------------  ----------
  1. Add valid datastore access to T1
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access add --allow-create --name=T1 --datastore=TestDatastore
tenant access add succeeded
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access ls --name T1
Datastore      Allow_create  Max_volume_size  Total_size  
-------------  ------------  ---------------  ----------  
TestDatastore  True          Unset            Unset     
  1. Perform following steps
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access set --allow-create true --name T1 --datastore=TestDatastore
tenant access set succeeded
[root@promc-2n-dhcp105-97:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py tenant access ls --name T1
Datastore      Allow_create  Max_volume_size  Total_size  
-------------  ------------  ---------------  ----------  
TestDatastore  False         Unset            Unset      

While performing the above steps, step#5 leads to the confusion, it says tenant access set succeeded and sets --allow-create to False even though value has been passed at true.

If ALLOW_CREATE is case sensitive then tenant access set invocation should be failed rather saying succeeded in our scenario.

@shuklanirdesh82 shuklanirdesh82 added this to the 0.13 milestone Feb 16, 2017
@shuklanirdesh82 shuklanirdesh82 changed the title Need to handle vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE correctly if it is having case sensitivity (fails to validate input value for ALLOW_VALUE) Need to handle "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" correctly if it is having case sensitivity (fails to validate input value for "ALLOW_VALUE") Feb 16, 2017
@tusharnt tusharnt modified the milestones: 0.13, 0.12 Feb 16, 2017
@tusharnt tusharnt changed the title Need to handle "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" correctly if it is having case sensitivity (fails to validate input value for "ALLOW_VALUE") Input passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" should be case insensitive Feb 16, 2017
@tusharnt tusharnt added the P0 label Feb 16, 2017
@tusharnt tusharnt changed the title Input passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" should be case insensitive If lower case input "true" passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" is misinterpreted as false. Feb 16, 2017
@tusharnt tusharnt changed the title If lower case input "true" passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" is misinterpreted as false. Lower case input "true" passed to "vmdkops_admin.py tenant access set --allow-create ALLOW_CREATE" is misinterpreted as false. Feb 16, 2017
@tusharnt tusharnt assigned pshahzeb and unassigned lipingxue Feb 23, 2017
pshahzeb pushed a commit that referenced this issue Feb 24, 2017
1. Accepting case insensitive true/false values for allow-create option to
   set access for tenants. But throwing error for invalid values for allow-create option

Testing:
Added test cases for case insensitive true/false values as well as invalid value
Manual testing done

Resolves: #918
shuklanirdesh82 pushed a commit that referenced this issue Feb 28, 2017
* Handling case insensitivity for tenant access allow-create option

1. Accepting case insensitive true/false values for allow-create option to
   set access for tenants. But throwing error for invalid values for allow-create option

Testing:
Added test cases for case insensitive true/false values as well as invalid value
Manual testing done

Resolves: #918

* Validating the tenant access set allow-create in auth_api

1. Moved the validatin logic to auth_api to be applied when invoked from
both Admin CLI and VMODL

2. Modifying test cases to be hit by vmdkops_admin tenant_access_set api

* 1. Adding allow_create validation to tenant_access_add

2. Correcting vmodl tests to allow optional allow_create parameter

3. Code cleaning

* Code cleaning and reverting vmdk_ops_test

* 1. Removing redundant test code and modifying comments
2. Updating help for admin tenant access set --allow-create option

* Proper message check for invalid input to tenant access set allow_create option
shuklanirdesh82 pushed a commit that referenced this issue Mar 2, 2017
* Handling case insensitivity for tenant access allow-create option

1. Accepting case insensitive true/false values for allow-create option to
   set access for tenants. But throwing error for invalid values for allow-create option

Testing:
Added test cases for case insensitive true/false values as well as invalid value
Manual testing done

Resolves: #918

* Validating the tenant access set allow-create in auth_api

1. Moved the validatin logic to auth_api to be applied when invoked from
both Admin CLI and VMODL

2. Modifying test cases to be hit by vmdkops_admin tenant_access_set api

* 1. Adding allow_create validation to tenant_access_add

2. Correcting vmodl tests to allow optional allow_create parameter

3. Code cleaning

* Code cleaning and reverting vmdk_ops_test

* 1. Removing redundant test code and modifying comments
2. Updating help for admin tenant access set --allow-create option

* Proper message check for invalid input to tenant access set allow_create option
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
4 participants