8000 groups.update incorrectly handles as_job parameter · Issue #1260 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

groups.update incorrectly handles as_job parameter #1260

@barmst02

Description

@barmst02

Describe the bug
If as_job=True is passed to groups.update, an error occurs. This is because groups_endpoint.py tries to return a JobItem, but the asJob parameter wasn't added to the API call (URL) to Server.

Versions
Details of your environment, including:

  • Tableau Server version 2021.3.18
  • Python version 3.9
  • TSC library version 0.26

To Reproduce
call groups.update with the parameter as_job=True
E.g. result = server.groups.update(group, as_job=True)

Results
ERROR - list index out of range
Error occurs in groups_endpoint.py line 97:
return JobItem.from_response(server_response.content, self.parent_srv.namespace)[0]

Error occurs because the url created in line 92 doesn't add the asJob parameter:
url = "{0}/{1}".format(self.baseurl, group_item.id)

It can be corrected by adding the if statement below:
url = "{0}/{1}".format(self.baseurl, group_item.id)
if as_job:
url = url + "?asJob=True"
update_req = RequestFactory.Group.update_req(group_item, None)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0