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

Regression with delete_folder in Grafana 9.3.0 #47

Closed
amotl opened this issue Nov 30, 2022 · 4 comments
Closed

Regression with delete_folder in Grafana 9.3.0 #47

amotl opened this issue Nov 30, 2022 · 4 comments

Comments

@amotl
Copy link
Contributor

amotl commented Nov 30, 2022

What API call do you use?

grafana.folder.delete_folder(uid=folder_uid) 1

What is the actual output?

requests.exceptions.JSONDecodeError: [Errno Expecting value] : 0 2

What is the expected output?

It worked before on Grafana 9.2.4.

References

Footnotes

  1. https://github.com/panodata/grafana-wtf/actions/runs/3582719496/jobs/6027277338#step:5:1888

  2. https://github.com/panodata/grafana-wtf/actions/runs/3582719496/jobs/6027277338#step:5:1935

@amotl
Copy link
Contributor Author

amotl commented Nov 30, 2022

By analyzing the output on CI, it looks like the endpoint is responding with 200 OK, but yields an empty response body. Maybe it should respond with 204 No Content instead? See #44.

@amotl
Copy link
Contributor Author

amotl commented Nov 30, 2022

I've been able to reproduce the regression, and confirm the observation referenced above.

it looks like the endpoint is responding with 200 OK, but yields an empty response body.

This makes JSON parsers croak.

Grafana 9.2.7

docker run --rm -it --publish=3000:3000 --env='GF_SECURITY_ADMIN_PASSWORD=admin' grafana/grafana:9.2.7
HTTP folder create/delete conversation on Grafana 9.2
sink:grafana-wtf amo$ http --auth=admin:admin POST localhost:3000/api/folders title=foobar
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 278
Content-Type: application/json
Date: Wed, 30 Nov 2022 11:33:30 GMT
Expires: -1
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
    "canAdmin": true,
    "canDelete": true,
    "canEdit": true,
    "canSave": true,
    "created": "2022-11-30T11:33:30Z",
    "createdBy": "admin",
    "hasAcl": false,
    "id": 1,
    "title": "foobar",
    "uid": "pyENC4KVz",
    "updated": "2022-11-30T11:33:30Z",
    "updatedBy": "admin",
    "url": "/dashboards/f/pyENC4KVz/foobar",
    "version": 1
}


sink:grafana-wtf amo$ http --auth=admin:admin DELETE localhost:3000/api/folders/pyENC4KVz
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 59
Content-Type: application/json
Date: Wed, 30 Nov 2022 11:33:57 GMT
Expires: -1
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
    "id": 1,
    "message": "Folder foobar deleted",
    "title": "foobar"
}

Grafana 9.3.0

docker run --rm -it --publish=3000:3000 --env='GF_SECURITY_ADMIN_PASSWORD=admin' grafana/grafana:9.3.0
HTTP folder create/delete conversation on Grafana 9.3.0
sink:grafana-wtf amo$ http --auth=admin:admin POST localhost:3000/api/folders title=foobar
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 313
Content-Type: application/json
Date: Wed, 30 Nov 2022 11:34:16 GMT
Expires: -1
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
    "canAdmin": true,
    "canDelete": true,
    "canEdit": true,
    "canSave": true,
    "created": "2022-11-30T11:34:16.024847779Z",
    "createdBy": "admin",
    "hasAcl": false,
    "id": 1,
    "parentUid": "",
    "title": "foobar",
    "uid": "8EmOC4K4z",
    "updated": "2022-11-30T11:34:16.024847824Z",
    "updatedBy": "admin",
    "url": "/dashboards/f/8EmOC4K4z/foobar",
    "version": 1
}


sink:grafana-wtf amo$ http --auth=admin:admin DELETE localhost:3000/api/folders/8EmOC4K4z
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 0
Content-Type: application/json
Date: Wed, 30 Nov 2022 11:34:24 GMT
Expires: -1
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block


@amotl amotl changed the title Regression with delete_folder in Grafana 9.3.0? Regression with delete_folder in Grafana 9.3.0 Nov 30, 2022
@amotl
Copy link
Contributor Author

amotl commented Nov 30, 2022

I've reported the observations at grafana/grafana#59546.

@amotl
Copy link
Contributor Author

amotl commented Mar 29, 2024

On a recent version of Grafana, there is a non-empty response again now.

$ http --auth=admin:admin DELETE localhost:3000/api/folders/8EmOC4K4z
HTTP/1.1 404 Not Found
Cache-Control: no-store
Content-Length: 51
Content-Type: application/json
Date: Fri, 29 Mar 2024 10:40:34 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
    "message": "folder not found",
    "status": "not-found"
}

@amotl amotl closed this as completed Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant