Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't request delete operation from API #542

Closed
mr-falken opened this issue Sep 29, 2022 · 7 comments · Fixed by #553
Closed

Can't request delete operation from API #542

mr-falken opened this issue Sep 29, 2022 · 7 comments · Fixed by #553

Comments

@mr-falken
Copy link

mr-falken commented Sep 29, 2022

When I try to request the delete operation fon an instance I got a stack trace from django (I'm on version 1.7.6b).

That's the curl I try to execute :

curl -X POST "https://[...]/api/service_catalog/instance/[...]/operation/[...]/request/" -d '{ "fill_in_survey": { } }' -H 'Content-Type: application/json' -H "accept: application/json" -H "authorization: Bearer [...]"

And that's the django stack trace :

[...]
  File "/app/service_catalog/models/request.py", line 62, in full_survey
    return {k: v for k, v in {**self.fill_in_survey, **self.admin_fill_in_survey}.items() if v is not None}

Exception Type: TypeError at /api/service_catalog/instance/[...]/operation/[...]/request/
Exception Value: 'str' object is not a mapping
Request information:
USER: admin

GET: No GET data
POST: No POST data
FILES: No FILES data
COOKIES: No cookie data
[...]

Please note that deleting from UI works as expected.

@EliasBoulharts
Copy link
Collaborator

I tried to reproduce but it seems working for me to request a DELETE operation without survey. Do you have a survey?

@mr-falken
Copy link
Author

Hi @EliasBoulharts ,
yes, sorry I didn't mention that: I have a simple survey like this

{
  "delete": 2
}

I tried also to pass the survey in the post body, like :

[...] -d '{ "fill_in_survey": { "delete": 2 } }' [...]

But got the same error.

As further information, after the djiango stack trace the resource goes in "DELETING" state but no awx task is triggered.

@mr-falken
Copy link
Author

Sorry to bother again on this issue, but delete operation request via POST seems still broken on 1.8.0

I also tried calling a delete operation that doesn't need a survey, but still facing this error.

You mentioned that you didn't face that issue with an operation without survey, did you send "request_comment" (which seems mandatory in swagger) in your post ?

Can you share with me a simple curl that's working for you ?

Please note that I'm not deleting an instance, I am requesting a delete operation. :)

@EliasBoulharts
Copy link
Collaborator

I did a manual test and I can reproduce. Unfortunaly the 1.8.1 will be comming soon...

Thank you for your report.

@mr-falken
Copy link
Author

Thanks @EliasBoulharts !
Nevermind, good to hear that you've been able to reproduce the error: looking forward for a fix. :)

@EliasBoulharts
Copy link
Collaborator

Fixed

@mr-falken
Copy link
Author

Hi @EliasBoulharts,
it works like a charm, thanks for helping! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants