Skip to content

Conversation

@synackd
Copy link
Contributor

@synackd synackd commented Sep 29, 2025

Closes #84

Requesting a group that doesn't exist would return a 500 Internal Server Error, when a 404 Not Found would be more appropriate. This PR updates the code and the OpenAPI spec to reflect this change.

To test:

  1. Start with clean cloud-init server.
  2. ochami -L basic cloud-init group get config nonexistent
  3. Output:
    ERROR | cloud_init-group-get.go:74 > cloud-init group request yielded unsuccessful HTTP response error="GetGroups(): failed to GET group from cloud-init: unsuccessful HTTP status: HTTP/2.0 404 Not Found: group (compute) not found\n"
    
  4. In cloud-init logs:
    cloud-init-server[84700]: 2025/09/29 16:37:35 [cloud-init/m8u9Wq6ADy-000002] "GET http://demo.openchami.cluster:8443/admin/groups/compute HTTP/1.1" from 172.16.0.254 - 404 26B in 936.775µs
    cloud-init-server[84700]: 4:37PM INF Request bytes_in=0 bytes_out=26 duration=0.865364 method=GET remote_addr=172.16.0.254 request_id=cloud-init/m8u9Wq6ADy-000002 request_uri=/admin/groups/compute status="Not Found" status_code=404 user_agent=ochami/0.5.4
    

Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Copy link
Member

@alexlovelltroy alexlovelltroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexlovelltroy alexlovelltroy merged commit 3721ac0 into main Sep 29, 2025
5 checks passed
@alexlovelltroy alexlovelltroy deleted the synackd/fix/group-not-found branch September 29, 2025 18:48
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

Successfully merging this pull request may close these issues.

[BUG] Group that's not found returns 500 instead of 404

3 participants