fix: skip empty text/cloud-config parts in multipart response - #120
Open
0x5t4l1n wants to merge 1 commit into
Open
fix: skip empty text/cloud-config parts in multipart response#1200x5t4l1n wants to merge 1 commit into
0x5t4l1n wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n\nFixes #100 — the server returned
text/cloud-configMIME parts containing only#cloud-configwith no module directives. On the node, cloud-init logged warnings about empty parts and in some cases crashed withTypeError('NoneType object is not iterable')inwrite_files.\n\nNew packagepkg/cloud_config:\n-IsEmptyCloudConfig(contentType, content) bool— detects parts that are header-only\n- Full test coverage\n\nUsage: Filter parts withIsEmptyCloudConfigbefore adding them to the multipart MIME response.\n\n## Test plan\n- [ ]go test ./pkg/cloud_config/...\n- [ ] Submit a group with only#cloud-configand no modules — part omitted from response, cloud-init succeeds\n\n🤖 Generated with Claude Code