Open jaybrto opened 7 months ago
Hi, i have the same problem.
The matcher is OK.
The ExtractValue Json return "
This feature seem to be cool!
Not sure exactly but could be https://github.com/semaphoreui/semaphore/pull/1987 related to that?
i thinks so
but it's not on the v2.9.75 ?
This PR is not merged yet.
This PR is not merged yet.
Hi Thomas, is there any eta for merging this PR?
@reisenbauer merged.
I'm running version v2.10.22 and the problem still exist. The PR is already in the code but it didn't fix the issue. Any other fix coming?
@h4ckilles it is indeed already working, you have to be very carefull with the http-headers (content-type).
Running Version: 2.10.22-e44910d-1721658299
Configuration of the Integration:
Curl Request to trigger it:
curl -H "Content-Type: application/json" https://xxxxx/api/integrations/9qlzybysn8xz1kug -d '{ "type": "xoxo", "xoxo": "1234" }'
Result:
@reisenbauer Thanks for the hint. I've tried to trigger my integration from curl like you've suggested but still no extracted values. Here is the curl command I use:
curl -H "Content-Type: application/json" -H 'Authorization: ******************' https://xxxxxxxx/api/integrations/drkn294l6ehy02jp -d '{ "os_type": "X", "requester": "deploymate" }'
Here is the integration:
Here is the called ansible playbook:
- hosts: localhost
gather_facts: true
connection: local
vars_files:
- ./credentials.yml
tasks:
- name : debug env var
ansible.builtin.debug:
msg: "{{ lookup('ansible.builtin.env', 'OS_TYPE') }}"
- name : Linux
include_role:
name: linux
when: lookup('ansible.builtin.env', 'OS_TYPE') == "L"
- name : Windows
include_role:
name: windows
when: lookup('ansible.builtin.env', 'OS_TYPE') == "W"
The playbook did run on curl execution but no environment variable:
Hey @h4ckilles, probably found your issue:
- hosts: localhost
gather_facts: true
connection: local
vars_files:
- ./credentials.yml
tasks:
- name : debug env var
ansible.builtin.debug:
msg: "{{ lookup('ansible.builtin.env', '{{OS_TYPE}}') }}"
- name : Linux
include_role:
name: linux
when: lookup('ansible.builtin.env', '{{OS_TYPE}}') == "L"
- name : Windows
include_role:
name: windows
when: lookup('ansible.builtin.env', '{{OS_TYPE}}') == "W"
try it this way :)
@reisenbauer Thanks a lot it was indeed the playbook causing the problem. This is the correct version:
---
- hosts: localhost
gather_facts: true
connection: local
vars_files:
- ./credentials.yml
tasks:
- name : debug OS_TYPE
ansible.builtin.debug:
msg: "{{ OS_TYPE }}"
- name : Linux
include_role:
name: linux
when: OS_TYPE == "L"
- name : Windows
include_role:
name: windows
when: OS_TYPE == "W"
@h4ckilles glad you got it working :-)
Trying to use the Integration feature but variables come in empty. I can only bring in values from the header into the playbook but not if the data comes in from the Body. I tried changing the body type to string and sending in just text in the body and that doesn't work either. No other combination of content-type work. Not sure what else to try.
Here is the extraction data from API
Here is how I call the integration endpoint. Matcher on header x-req-type == apn
Here are the logs from the server
Here are the variables that the playbook gets
"auto_node_type":"\\u003cnil\\u003e","auto_node_val":"\\u003cnil\\u003e"
These are from hostvars debug
Most of these tests were from Postman, but also straight curls. I have also tried removing the integration and re-creating it from scratch. Any help on this is appreciated. Thanks!