ansibleguy76 / ansibleforms

A webapplication to create pretty advanced forms to run ansible playbooks or awx templates.
https://ansibleforms.com/
GNU General Public License v3.0
66 stars 10 forks source link

SQL Query error #172

Closed dsha256 closed 4 months ago

dsha256 commented 4 months ago

I'm trying to update an already louched job through the API endpoint https://localhost:8443/api/v1/job/116. I get 200 OK in Postman image

But, it's not updating actually. This is an error from the docker-compose logs:

af_app  | 2024-05-04 11:43:22:4322 error: Failed to update job You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id='119'' at line 1
ansibleguy76 commented 4 months ago

that's an illegal post action and is not documented in the docs. i am shocked though, it got allowed... It's not part of the routes, very strange.

ansibleguy76 commented 4 months ago

I have just tried this and I cannot do that api action. <!DOCTYPE html>

Error
Cannot POST /api/v1/job/451
ansibleguy76 commented 4 months ago

ah, I see it's a put

ansibleguy76 commented 4 months ago

it is meant for status changes, and is more an internal api. And I even wonder if it's used. I believe it is not and can be removed.

It does work on my end, but it's not meant to send extravars etc... image

image

dsha256 commented 4 months ago

I have just tried this and I cannot do that api action.

Error

Cannot POST /api/v1/job/451

I did that via the HTTP PUT. I saw that it is not documented in the Swagger docs but somehow it accepted the PUT request and according to the error, seems like a job ID is passed as a string to the query while it is an integer based on the migration SQL script to this repo.

dsha256 commented 4 months ago

it is meant for status changes, and is more an internal api. And I even wonder if it's used. I believe it is not and can be removed.

It does work on my end, but it's not meant to send extravars etc... image

image

So by design, I'm not allowed to PUT or PATCH a job as an API user right?

ansibleguy76 commented 4 months ago

correct. you launch a job and then abort/relaunch/delete, but you can't change it; Only internal code changes the job (status, timestamps, output, etc...)

ansibleguy76 commented 4 months ago

I just double checked and the put is not used. I will remove it in the next version.