Pure-Storage-Ansible / FlashBlade-Collection

Ansible Collection for Pure Storage FlashBlade
GNU General Public License v3.0
4 stars 8 forks source link

Invalid body parameter bucket_type in purefb_bucket module #249

Closed krauthex closed 9 months ago

krauthex commented 9 months ago

Describe the bug I'd like to use the purefb_bucket module, which always fails with the error: "Object Store Bucket ansiblebucket creation failed. Error: Invalid body parameter: bucket_type", even with only the required minimum of options set:

  - name: Create new bucket in s3 account.
    purestorage.flashblade.purefb_bucket:
      name: "{{ s3bucket.name }}"
      account: "{{ s3bucket.account }}"
      fb_url: "{{ flashblade_url }}"
      api_token: "{{ pure_token }}"

I see in the documentation of the bucket module that for the mode option a Purity//FB version 3.3.3 is required. In my case we happen to have 3.3.2, so I assume this is where the issue arises. However, don't want to set the mode in the first place, but the module seems to nevertheless send the bucket_type option in the API call.

To Reproduce Steps to reproduce the behavior:

  1. Install purestorage.flashblade collection (I used 1.14)
  2. Have a flashblade with Purity//FB version < 3.3.3
  3. Run the sample task above
  4. See error as described above

Expected behavior If I don't set the mode option I'd assume that the task does not set a default value OR if there is a default value then there should be an option to disable the mode, if it only works with very recent Purity//FB versions.

Screenshots

Desktop (please complete the following information):

Let me know if you need additional info! :-)

sdodsley commented 9 months ago

@krauthex Please post the failure message when running the playbook with the -vvvv switch

sdodsley commented 9 months ago

@krauthex can you go to the following URL in a web-browser and post the output. https://<flashblade mgmt vip>/api/api_version

krauthex commented 9 months ago

@krauthex Please post the failure message when running the playbook with the -vvvv switch

Sure. :-)

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "account": "ansibleprovisioner",
            "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "default_retention": null,
            "eradicate": true,
            "fb_url": "REDACTED",
            "freeze_locked_objects": false,
            "hard_limit": null,
            "mode": "classic",
            "name": "ansiblebucket",
            "object_lock_enabled": false,
            "quota": null,
            "retention_lock": "unlocked",
            "retention_mode": null,
            "state": "present",
            "versioning": "absent"
        }
    },
    "msg": "Object Store Bucket ansiblebucket creation failed. Error: Invalid body parameter: bucket_type"
}

This is the error log when running the task:

- name: Create new bucket in s3 account.
  purestorage.flashblade.purefb_bucket:
    name: "ansiblebucket"
    account: "ansibleprovisioner"
    eradicate: true
    fb_url: "{{ flashblade_url }}"
    api_token: "{{ pure_token }}"
krauthex commented 9 months ago

@krauthex can you go to the following URL in a web-browser and post the output. https://<flashblade mgmt vip>/api/api_version

{
  "versions":
    ["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.8.1","1.9","1.10","1.11","1.12","2.0","2.1","2.2","2.3","2.4"]
}
sdodsley commented 9 months ago

Ah - OK - this is a simple fix. Looks like the REST version check we do is checking the wrong version.

krauthex commented 9 months ago

cool, thank you so much for the quick reply! :-)

krauthex commented 9 months ago

Hi @sdodsley , sorry to bother you again, I just tested the collection with the current state of the master branch (at 5ff6d26cd1de6b10780616c2a312802674c9f099), with the same setting as above, and it still doesn't work, but the error has changed (output of the task run with -vvvv):

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "account": "ansibleprovisioner",
            "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "default_retention": null,
            "eradicate": true,
            "fb_url": "REDACTED",
            "freeze_locked_objects": false,
            "hard_limit": null,
            "mode": "classic",
            "name": "ansiblebucket",
            "object_lock_enabled": false,
            "quota": null,
            "retention_lock": "unlocked",
            "retention_mode": null,
            "state": "present",
            "versioning": "absent"
        }
    },
    "msg": "VSO mode requires Purity//FB 3.3.3 or higher."
}

I am still not actively setting the mode option. I actually do not want (or need) to set this option. :-) Is there then a way to use the purefb_bucket module with a Purity//FB 3.3.2 at all? Or is the only option for this to work an update to >=3.3.3?

sdodsley commented 9 months ago

@krauthex apologies. Please try the fix in #251 and let me know if this resolves the issue. I will be travelling in APJ this week and so responses will be delayed.

krauthex commented 9 months ago

@sdodsley With the fix in #251 everything seems to work fine for me. :-) Thanks for your swift responses, and all the best for your travels!