- 
                Notifications
    You must be signed in to change notification settings 
- Fork 346
Fix inventory plugin broken with AzureStackHCI vms and also fix ScaleSets network interfaces #2077
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
base: dev
Are you sure you want to change the base?
Conversation
Everything is already available in self._instanceview Note: changes os_compute_name to computer_name
to reproduce issue:
az rest --url "/subscriptions/<subscription_id>/resourceGroups/<rgName>/providers/Microsoft.Compute/virtualMachineScaleSets/<scaleSetName>/virtualMachines/777/networkInterfaces/priva5b52Nic?api-version=2025-04-01"
returns:
Bad Request({"error":{"code":"NoRegisteredProviderFound","message":"No registered resource provider found for location 'westeurope' and API version '2025-05-01' for type 'virtualMachineScaleSets/virtualMachines/networkInterfaces'. The supported api-versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-06-01, 2016-07-01, 2016-08-01, 2016-09-01, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01, 2019-07-01, 2019-12-01, 2020-06-01, 2020-12-01, 2021-03-01, 2021-04-01, 2021-07-01, 2021-11-01, 2022-03-01, 2022-08-01, 2022-11-01, 2023-03-01, 2023-07-01, 2023-09-01, 2024-03-01, 2024-07-01, 2024-11-01, 2025-04-01'. The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, australiacentral, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth, uaenorth, switzerlandnorth, germanywestcentral, norwayeast, jioindiawest, westus3, swedencentral, qatarcentral, polandcentral, italynorth, israelcentral, spaincentral, mexicocentral, malaysiawest, newzealandnorth, indonesiacentral, austriaeast, chilecentral'."}})
    Basically a revert of PR ansible-collections#2055 now that proper api_version is specific
        
          
                plugins/inventory/azure_rm.py
              
                Outdated
          
        
      | location=self._arcvm['location'] if self._arcvm else self._vm_model['location'], | ||
| name=self._arcvm['name'] if self._arcvm else self._vm_model['name'], | ||
| computer_name=self._vm_model['properties'].get('osProfile', {}).get('computerName'), | ||
| computer_name=self._instanceview['computerName'] if self._instanceview.get('computerName') else self._vm_model['properties'].get('osProfile', {}).get('computerName'), | 
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.
line too long (178 > 160 characters)
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.
fixed :)
plus i've added some logging :) :) :) check out with -vvvv or debug=true in your ansible.cfg
Also display urls called with -vvvv And all raw responses if debug=true in ansible.cfg
| i have another small patch ready to fix another 'bug' in azure stack hci inventory, but it's unrelated so i'll wait for this to be merged as some lines are common and would it would create a conflict | 
| any update @Fred-sun ? | 
| @TiTi Thank you very much for your update. Could you resolve the conflict first? Am I giving it a try? Thank you! | 
| The normal VM and Uniform VMSS instance vm work fine. I will create a Azure Stack HCI VM for test! Thank you very much! | 
|  | ||
|  | ||
| display = Display() | ||
|  | 
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.
expected 2 blank lines, found 1
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.
it's fixed
SUMMARY
Fix of #2074
=> will provide scale set private ip under private_ipv4_addresses host var
ISSUE TYPE
COMPONENT NAME
inventory plugin
ADDITIONAL INFORMATION
The original issue was :
_on_nic_responsewas never called for scale sets nics, despite call toinventory_client._enqueue_get(url=nic['id'],being madeTo reproduce issue:
az rest --url "/subscriptions/<subscription_id>/resourceGroups/<rgName>/providers/Microsoft.Compute/virtualMachineScaleSets/<scaleSetName>/virtualMachines/<vmId>/networkInterfaces/<NicName>?api-version=2024-05-01"Which returns:
Bad Request({"error":{"code":"NoRegisteredProviderFound","message":"No registered resource provider found for location 'westeurope' and API version '2024-05-01' for type 'virtualMachineScaleSets/virtualMachines/networkInterfaces'. The supported api-versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-06-01, 2016-07-01, 2016-08-01, 2016-09-01, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01, 2019-07-01, 2019-12-01, 2020-06-01, 2020-12-01, 2021-03-01, 2021-04-01, 2021-07-01, 2021-11-01, 2022-03-01, 2022-08-01, 2022-11-01, 2023-03-01, 2023-07-01, 2023-09-01, 2024-03-01, 2024-07-01, 2024-11-01, 2025-04-01'. The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, australiacentral, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth, uaenorth, switzerlandnorth, germanywestcentral, norwayeast, jioindiawest, westus3, swedencentral, qatarcentral, polandcentral, italynorth, israelcentral, spaincentral, mexicocentral, malaysiawest, newzealandnorth, indonesiacentral, austriaeast, chilecentral'."}})