-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Issue
Running an Ansible Template for a playbook containing the following module:
- name: "Update project key"
ansible.builtin.uri:
url: "{{ semaphore_url }}/api/project/{{ project_id }}/keys/{{ project_key_id }}/"
method: PUT
headers:
Content-Type: "application/json"
Cookie: "semaphore={{ semaphore_cookie }}"
body_format: json # or even raw
body: "{{ lookup('template', 'payloads/update_project_key.json.j2') }}"
return_content: true
status_code: [200, 201, 202, 204]
register: update_project_key_response
This module is used to update an existing Semaphore Key using the **Semaphore API**.
payloads/update_project_key.json.j2
{
"id": {{ project_key_id }},
"name": "{{ project_key.name }}",
"type": "{{ project_key.type }}",
"project_id": {{ project_id }},
"override_secret": true,
"login_password": {
"password": "{{ project_key.login_password.password }}",
"login": "{{ project_key.login_password.login }}"
}
}
Error from UI Playbook execution logs:
TASK [semaphore : Update project key] ******************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: b'/tmp/semaphore/project_1/repository_1_template_60/playbooks/semaphore'
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution: [Errno 2] No such file or directory: b'/tmp/semaphore/project_1/repository_1_template_60/playbooks/semaphore'", "stdout": ""}
journalctl -u semaphore.service -f
Log level set to debug
Error is not reported here.
It looks like JSON payload above is marshaled into an internal Semaphore object and Semaphore gets confused over its internal object, and will treat it as a **binary** object which causes the failure.
If I remove the id attribute from the JSON payload, no error is encountered, but the key will not get updated either.
If I run the same playbook using Ansible command line directly, no error is encountered.
Impact
Web-Backend (APIs)
Installation method
Package
Database
Postgres
Browser
Chrome
Semaphore Version
2.16.45
Ansible Version
2.16.4Logs & errors
Error from UI Paybook execution logs:
TASK [semaphore : Update project key] ******************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: b'/tmp/semaphore/project_1/repository_1_template_60/playbooks/semaphore'
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution: [Errno 2] No such file or directory: b'/tmp/semaphore/project_1/repository_1_template_60/playbooks/semaphore'", "stdout": ""}
journalctl -u semaphore.service -f
Log level set to debug
Error is not reported here.
Manual installation - system information
Photon 5
Configuration
NA
Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels