sodafoundation / api

SODA Terra Project API module : is an open source implementation of SODA API connecting storage to platforms like Kubernetes, OpenStack, and VMware
Apache License 2.0
828 stars 314 forks source link

Create Host from CLI throws error which is not proper #1291

Open kumarashit opened 4 years ago

kumarashit commented 4 years ago

Issue/Feature Description: Create Host using osdsctl with wrong parameter value. This throws error releated to JSON format. Now this error is not very intuitive for user to understand Why this issue to fixed / feature is needed(give scenarios or use cases): For better error response. How to reproduce, in case of a bug: Using CLI try to create Host

--osType Linux
ERROR: Request body has an error: doesn't match the schema: Error at "/osType":JSON value is not one of the allowed values
root@aks-VirtualBox:~/gopath/src/github.com/sodafoundation/installer/ansible# osdsctl host create ash-host1 --ip 127.0.0.1 --availabilityZones default --accessMode RW --osType linux
ERROR: Request body has an error: doesn't match the schema: Error at "/accessMode":JSON value is not one of the allowed values
root@aks-VirtualBox:~/gopath/src/github.com/sodafoundation/installer/ansible# osdsctl host create ash-host1 --ip 127.0.0.1 --availabilityZones default --accessMode rw --osType linux
ERROR: Request body has an error: doesn't match the schema: Error at "/accessMode":JSON value is not one of the allowed values

Other Notes / Environment Information: (Please give the env information, log link or any useful information for this issue) Correct format is:

root@aks-VirtualBox:~/gopath/src/github.com/sodafoundation/installer/ansible# osdsctl host create ash-host1 --ip 127.0.0.1 --availabilityZones default --osType linux+-------------------+--------------------------------------+
| Property          | Value                                |
+-------------------+--------------------------------------+
| Id                | 88f9823e-32ac-4aec-a660-8a56e2f16cb4 |
| CreatedAt         | 2020-06-13T19:49:44                  |
| UpdatedAt         |                                      |
| HostName          | ash-host1                            |
| OsType            | linux                                |
| AccessMode        | agentless                            |
| IP                | 127.0.0.1                            |
| Port              | 0                                    |
| Username          |                                      |
| AvailabilityZones | [default]                            |
| Initiators        | null                                 |
|                   |                                      |
+-------------------+--------------------------------------+
root@aks-VirtualBox:~/gopath/src/github.com/sodafoundation/installer/ansible#
PravinRanjan10 commented 4 years ago

@PravinRanjan10 plz check it