vsphere-automation-sdk-python icon indicating copy to clipboard operation
vsphere-automation-sdk-python copied to clipboard

Unable to update tag description

Open Akasurde opened this issue 6 years ago • 6 comments

Environment

  • sdk package version:

vapi-client-bindings==1.1.0 vapi-runtime==2.9.0

  • python version:

Python 3.6.4

  • vSphere version: 6.7.0

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

Steps or code snippet to reproduce

tag_service = Tag(stub_config)
cat_service = Category(stub_config)

tag_list = dict()
for tag in tag_service.list():
    tag_obj = tag_service.get(tag)
    tag_list[tag_obj.name] = dict(tag_description=tag_obj.description,
                                                  tag_used_by=tag_obj.used_by,
                                                  tag_category_id=tag_obj.category_id,
                                                  tag_id=tag_obj.id
                                                  )
print("Before update %s" % tag_list['SampleTag']['tag_description'])

tag_id = tag_list['SampleTag']['tag_id']

update_spec = tag_service.UpdateSpec()
desc = "Additional Information"
print("Changing description to %s" % desc)
update_spec.setDescription = desc
tag_service.update(tag_id, update_spec)
update_tag_obj = tag_service.get(tag_id)
print("After update %s" % update_tag_obj.description)

Actual behavior

Tag description does not change even if the user has permission/privileges to edit tag

Expected behavior

Tag description changes to user desired

Akasurde avatar Feb 28 '19 09:02 Akasurde

Output

Before update Sample Test Tag
Changing description to Additional Information
After update Sample Test Tag

Akasurde avatar Feb 28 '19 09:02 Akasurde

@Akasurde I reproduced the issue. Seems it's a bug. I have reported to the tagging team.
(defect#2312860)

tianhao64 avatar Mar 22 '19 07:03 tianhao64

@tianhao64 Thanks for the update.

Akasurde avatar Mar 22 '19 07:03 Akasurde

@Akasurde Update works if you replace update_spec.setDescription with update_spec.description. The setDescription method is confusing and shouldn't be there. I will check why it is generated.

tianhao64 avatar Mar 24 '19 14:03 tianhao64

Any update on this team?

Akasurde avatar Oct 21 '20 11:10 Akasurde

@Akasurde There is slight change in the code while updating use update_spec.description = desc instead of update_spec.setDescription = desc

This worked for me!

shwetapurohit avatar Feb 03 '22 09:02 shwetapurohit