Skip to content

Commit

Permalink
Fail on non-successful responses from the API
Browse files Browse the repository at this point in the history
I'd like to have used --fail-with-body, but curl v7.76.0 is way too
recent for most systems.

Could also have used salt.state.http.query, since it allows stateful
HTTP queries, but it has no support for GSSAPI/Kerberos auth.
  • Loading branch information
p3lim committed Aug 31, 2021
1 parent 2e0bbc9 commit d78f81f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions freeipa/client/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ freeipa_dnsrecord_add:
-H "Content-Type:application/json"
-H "Accept:application/json"
-c /tmp/cookiejar -b /tmp/cookiejar
--output /dev/stderr
--write-out "%{http_code}"
-X POST
-d '{
"id": 0,
Expand Down Expand Up @@ -63,7 +65,7 @@ freeipa_dnsrecord_add:
"version": "2.156"
}
]
}' https://{{ ipa_servers[0] }}/ipa/json
}' https://{{ ipa_servers[0] }}/ipa/json | awk '{if ($0<200||$0>399) exit $0}'
- require:
- cmd: freeipa_get_ticket
- require_in:
Expand All @@ -80,6 +82,8 @@ freeipa_host_add:
-H "Content-Type:application/json"
-H "Accept:applicaton/json"
-c /tmp/cookiejar -b /tmp/cookiejar
--output /dev/stderr
--write-out "%{http_code}"
-X POST
-d '{
"id": 0,
Expand All @@ -99,7 +103,7 @@ freeipa_host_add:
"version": "2.156"
}
]
}' https://{{ ipa_servers[0] }}/ipa/json
}' https://{{ ipa_servers[0] }}/ipa/json | awk '{if ($0<200||$0>399) exit $0}'
- require:
- cmd: freeipa_get_ticket
{%- if client.ip is defined %}
Expand Down

0 comments on commit d78f81f

Please sign in to comment.