community.vmware icon indicating copy to clipboard operation
community.vmware copied to clipboard

add better error message for missing datastore

Open mikemorency opened this issue 1 year ago • 9 comments

SUMMARY

If you try to add a datastore that does not exist to the allowed datastores list in the vCLS config, you get a cryptic error message. If a user encounters the error, its really not clear what went wrong.

This change adds a more descriptive error message in the case that the datastore a user tries to add cannot be found. I deconstructed the existing method a bit as well, since it was beginning to get large and complex.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

vmware_cluster_vcls

ADDITIONAL INFORMATION

Test Playbook:

- hosts: localhost
  gather_facts: false
  tasks:
  - name: Configure vCLS Datastore Settings
    community.vmware.vmware_cluster_vcls:
      hostname: foo
      username: foo
      password: foo
      datacenter_name: foo
      cluster_name: foo
      allowed_datastores: ["doesnotexist"]

Before:

TASK [Configure vCLS Datastore Settings] ********************************************************************************
fatal: [mikemorency]: FAILED! => {"changed": false, "msg": "('A specified parameter was not correct: spec.systemVMsConfig.allowedDatastores[1].key', None)"}

After:

TASK [Configure vCLS Datastore Settings] ********************************************************************************
fatal: [mikemorency]: FAILED! => {"changed": false, "msg": "Failed to add datastore 'doesnotexist' because it does not exist."}

mikemorency avatar Jun 25 '24 14:06 mikemorency

@mariolenz hoping i didnt miss the june release cutoff :crossed_fingers:

mikemorency avatar Jun 25 '24 14:06 mikemorency

Build succeeded. https://ansible.softwarefactory-project.io/zuul/buildset/7b8a8abf1d4749c6a104869fbf8e3d51

:heavy_check_mark: ansible-tox-linters SUCCESS in 9m 09s :heavy_check_mark: build-ansible-collection SUCCESS in 9m 15s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_only-stable216 SUCCESS in 17m 30s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_2esxi-stable216 SUCCESS in 14m 57s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable216_1_of_2 SUCCESS in 45m 46s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable216_2_of_2 SUCCESS in 57m 42s :heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 12s

Sorry, I didn't find the time yet to have a look at this. And I'll be AFK for a couple of days, so please bare with me.

Anyway, we've changed the CI to test with ansible-core 2.17 recently (ansible/ansible-zuul-jobs#1875) and I would like to see if your PR still works with this. So I'll close it and re-open it in a couple of minutes. Just to make sure that the CI really runs with 2.17.

mariolenz avatar Jul 03 '24 17:07 mariolenz

Build failed. https://ansible.softwarefactory-project.io/zuul/buildset/189392a88b7940729f976281ec22453f

:heavy_check_mark: ansible-tox-linters SUCCESS in 9m 25s :heavy_check_mark: build-ansible-collection SUCCESS in 9m 48s :warning: ansible-test-cloud-integration-vcenter7_only-stable217 CANCELED :warning: ansible-test-cloud-integration-vcenter7_2esxi-stable217 CANCELED :warning: ansible-test-cloud-integration-vcenter7_1esxi-stable217_1_of_2 CANCELED :x: ansible-test-cloud-integration-vcenter7_1esxi-stable217_2_of_2 FAILURE in 12m 38s :heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 21s

recheck

mikemorency avatar Jul 09 '24 12:07 mikemorency

Build succeeded. https://ansible.softwarefactory-project.io/zuul/buildset/e118e39b821b44d0a7a3ff3666edbbfb

:heavy_check_mark: ansible-tox-linters SUCCESS in 9m 36s :heavy_check_mark: build-ansible-collection SUCCESS in 9m 35s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_only-stable217 SUCCESS in 21m 37s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_2esxi-stable217 SUCCESS in 17m 04s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable217_1_of_2 SUCCESS in 54m 55s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable217_2_of_2 SUCCESS in 1h 09m 37s :heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 44s

Build failed. https://ansible.softwarefactory-project.io/zuul/buildset/4fc994978fed4e60890d33ff7171ebd6

:heavy_check_mark: ansible-tox-linters SUCCESS in 9m 18s :heavy_check_mark: build-ansible-collection SUCCESS in 9m 28s :warning: ansible-test-cloud-integration-vcenter7_only-stable217 CANCELED :warning: ansible-test-cloud-integration-vcenter7_2esxi-stable217 CANCELED :warning: ansible-test-cloud-integration-vcenter7_1esxi-stable217_1_of_2 CANCELED :x: ansible-test-cloud-integration-vcenter7_1esxi-stable217_2_of_2 FAILURE in 12m 00s :heavy_check_mark: ansible-galaxy-importer SUCCESS in 3m 51s

recheck

mariolenz avatar Jul 21 '24 14:07 mariolenz

Build succeeded. https://ansible.softwarefactory-project.io/zuul/buildset/62e9a7f62e0945eeb715a010c8e39b7a

:heavy_check_mark: ansible-tox-linters SUCCESS in 9m 49s :heavy_check_mark: build-ansible-collection SUCCESS in 9m 27s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_only-stable217 SUCCESS in 21m 09s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_2esxi-stable217 SUCCESS in 20m 03s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable217_1_of_2 SUCCESS in 54m 55s :heavy_check_mark: ansible-test-cloud-integration-vcenter7_1esxi-stable217_2_of_2 SUCCESS in 1h 08m 22s :heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 21s

@mikemorency Now that the module has been migrated to vmware.vmware (ansible-collections/vmware.vmware#61) I don't think we should merge this.

I think the way forward is a new vmware.vmware release (1.5.0) and then we deprecate vmware_cluster_vcls in this collection.

mariolenz avatar Sep 03 '24 17:09 mariolenz