Skip to content

fix: skip empty text/cloud-config parts in multipart response - #120

Open
0x5t4l1n wants to merge 2 commits into
OpenCHAMI:mainfrom
0x5t4l1n:fix/skip-empty-cloud-config-parts
Open

fix: skip empty text/cloud-config parts in multipart response#120
0x5t4l1n wants to merge 2 commits into
OpenCHAMI:mainfrom
0x5t4l1n:fix/skip-empty-cloud-config-parts

Conversation

@0x5t4l1n

@0x5t4l1n 0x5t4l1n commented Aug 2, 2026

Copy link
Copy Markdown

Multipart responses could include text/cloud-config parts that only contain the #cloud-config header with no module directives. These empty parts caused cloud-init on nodes to log warnings and in some cases crash with TypeError: 'NoneType' object is not iterable in write_files (fixes #100).

Added pkg/cloud_config/IsEmptyCloudConfig(contentType, content) which detects header-only parts, along with table-driven tests covering the main content-type and content variants. Callers can filter parts with this helper before adding them to the multipart MIME response.

Resolves OpenCHAMI#100. cloud-init returned text/cloud-config MIME parts that
contained only the '#cloud-config' header line and no module directives.
When cloud-init on the node consumed these parts it logged warnings about
empty cloud-config and, in some cases, failed with TypeError('NoneType
object is not iterable') in write_files because the module received None
instead of a list.

Add IsEmptyCloudConfig() and filter empty parts out of the multipart
response in the server handler so they are never sent to nodes.
@synackd

synackd commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the changes; however, while AI-generated code contributions are not prohibited, please make the effort to read the contribution guidelines and use the PR templates. They are there because maintainers are busy and take their time with reviews. A quick review of AI-generated content goes a long way.

  • That PR description is unreadable. Please reformat and describe changes adequately.
  • Commit is not cryptographically signed. This is mandatory.
  • Commit has no DCO. This is mandatory.

@0x5t4l1n

0x5t4l1n commented Aug 7, 2026

Copy link
Copy Markdown
Author

Yeah sure sorry for that I'll update asap.

Signed-off-by: Stalin <git@w4nn4d13.tech>
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]: Empty cloud-init parts can be returned by cloud-init

2 participants