Skip to content

Commit a31cf86

Browse files
committed
latest_timestamps.py: show url and status on failure
eg to identify which pulp_path is incorrect
1 parent 938fa85 commit a31cf86

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ansible/library/latest_timestamps.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ def run_module(): # pylint: disable=missing-function-docstring
6161
timestamps = dict(module.params["repos_dict"])
6262
for repo in timestamps:
6363
for version in timestamps[repo]:
64-
65-
html_txt = requests.get(
66-
url=module.params["content_url"]
67-
+ "/"
68-
+ timestamps[repo][version]["pulp_path"]
69-
).text
64+
url = module.params["content_url"] + "/" + timestamps[repo][version]["pulp_path"]
65+
html = requests.get(url=url)
66+
if not html.ok:
67+
module.fail_json(msg="Couldn't retrieve timestamps for %s[%s] url %s: %s %s"
68+
% (repo, version, url, html.status_code, html.text))
7069
timestamp_link_list = (
71-
BeautifulSoup(html_txt, features="html.parser")
70+
BeautifulSoup(html.text, features="html.parser")
7271
.body.find("pre")
7372
.find_all()
7473
) # getting raw list of timestamps from html

0 commit comments

Comments
 (0)