Skip to content
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_storageblob: no longer able to upload image with blob_type 'page' #1794

Open
cmasopust opened this issue Dec 30, 2024 · 3 comments · May be fixed by #1798
Open

azure_rm_storageblob: no longer able to upload image with blob_type 'page' #1794

cmasopust opened this issue Dec 30, 2024 · 3 comments · May be fixed by #1798
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority

Comments

@cmasopust
Copy link

SUMMARY

After the parameter 'standard_blob_tier' has been added to the module azure_rm_storageblob, we no longer can
upload blob_type 'page' elements to our storage blob. Uploading with blob_type 'block' works as expected.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_storageblob

ANSIBLE VERSION
ansible [core 2.15.13]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.21 (main, Dec  5 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
azure.azcollection         3.1.0
OS / ENVIRONMENT

RHEL 9

STEPS TO REPRODUCE

Upload to a storage blob with blob_type 'page'

    - name: Upload image to Azure Storage Account
      azure.azcollection.azure_rm_storageblob:
        client_id: "xxx"
        secret: "xxx"
        tenant: "xxx"
        subscription_id: "xxx"
        resource_group: az-rg-it-gallery-prod-01
        storage_account_name: azsaitlseprod01
        container: lse-os-images
        blob: Test-RHEL-9-BIOS-swap.vhd
        blob_type: page
        src: /shared/data/templates/output/linux-rhel-9-bios-swap/linux-rhel-9-bios-swap-v24.12.vhd
        public_access: container
        force: true
EXPECTED RESULTS

File uploaded to storage blob

ACTUAL RESULTS

Upload fails with error message

The full traceback is:
  File "/tmp/ansible_azure.azcollection.azure_rm_storageblob_payload_cufgnv_x/ansible_azure.azcollection.azure_rm_storageblob_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_storageblob.py", line 543, in upload_blob
  File "/usr/local/lib/python3.9/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_blob_client.py", line 598, in upload_blob
    return upload_page_blob(**options)
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_upload_helpers.py", line 241, in upload_page_blob
    response = cast(Dict[str, Any], client.create(
  File "/usr/local/lib/python3.9/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_generated/operations/_page_blob_operations.py", line 987, in create
    pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 229, in run
    return first_node.send(pipeline_request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  [Previous line repeated 2 more times]
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/policies/_redirect.py", line 197, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_shared/policies.py", line 529, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  [Previous line repeated 1 more time]
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_shared/policies.py", line 302, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 86, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 118, in send
    self._sender.send(request.http_request, **request.context.options),
  File "/usr/local/lib/python3.9/site-packages/azure/storage/blob/_shared/base_client.py", line 348, in send
    return self._transport.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 355, in send
    response = self.session.request(  # type: ignore
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_mode": "key",
            "auth_source": "auto",
            "batch_upload_dst": null,
            "batch_upload_src": null,
            "blob": "Test-RHEL-9-BIOS-swap.vhd",
            "blob_type": "page",
            "cache_control": null,
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "container": "lse-os-images",
            "content_disposition": null,
            "content_encoding": null,
            "content_language": null,
            "content_md5": null,
            "content_type": null,
            "dest": null,
            "disable_instance_discovery": false,
            "force": true,
            "log_mode": null,
            "log_path": null,
            "password": null,
            "profile": null,
            "public_access": "container",
            "resource_group": "az-rg-it-gallery-prod-01",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "src": "/shared/data/templates/output/linux-rhel-9-bios-swap/linux-rhel-9-bios-swap-v24.12.vhd",
            "standard_blob_tier": null,
            "state": "present",
            "storage_account_name": "azsaitlseprod01",
            "subscription_id": "6a6b534d-bdf0-4c92-9597-7637614d2e40",
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "thumbprint": null,
            "x509_certificate_path": null
        }
    },
    "msg": "Error creating blob Test-RHEL-9-BIOS-swap.vhd - request() got an unexpected keyword argument 'standard_blob_tier'"
}
@Fred-sun Fred-sun added medium_priority Medium priority work in In trying to solve, or in working with contributors labels Dec 31, 2024
@Fred-sun
Copy link
Collaborator

Fred-sun commented Jan 6, 2025

@cmasopust Perhaps I made a mistake and 'standard_blob_tier' can only be used for accounts of type blob (even if the default value is None) because that's what the documentation says. I have separated the two types in PR #1798, can you try it? Thank you!

        :keyword ~azure.storage.blob.StandardBlobTier standard_blob_tier:
            A standard blob tier value to set the blob to. For this version of the library,
            this is only applicable to block blobs on standard storage accounts

@Fred-sun Fred-sun added bug Something isn't working has_pr PR fixes have been made and removed work in In trying to solve, or in working with contributors labels Jan 6, 2025
@cmasopust
Copy link
Author

@Fred-sun Thansk for the quick fix, quick test shows that it's working for me.

@Fred-sun
Copy link
Collaborator

Fred-sun commented Jan 7, 2025

@cmasopust Thanks for your feedback! I will push for merged as soon as possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants