Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATCH /1.0/projects/<project> removes existing configuration #13632

Closed
ru-fu opened this issue Jun 18, 2024 · 1 comment · Fixed by #13786
Closed

PATCH /1.0/projects/<project> removes existing configuration #13632

ru-fu opened this issue Jun 18, 2024 · 1 comment · Fixed by #13786
Assignees
Labels
Bug Confirmed to be a bug
Milestone

Comments

@ru-fu
Copy link
Contributor

ru-fu commented Jun 18, 2024

When you try to update a specific configuration option for a project using PATCH, existing configuration options are discarded:

ubuntu@ru-fu01:~$ lxc project show my-project1
name: my-project1
description: ""
config:
  features.images: "false"
  features.profiles: "false"
  features.storage.buckets: "true"
  features.storage.volumes: "true"
used_by: []
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/projects/my-project1 --data '{
  "config": {
    "limits.containers": "5"
  }
}'
Error: Delete project default profile: Profile not found
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/projects/my-project1 --data '{
  "config": {
    "limits.containers": "5",
    "features.profiles": "false"
  }
}'
ubuntu@ru-fu01:~$ lxc project show my-project1
name: my-project1
description: ""
config:
  features.profiles: "false"
  limits.containers: "5"
used_by: []

This could be regarded as intended behaviour (since you're updating the "config" field - which could mean the FULL "config" field). But this is inconsistent with how PATCH works for, for example, profiles:

ubuntu@ru-fu01:~$ lxc profile show testprofile
name: testprofile
description: ""
config:
  limits.cpu: "4"
  limits.memory: 1GiB
devices:
  root:
    path: /
    pool: default
    size: 1GiB
    type: disk
used_by: []
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/profiles/testprofile --data '{
  "config": {
    "user.test": "hello"
  }                                 
}'
ubuntu@ru-fu01:~$ lxc profile show testprofile
name: testprofile
description: ""
config:
  limits.cpu: "4"
  limits.memory: 1GiB
  user.test: hello
devices:
  root:
    path: /
    pool: default
    size: 1GiB
    type: disk
used_by: []
@tomponline
Copy link
Member

Sounds like a bug to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants