IBM / lmctl

Cloud Pak for Network Automation (CP4NA) (previously ALM/TNCO) command line tool
Apache License 2.0
4 stars 19 forks source link

LMCTL issue with resource driver add localizedMessage': "Required String parameter 'type' is not present", 'details': {}} #141

Open chiragggupta90 opened 2 years ago

chiragggupta90 commented 2 years ago

Describe the bug Unable to add resource driver with lmctl. getting Error: localizedMessage': "Required String parameter 'type' is not present", 'details': {}}

To Reproduce Steps to reproduce the behaviour: LMCTL version: lmctl, version 3.2.2 Expected behaviour resource driver should be added

Screenshots Getting below error if adding resources: root@ibm:/home# lmctl resourcedriver add --type ansible --url https://ansible-lifecycle-driver:8293 default --certificate ald-tls.pem TNCO error occurred: Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}}

Desktop (please complete the following information):

Additional context

LMCT ping: root@ibm:/home# lmctl ping env Pinging CP4NA orchestration: http://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com | Test Name | Result | Error | |------------------+----------+---------| | Descriptors | OK | | | Topology | OK | | | Behaviour | OK | | | Resource Manager | OK | | CP4NA orchestration tests passed! ✅

root@ibm:/home# python2 --version Python 2.7.17

locale: root@ibm:/home# locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

lmctl logs: lmctl.drivers.lm.base.LmDriverException: Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}} 2022-05-17 15:05:08,387 - lmctl.cli.safety_net - ERROR - Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}} Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/lmctl/cli/commands/resourcedriver.py", line 53, in add resource_driver = resource_mgmt_driver.add_resource_driver(new_resource_driver) File "/usr/local/lib/python3.6/dist-packages/lmctl/drivers/lm/resourcedriver.py", line 35, in add_resource_driver self._raise_unexpected_status_exception(response) File "/usr/local/lib/python3.6/dist-packages/lmctl/drivers/lm/base.py", line 36, in _raise_unexpected_status_exception raise LmDriverException(error_msg) lmctl.drivers.lm.base.LmDriverException: Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}} 2022-05-17 15:05:08,387 - lmctl.cli.safety_net - ERROR - Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}} Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/lmctl/cli/commands/resourcedriver.py", line 53, in add resource_driver = resource_mgmt_driver.add_resource_driver(new_resource_driver) File "/usr/local/lib/python3.6/dist-packages/lmctl/drivers/lm/resourcedriver.py", line 35, in add_resource_driver self._raise_unexpected_status_exception(response) File "/usr/local/lib/python3.6/dist-packages/lmctl/drivers/lm/base.py", line 36, in _raise_unexpected_status_exception raise LmDriverException(error_msg) lmctl.drivers.lm.base.LmDriverException: Request returned unexpected error: status_code=400, message={'url': 'https://cp4na-o-ishtar-cp4na.apps.ocp4.arcnt.com/api/resource-manager/resource-drivers', 'localizedMessage': "Required String parameter 'type' is not present", 'details': {}}

dvaccarosenna commented 2 years ago

The error response here is normally only returned by GET requests on that API so it appears like the POST request is being redirected (and redirects always use GET). The redirect will fail as none of the parameters expected on a GET will have been provided in the initial request (as expected).

Is your lmctl config file configured with the correct address for your environment? Has the https protocol been used or has http been used? If http, this will likely be causing the redirect.