Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
fixed baseref
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jul 5, 2022
1 parent 380fa8b commit 9b817f0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1992,12 +1992,14 @@ def get_active_image_by_os_version(self, os_version, os_distro):
if image and image.status == "active":
image_os_version = image.get("os_version", None)
image_os_distro = image.get("os_distro", None)
metadata = image.get("metadata", {})
base_image_ref = metadata.get("base_image_ref", None)

if not image_os_distro or not image_os_version:
image_os_version = metadata.get("os_version", None)
image_os_distro = metadata.get("os_distro", None)
metadata = image.get("metadata", None)
base_image_ref = None
if metadata:
base_image_ref = metadata.get("base_image_ref", None)

if not image_os_distro or not image_os_version:
image_os_version = metadata.get("os_version", None)
image_os_distro = metadata.get("os_distro", None)
if (
os_version == image_os_version
and base_image_ref is None
Expand Down Expand Up @@ -2040,9 +2042,13 @@ def add_cluster_machine(
image_os_version = image.get("os_version", None)
image_os_distro = image.get("os_distro", None)
if not image_os_distro or not image_os_version:
metadata = image.get("metadata", {})
image_os_version = metadata.get("os_version", "ubuntu")
image_os_distro = metadata.get("os_distro", "1804")
metadata = image.get("metadata", None)
if metadata:
image_os_version = metadata.get("os_version", "ubuntu")
image_os_distro = metadata.get("os_distro", "1804")
else:
image_os_version = "ubuntu"
image_os_distro = "1804"
image = self.get_active_image_by_os_version(
os_version=image_os_version, os_distro=image_os_distro
)
Expand Down

0 comments on commit 9b817f0

Please sign in to comment.