Skip to content

Commit

Permalink
Merge pull request #341 from redhatrises/use_jammy
Browse files Browse the repository at this point in the history
Update stemcell default to jammy
  • Loading branch information
ram-pivot authored Nov 20, 2024
2 parents 7306c50 + 8dbf58b commit 7a71853
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions tile_generator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,20 @@ def validate(self):

def default_stemcell(self):
stemcell_criteria = self.get('stemcell_criteria', {})
stemcell_criteria['os'] = stemcell_criteria.get('os', 'ubuntu-xenial')
stemcell_criteria['os'] = stemcell_criteria.get('os', 'ubuntu-jammy')
stemcell_criteria['version'] = stemcell_criteria.get('version', self.latest_stemcell(stemcell_criteria['os']))
return stemcell_criteria

def latest_stemcell(self, os):
if os == 'ubuntu-xenial':
if os == 'ubuntu-jammy':
headers = { 'Accept': 'application/json' }
response = requests.get('https://network.pivotal.io/api/v2/products/stemcells-ubuntu-jammy/releases', headers=headers)
response.raise_for_status()
releases = response.json()['releases']
versions = [r['version'] for r in releases]
latest_major = sorted(versions, key=float)[-1].split('.')[0]
return latest_major
elif os == 'ubuntu-xenial':
headers = { 'Accept': 'application/json' }
response = requests.get('https://network.pivotal.io/api/v2/products/stemcells-ubuntu-xenial/releases', headers=headers)
response.raise_for_status()
Expand Down
4 changes: 2 additions & 2 deletions tile_generator/test_config_expected_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -4240,7 +4240,7 @@
"space": "test-tile-space",
"standalone": false,
"stemcell_criteria": {
"os": "ubuntu-xenial",
"os": "ubuntu-jammy",
"version": "1234"
},
"update": {
Expand All @@ -4251,4 +4251,4 @@
},
"verbose": false,
"version": "0.0.1"
}
}
2 changes: 1 addition & 1 deletion tile_generator/test_metadata_expected_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ standalone: false
releases:

stemcell_criteria:
os: ubuntu-xenial
os: ubuntu-jammy
requires_cpi: false
version: '1234'

Expand Down

0 comments on commit 7a71853

Please sign in to comment.