You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It could be added to the documentation or fix in the code, as you could assume that you would never change the environnemnt of a variable.
for var in project.variables.list():
if var.environment_scope == env:
if var.key == name:
print('Variable found')
print(var)
var.value = value var.filter = {'environment_scope': env} # necessary to update a variable that has multiple environnements
var.save()
print('Variable updated')
Expected Behavior
variable updated
Actual Behavior
gitlab.exceptions.GitlabUpdateError: 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'
Specifications
python-gitlab version: 4.2.0
API version you are using (v3/v4): v4
Gitlab server version (or gitlab.com): gitlab.com
The text was updated successfully, but these errors were encountered:
Description of the problem, including code/CLI snippet
When trying to update a variable with an environmment set, the variable could not be updated as mention in the documentation
https://python-gitlab.readthedocs.io/en/stable/gl_objects/variables.html
you need to add a filter as the gitlab api endpoint mention it in https://docs.gitlab.com/ee/api/project_level_variables.html#update-a-variable
It could be added to the documentation or fix in the code, as you could assume that you would never change the environnemnt of a variable.
for var in project.variables.list():
if var.environment_scope == env:
if var.key == name:
print('Variable found')
print(var)
var.value = value
var.filter = {'environment_scope': env} # necessary to update a variable that has multiple environnements
var.save()
print('Variable updated')
Expected Behavior
variable updated
Actual Behavior
gitlab.exceptions.GitlabUpdateError: 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'
Specifications
The text was updated successfully, but these errors were encountered: