ITPLT-4531 use ansible-httpget UA when making requests to Marketplace

This commit is contained in:
Lee Goolsbee
2025-09-17 11:56:14 -05:00
parent e380a0dd10
commit 4094ab27f2
8 changed files with 66 additions and 22 deletions

View File

@@ -24,14 +24,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/bitbucket/shared/bitbucket.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req.add_header('User-Agent', 'ansible-httpget')
upstream_fd = urllib.request.urlopen(req)
upstream_json = json.load(upstream_fd)
upstream = upstream_json['_embedded']['versions'][0]['name']
assert verfile.content.decode("UTF-8").strip() == upstream.strip()
def test_latest_is_downloaded(host):
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req.add_header('User-Agent', 'ansible-httpget')
upstream_fd = urllib.request.urlopen(req)
upstream_json = json.load(upstream_fd)
upstream = upstream_json['_embedded']['versions'][0]['name']
@@ -40,7 +44,9 @@ def test_latest_is_downloaded(host):
assert installer.user == 'root'
def test_completed_lockfile(host):
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/bitbucket/versions")
req.add_header('User-Agent', 'ansible-httpget')
upstream_fd = urllib.request.urlopen(req)
upstream_json = json.load(upstream_fd)
upstream = upstream_json['_embedded']['versions'][0]['name']