-
Notifications
You must be signed in to change notification settings - Fork 336
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
azure_rm_virtualmachine latest image selection incorrect #601
Comments
@megrehncitrix I executed your Playbook and the latest image you created should be 2016.127.20190416 for I(SKU = 2016-datacenter). After you log in to the system, the ver of the system is Microsoft Windows [Version 10.0.14393]. Thank you very much! |
Hi @Fred-sun |
@megrehncitrix I am very sorry for the trouble caused to you. After reviewing the code logic, I have no way to directly obtain the image of the latest version. What I got was a list of image versions, so I cannot directly determine which version is the latest. So there's no way to fix it yet. I suggest you do that first? Thank you very much!
|
Thanks @Fred-sun It may be as easy as just cleaning up the get_marketplace_image_version() function to always pass the provided |
@megrehncitrix #606 will fix this issue. |
fixes by #606 |
az vm image show --location canadacentral --urn MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest |python -c 'import json,sys;obj=json.load(sys.stdin);print obj["name"];' |
SUMMARY
In latest azcollection module azure_rm_virtualmachine selects an incorrect latest marketplace image.
The the selection logic assumes that the image list is returned in correct order with latest image as last of the list, this is not the case for some skus and the logic should be updated to retrieve the image flagged as latest, and not rely on an ordered list: https://github.com/ansible-collections/azure/blob/dev/plugins/modules/azure_rm_virtualmachine.py#L1973
Affects sku for generation 1 vm Server 2016:
"publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter"
ISSUE TYPE
COMPONENT NAME
azure_rm_virtualmachine
ANSIBLE VERSION
COLLECTION VERSION
STEPS TO REPRODUCE
Call the module for affected marketplace image: "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter"
pass values for below:
EXPECTED RESULTS
This should create a vm with the latest image for the sku , which is
14393.4583.2108010852
today.ACTUAL RESULTS
VM is created with the image version of
2016.127.20190416
an old version for sku "2016-Datacenter"As a temporary workaround, we are pulling the latest marketplace image version from the Azure API before calling the module. Example:
az vm image show --location eastus --urn MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest
The text was updated successfully, but these errors were encountered: