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']

View File

@@ -24,14 +24,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/confluence/shared-home/confluence.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/confluence/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/confluence/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/confluence/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/confluence/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/confluence/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/confluence/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']

View File

@@ -24,14 +24,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/crowd/shared/crowd.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/crowd/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/crowd/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/crowd/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/crowd/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/crowd/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/crowd/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']

View File

@@ -12,14 +12,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/jira/shared/jira-core.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']
@@ -28,7 +32,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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']

View File

@@ -24,14 +24,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/jira/shared/jira-software.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']

View File

@@ -12,14 +12,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/jira/shared/jira-core.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']
@@ -28,7 +32,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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']

View File

@@ -12,14 +12,18 @@ def test_version_file_is_latest(host):
verfile = host.file('/media/atl/jira/shared/jira-core.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']
@@ -28,7 +32,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/jira-software/versions")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-software/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']

View File

@@ -8,7 +8,9 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def get_latest():
data = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions/latest")
req = urllib.request.Request("https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions/latest")
req.add_header('User-Agent', 'ansible-httpget')
data = urllib.request.urlopen(req)
meta = json.loads(data.read().decode("UTF-8"))
servicedesk = meta['name']
jira = meta['compatibilities'][0]['hosting']['server']['max']['version']