AB#2287 support community image IDs (#9)

* support community image IDs
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Fabian Kammel 2022-08-30 15:15:51 +02:00 committed by GitHub
parent e0a457b6ff
commit 778952e07c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 175 additions and 41 deletions

View file

@ -21,10 +21,14 @@ func (c *Client) GetNodeImage(ctx context.Context, providerID string) (string, e
if resp.Properties == nil ||
resp.Properties.StorageProfile == nil ||
resp.Properties.StorageProfile.ImageReference == nil ||
resp.Properties.StorageProfile.ImageReference.ID == nil {
resp.Properties.StorageProfile.ImageReference.ID == nil && resp.Properties.StorageProfile.ImageReference.CommunityGalleryImageID == nil {
return "", fmt.Errorf("node %q does not have valid image reference", providerID)
}
return *resp.Properties.StorageProfile.ImageReference.ID, nil
if resp.Properties.StorageProfile.ImageReference.ID != nil {
return *resp.Properties.StorageProfile.ImageReference.ID, nil
} else {
return *resp.Properties.StorageProfile.ImageReference.CommunityGalleryImageID, nil
}
}
// GetScalingGroupID returns the scaling group ID of the node.