Skip to content

Conversation

@synackd
Copy link
Contributor

@synackd synackd commented Mar 11, 2025

fixes #56

In the current state, requesting a specific group's data from /cloud-init/admin/groups/{name} returns a YAML document whose cloud-init file content is a list of integers representing the file's bytes. For example:

description: ""
data:
  foo: bar 
file:
  content:
  - 35
  - 35
  [...snip...]
  - 101 
  - 10 name: "" encoding: base64

Instead of this, it would be more consistent and easier to parse if this endpoint returned JSON with a proper base64-encoded config. For example, with this PR:

a JSON document with a proper base64-encoded config is returned:

{
  "file": { 
    "content": "IyM[...snip...]ZQo=",
    "encoding": "base64",
    "filename": ""
  },
  "meta-data": { 
    "foo": "bar"
  },
  "name": "tester"
} 

This is opposed to returning YAML, which is inconsistent with the format
of the data returned from other API endpoints. Instead of returning a
YAML document like:

  description: ""
  data:
    foo: bar
  file:
    content:
    - 35
    - 35
    [...snip...]
    - 101
    - 10
    name: ""
    encoding: base64

a JSON document with a proper base64-encoded config is returned:

  {
    "file": {
      "content": "IyM[...snip...]ZQo=",
      "encoding": "base64",
      "filename": ""
    },
    "meta-data": {
      "foo": "bar"
    },
    "name": "tester"
  }
@alexlovelltroy alexlovelltroy merged commit 67bd6f5 into main Mar 14, 2025
2 checks passed
@synackd synackd deleted the synackd/fix-group-output branch March 14, 2025 22:02
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] Returning a specific group's data with plain encoding returns list of bytes

3 participants