-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use specific image versions directly for virtual machines #808
Conversation
for version in versions: | ||
if version.name == self.image['version']: | ||
return version | ||
return versions[len(versions) - 1].name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If version is specified and cannot be obtained through the first one, the PR function is similar to #767. Thank you very much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my changes the version lookup will only happen when "latest" is used. Otherwise the user specified version is used directly. I think it doesn't make much sense to get all versions of an image to check if the specified version is listed or not.
@danielpanteleit If the version specified by the user does not exist or is unavailable in the region, no exception will be thrown! |
@Fred-sun Yes, there is no specific error message in the code, but there will still be a recognizable error message: fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating or updating virtual machine test - (PlatformImageNotFound) The platform image 'Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:20.04.202203320' is not available. Verify that all fields in the storage profile are correct. For more details about storage profile information, please refer to https://aka.ms/storageprofile\nCode: PlatformImageNotFound\nMessage: The platform image 'Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:20.04.202203320' is not available. Verify that all fields in the storage profile are correct. For more details about storage profile information, please refer to https://aka.ms/storageprofile\nTarget: imageReference"} Though I understand if you want a more readable error message. |
@danielpanteleit This is also ok, if the resource cannot be found when creating it, the API will report an error. But #767 is more in line with our code design logic. If not, an error is reported and the desired log reminder is printed. Thank you very much! |
@danielpanteleit I'm sorry, but we prefer to change #767 after internal discussion, which is in line with the code design. Thank you very much! |
SUMMARY
Fixes #766
Currently we can't use the non-latest version of a virtual machine image. After PR #606 only the latest version for an image is fetched. For example I tried this image, which did not work:
This change will only fetch versions if we use the version "latest" and otherwise use the version as specified by the user.
ISSUE TYPE
COMPONENT NAME
azure_rm_virtualmachine