mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-21 20:59:10 +00:00
fix: remove HTTPStatus constructs introduced in Python 3.11 (#11573)
* fix: remove HTTPStatus constructs introduced in Python 3.11 * add changelog frag
This commit is contained in:
parent
4cd91ba4d4
commit
f9e583dae2
7 changed files with 21 additions and 24 deletions
|
|
@ -174,7 +174,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
response_body = response.read()
|
||||
json_data = json.loads(response_body.decode("utf-8"))
|
||||
self.display.vvv(f"Returned Data: {json.dumps(json_data, indent=4, sort_keys=True)}")
|
||||
if HTTPStatus(response.status).is_success:
|
||||
if HTTPStatus.OK <= response.status < HTTPStatus.MULTIPLE_CHOICES: # 2xx codes
|
||||
return json_data
|
||||
if response.status == HTTPStatus.NOT_FOUND and json_data["status"] == "No objects found.":
|
||||
raise AnsibleParserError(f"API returned no data -- Response: {response.status} - {json_data['status']}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue