1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-13 07:25:10 +00:00

[PR #11145/255059f7 backport][stable-12] fix ruff case B015 (#11146)

fix ruff case B015 (#11145)

* fix ruff case B015

* add changelog frag

(cherry picked from commit 255059f7b3)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-11-13 06:30:21 +01:00 committed by GitHub
parent 04fb53e8a3
commit 0813907a89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 17 deletions

View file

@ -95,25 +95,23 @@ class IpinfoioFacts:
response, info = fetch_url(
self.module,
self.url,
force=True, # NOQA
force=True,
timeout=self.timeout,
)
try:
info["status"] == 200
except AssertionError:
if info["status"] != 200:
self.module.fail_json(msg=f"Could not get {self.url} page, check for connectivity!")
try:
content = response.read()
result = self.module.from_json(content)
except ValueError:
self.module.fail_json(msg=f"Failed to parse the ipinfo.io response: {self.url} {content}")
else:
try:
content = response.read()
result = self.module.from_json(content.decode("utf8"))
except ValueError:
self.module.fail_json(msg=f"Failed to parse the ipinfo.io response: {self.url} {content}")
else:
return result
return result
def main():
module = AnsibleModule( # NOQA
module = AnsibleModule(
argument_spec=dict(
http_agent=dict(default=USER_AGENT),
timeout=dict(type="int", default=10),