Skip to content

Wrong behaviour deleting variable #1387

Description

@Gisson

Description of the problem, including code/CLI snippet

On a project where we have the same variable names in different environments, running the code below to delete a variable produces a scope error when running it.

variable.delete()

Expected Behavior

Successful variable deletion

Actual Behavior

Produces the error below:

Traceback (most recent call last):
  File "/repo/lib/python3.8/site-packages/gitlab/exceptions.py", line 279, in wrapp
ed_f
    return f(*args, **kwargs)
  File "/repo/lib/python3.8/site-packages/gitlab/mixins.py", line 341, in delete
    self.gitlab.http_delete(path, query_data=query_data, **kwargs)
  File "/repo/lib/python3.8/site-packages/gitlab/__init__.py", line 744, in http_de
lete
    return self.http_request("delete", path, query_data=query_data, **kwargs)
  File "/repo/lib/python3.8/site-packages/gitlab/__init__.py", line 567, in http_request
    raise GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/repo/lib/python3.8/site-packages/gitlab/mixins.py", line 403, in delete
    self.manager.delete(self.get_id(), query_data)
  File "/repo/lib/python3.8/site-packages/gitlab/exceptions.py", line 281, in wrapp
ed_f
    raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabDeleteError: 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'

Specifications

  • python-gitlab version: 2.6.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 13.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions