Skip to content

Commit

Permalink
feat(GCP): Add minimal image license codes
Browse files Browse the repository at this point in the history
We have recently started building Minimal Pro images (as well as the
usual "Base" images). This commit adds the new licenses to the
appropriate suites in GCP_LICENSES.
  • Loading branch information
kajiya3141 committed Oct 23, 2024
1 parent 68b1906 commit cf6ce7e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions uaclient/clouds/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
DMI_PRODUCT_NAME = "/sys/class/dmi/id/product_name"
GCP_PRODUCT_NAME = "Google Compute Engine"

GCP_LICENSES = {
"xenial": "8045211386737108299",
"bionic": "6022427724719891830",
"focal": "599959289349842382",
"jammy": "2592866803419978320",
"noble": "2176054482269786025",
GCP_LICENSES = { # Base [0], Minimal [1]
"xenial": ["8045211386737108299"],
"bionic": ["6022427724719891830", "7427070211152946628"],
"focal": ["599959289349842382", "7818678586103571931"],
"jammy": ["2592866803419978320", "160084055690847662"],
"noble": ["2176054482269786025", "4168323874790319525"],
}


Expand Down Expand Up @@ -111,7 +111,10 @@ def is_pro_license_present(self, *, wait_for_change: bool) -> bool:
license_ids = [license["id"] for license in response.json_list]
self.etag = response.headers.get("etag")
series = system.get_release_info().series
return GCP_LICENSES.get(series) in license_ids
for lic in GCP_LICENSES.get(series, []):
if lic in license_ids:
return True
return False

LOG.error(response.body)
if response.code == 400:
Expand Down

0 comments on commit cf6ce7e

Please sign in to comment.