Hello All,
I have a playbook that is using the cp_mgmt_run_script module. The following error is returned when the playbook is run.
TASK [run-script] ****************************************************************************************************************
fatal: [10.1.2.51]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": {" code": "generic_err_invalid_parameter", "message": "ERROR: Failed to handle asynchronous tasks as synchronous, tasks result is und efined.\nInvalid parameter for [task-id]. Invalid value"}}
The task actually runs successfully against the target gateway, the task appears in the SmartConsole task list and returns the expected result.
Excerpt from $FWDIR/log/api.elg
---------------------------
ID: 14684
Response-Code: 400
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Thu, 23 Jul 2020 23:57:15 GMT]}
Payload: {
"code" : "generic_err_invalid_parameter",
"message" : "Invalid parameter for [task-id]. Invalid value"
}
--------------------------------------
2020-07-23 23:57:17,419 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp1325351680-37] - Inbound Message
----------------------------
ID: 14685
Address: http://127.0.0.1:50276/web_api/show-task
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {accept-encoding=[identity], connection=[keep-alive], Content-Length=[114], content-type=[application/json], Host=[127.0.0.1:50276], User-Agent=[Python-urllib/2.7], X-Chkp-Sid=[8b04d47571c316b5c41d763d30263ffe], X-Forwarded-For=[10.1.7.110], X-Forwarded-Host=[10.1.2.51:443], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[10.1.2.51]}
Payload: {"task-id": {"task-id": "01466935-7a42-4478-89bd-d38019364e0b", "target": "26db824a-f9a9-436b-a826-9899f41c8c4e"}}
--------------------------------------
2020-07-23 23:57:17,425 WARN com.checkpoint.management.web_api_is.utils.helpers.RequestHeadersHelper.getMediaType_aroundBody6:9 [qtp1325351680-37] - No Accept header received. Falling back to default media type [application/json].
2020-07-23 23:57:17,426 INFO com.checkpoint.management.web_api_is.utils.helpers.ApiCache.<init>:21 [qtp1325351680-37] - Cache created and initialized
2020-07-23 23:57:17,427 ERROR com.checkpoint.management.web_api_is.utils.jackson.deserializers.BaseMultiValueDeserializer.deserializeSingleObject_aroundBody2:16 [qtp1325351680-37] - Failed to deserialize parameter: [task-id], value is not from type: [java.lang.String]
2020-07-23 23:57:17,427 ERROR com.checkpoint.management.web_api_is.exceptions.WebApiGeneralException.log:42 [qtp1325351680-37] - Error code: [GENERIC_ERR_INVALID_PARAMETER]
2020-07-23 23:57:17,428 ERROR com.checkpoint.management.web_api_is.exceptions.WebApiGeneralException.log:43 [qtp1325351680-37] - Error message: [Invalid parameter for [task-id]. Invalid value]
Here is my playbook
---
- hosts: checkpoint
connection: httpapi
gather_facts: False
tasks:
- name: run-script
cp_mgmt_run_script:
script_name: "List root"
script: ls -l /
targets:
- "26db824a-f9a9-436b-a826-9899f41c8c4e"
register: show_list_root_response
- name: display list root results
debug:
msg: "{{ show_list_root_response }}"
Regards,
Simon