Skip to content

Conversation

@TiTi
Copy link
Contributor

@TiTi TiTi commented Oct 8, 2025

SUMMARY

Fix of #2074

  • Prevents failure if inventory also contains AzureStackHCI vms (or just arc vms)
  • Remove duplicate calls to instance view REST endpoints
  • Fix original problem when retreiving scale sets vms network interface properties
    => will provide scale set private ip under private_ipv4_addresses host var
  • Simplify logic
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

inventory plugin

ADDITIONAL INFORMATION

The original issue was : _on_nic_response was never called for scale sets nics, despite call to inventory_client._enqueue_get(url=nic['id'], being made

To 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'."}})

TiTi added 7 commits October 7, 2025 18:11
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
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'),
Copy link
Collaborator

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)

Copy link
Contributor Author

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

TiTi added 2 commits October 9, 2025 20:44
Also display urls called with -vvvv
And all raw responses if debug=true in ansible.cfg
@Fred-sun Fred-sun added high_priority High priority work in In trying to solve, or in working with contributors labels Oct 13, 2025
@TiTi
Copy link
Contributor Author

TiTi commented Oct 13, 2025

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

@TiTi
Copy link
Contributor Author

TiTi commented Oct 29, 2025

any update @Fred-sun ?

@Fred-sun
Copy link
Collaborator

@TiTi Thank you very much for your update. Could you resolve the conflict first? Am I giving it a try? Thank you!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Oct 29, 2025

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()

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high_priority High priority work in In trying to solve, or in working with contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants