vsphere-automation-sdk-python
vsphere-automation-sdk-python copied to clipboard
Unable to update tag description
- [ ] I am using the latest SDK version
- [x] This API is compatible with my vCenter version (You can get the info from 'vcenter_version' in each sample)
- [x] I have searched existing issues and Troubleshooting wiki
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
Output
Before update Sample Test Tag
Changing description to Additional Information
After update Sample Test Tag
@Akasurde I reproduced the issue. Seems it's a bug. I have reported to the tagging team.
(defect#2312860)
@tianhao64 Thanks for the update.
@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.
Any update on this team?
@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!