cloudera / cloudera-playbook

Cloudera deployment automation with Ansible
Apache License 2.0
198 stars 187 forks source link

add 204 to the accepted status codes of the license trial/begin API request #32

Closed lhoss closed 5 years ago

lhoss commented 5 years ago

I like the change but the new comment doesn't match the code. ..

~Indeed, I just re-read the comment .. and 400 should be replaced by 200, will do now!~ EDIT: Actually (I just re-run a test and found that) the comment was correct , stating that the License upload API call returns HTTP code 400 (thus is not really idempotent):

TASK [scm : Begin Cloudera Manager trial license] ******************************************************************************************************************
fatal: xxx: FAILED! => {"changed": false, "connection": "close", "content": "{\n  \"message\" : \"Trial has been used.\"\n}", "content_type": "application/json;charset=utf-8", "date": "Fri, 13 Sep 2019 16:59:34 GMT", "elapsed": 0, "expires": "Thu, 01 Jan 1970 00:00:00 GMT", "json": {"message": "Trial has been used."}, "msg": "Status code was 400 and not [200, 204]: HTTP Error 400: Bad Request", "redirected": false, "set_cookie": "CLOUDERA_MANAGER_SESSIONID=node0146oam3qe56iioolhguf4xupj17.node0;Path=/;HttpOnly", "status": 400, "url": "http://xxxxxxxx.us-west-2.compute.amazonaws.com:7180/api/v33/cm/trial/begin", "x_content_type_options": "nosniff", "x_frame_options": "DENY", "x_xss_protection": "1; mode=block"}

We could add 400 as accepted codes, and then even remove

  ignore_errors: True

@dbeech wdyt?

dbeech commented 5 years ago

Either way works for me 👍

lhoss commented 5 years ago

Either way works for me 👍

great! So I pushed commit (after testing the change on an existing license):

add 400 also to the accepted status codes of the license trial/begin API request -> can remove ignore_errors

dbeech commented 5 years ago

Thanks @lhoss

lhoss commented 5 years ago

Thanks @lhoss

nP and thx for merging 👍