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

DynamicID should check type and fail for wrong type assigned #242

Open
3 tasks done
Akasurde opened this issue Oct 21, 2020 · 1 comment
Open
3 tasks done

DynamicID should check type and fail for wrong type assigned #242

Akasurde opened this issue Oct 21, 2020 · 1 comment

Comments

@Akasurde
Copy link

Environment

  • sdk package version:
  • python version:

Python 3.7.4

  • vSphere version:
    7

  • Operating System/Shell (used to run SDK-based apps):
    macOS

Steps or code snippet to reproduce

from vmware.vapi.vsphere.client import create_vsphere_client
import requests
from com.vmware.vapi.std_client import DynamicID
import urllib3
urllib3.disable_warnings()

session = requests.Session()
session.verify = False

hostname = "10.65.201.153"
username = "[email protected]"
password = "Esxi@123$%"

client = create_vsphere_client(server=hostname,
                               username=username,
                               password=password,
                               session=session)
tag_svc = client.tagging.Tag
tag_ass_svc = client.tagging.TagAssociation

tags = []

cluster_id = 'domain-c9'
cls_dynamic_id = DynamicID(type='ComputeClusterResource', id=cluster_id) # This is wrong type, it should be ClusterComputeResource
tag_ids = tag_ass_svc.list_attached_tags(cls_dynamic_id)
for tag_id in tag_ids:
    tags.append(tag_svc.get(tag_id))

print(tags)

Actual behavior

[]

Expected behavior

[TagModel(id='urn:vmomi:InventoryServiceTag:0deaa3f7-a91e-4c20-bf19-f15201c49ec2:GLOBAL', category_id='urn:vmomi:InventoryServiceCategory:ca46a635-5e0c-47e9-a4c1-9682ac281928:GLOBAL', name='tag_0001', description='', used_by=set())]

@Akasurde
Copy link
Author

When specifying the wrong type in DynamicID should raise an error or exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants