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

vmware_category - tag category creation doesnt associate category types in 6.7 #197

Closed
ImranJMughal opened this issue May 21, 2020 · 3 comments · Fixed by #206
Closed

vmware_category - tag category creation doesnt associate category types in 6.7 #197

ImranJMughal opened this issue May 21, 2020 · 3 comments · Fixed by #206

Comments

@ImranJMughal
Copy link

SUMMARY

associable_object_types are incorrect for 6.7 VC.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_category in 0.4.1-dev8

ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Oct  8 2019, 14:14:10) [GCC 5.4.0 20160609]

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE

associable_object_types=dict(
type='list',
choices=[
'All objects', 'Folder', 'Cluster',
'Datacenter', 'Datastore', 'Datastore Cluster',
'Distributed Port Group', 'Distributed Switch',
'Host', 'Content Library', 'Library item', 'Network',
'Resource Pool', 'vApp', 'Virtual Machine',

These are incorrect in 6.7 . For example Virtual Machine should be VirtualMachine and Cluster should be ClusterComputeResource.

6.7 shows the types as: - ClusterComputeResource, DistributedVirtualSwitch, VmwareDistributedVirtualSwitch, LibraryItem, ResourcePool, Folder, HostNetwork, DistributedVirtualPortgroup, VirtualApp, StoragePod, Datastore, Network, Datacenter, Library, HostSystem, OpaqueNetwork, VirtualMachine

- hosts: localhost
  connection: local
  tasks:
   - include_vars:
       dir: 'vars/'
   - name: Create Cluster Tag Category
     vmware_category:
       hostname: "{{ vcenter_hostname }}"
       username: "{{ vcenter_username }}"
       password: "{{ vcenter_password }}"
       category_name: "{{ item.cat }}"
       category_cardinality: "{{ item.catcard }}"
       validate_certs: 'false'
       associable_object_types:
         - "{{ item.cattype }}"
       state: present
     with_items:
       - { cat: DemoClusterCategory, catcard: multiple, cattype: "Cluster" }
       - { cat: DemoVMCategory, catcard: multiple, cattype: "Virtual Machine" }
     register: category
     delegate_to: localhost
EXPECTED RESULTS

Tag category created with associated types checked in gui

ACTUAL RESULTS

Tag Created with no associated type


@ImranJMughal
Copy link
Author

ImranJMughal commented May 21, 2020

as a test i've altered "Virtual Machine" to "VirtualMachine" and "Cluster" to "ClusterComputeResource" and this has worked on the tag category creation doing this

- hosts: localhost
  connection: local
  tasks:
   - include_vars:
       dir: 'vars/'
   - name: Create Cluster Tag Category
     vmware_category:
       hostname: "{{ vcenter_hostname }}"
       username: "{{ vcenter_username }}"
       password: "{{ vcenter_password }}"
       category_name: "{{ item.cat }}"
       category_cardinality: "{{ item.catcard }}"
       validate_certs: 'false'
       associable_object_types:
         - "{{ item.cattype }}"
       state: present
     with_items:
       - { cat: DemoClusterCategory, catcard: multiple, cattype: "ClusterComputeResource" }
       - { cat: DemoVMCategory, catcard: multiple, cattype: "VirtualMachine" }
     register: category
     delegate_to: localhost

Akasurde added a commit to Akasurde/community.vmware that referenced this issue May 26, 2020
vCenter uses different resource types for VMware objects.
This fix corrects the resource types.

Fixes: ansible-collections#197

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@Akasurde
Copy link
Member

resolved_by_pr #206

@Akasurde
Copy link
Member

@ImranJMughal This issue is partly due to vCenter/vSphere Automation SDK bug. Since both of them does not restrict any string other than VMware resource object type.

here, I am creating an object ThisisVMwareObject and still, it accepts this associable type.

Screenshot 2020-05-26 at 3 08 33 PM

Akasurde added a commit to Akasurde/community.vmware that referenced this issue May 26, 2020
vCenter uses different resource types for VMware objects.
This fix corrects the resource types.

Fixes: ansible-collections#197

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde added a commit to Akasurde/community.vmware that referenced this issue May 27, 2020
vCenter uses different resource types for VMware objects.
This fix corrects the resource types.

Fixes: ansible-collections#197

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
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 a pull request may close this issue.

2 participants