Skip to content

Fix Azure backend setup after Azure SDK package bump - #1452

Open
sparcstation wants to merge 1 commit into
splunk:developfrom
sparcstation:fix/azure-sdk-compat
Open

sparcstation wants to merge 1 commit into
splunk:developfrom
sparcstation:fix/azure-sdk-compat

Conversation

@sparcstation

Copy link
Copy Markdown

Summary

The package bump in #1445 broke Azure range builds at the remote-backend step:

  1. azure-mgmt-resource 26.0.0 no longer exports ResourceManagementClient from azure.mgmt.resource (it lives in azure.mgmt.resource.resources). The ImportError was swallowed by the guarded import block, setting AZURE_AVAILABLE = False, so builds failed with the misleading:
    Azure SDK not available. Please install azure-identity and azure-mgmt-storage packages.
    
  2. azure-mgmt-storage 25.x models are MutableMappings, so list_keys(...).keys resolves to the dict .keys() method:
    Failed to create Azure Storage Container 'tfstate': 'method' object is not subscriptable
    
    This calls sys.exit(1) inside the API build thread, leaving the range stuck at build_vpn indefinitely.

Changes

  • Import ResourceManagementClient from azure.mgmt.resource.resources, falling back to the old path for older SDKs.
  • Add _first_storage_key() helper that reads the key list from both dict-like (new) and attribute-only (old msrest) models.
  • Include the underlying ImportError in the "Azure SDK not available" warning so future regressions are diagnosable.
  • Add tests/test_azure_provider.py regression tests.

Testing

  • New tests pass with the fix; all 3 fail against develop.
  • Full unit suite (pytest -m "not e2e") in the api/Dockerfile image: 62 passed. The one pre-existing failure (test_cisco_fmc_ftd.py::test_cisco_template_builds_splunk_then_fmc, missing templates/aws/cisco_fmc_ftd_aws.yml) is unrelated and also fails on develop.
  • End-to-end: built azure/splunk_ad_azure via Docker Compose; backend creation, Terraform, VPN and lab phases completed. (The lab phase additionally required a fix in the P4T12ICK.ar_domain_controller role, submitted separately.)

…age 25

The package bump (splunk#1445) broke Azure builds in two ways:

- azure-mgmt-resource >= 24 no longer exports ResourceManagementClient from
  azure.mgmt.resource; import it from azure.mgmt.resource.resources. The
  swallowed ImportError set AZURE_AVAILABLE=False and surfaced as a misleading
  'Azure SDK not available' error.
- azure-mgmt-storage >= 25 models are MutableMappings, so list_keys().keys is
  the dict method ('method' object is not subscriptable). Read the key list
  via a helper that supports both model styles.

Also include the underlying ImportError in the 'SDK not available' warning
and add regression tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant