Repository navigation
fix(E3009): require command in cfn-init commands entries - #4914
Conversation
blacksoxx
left a comment
There was a problem hiding this comment.
Read the diff against main. I did not run the suite here, so these are reading notes.
The schema change matches the cfn-init reference: in the commands section command is the only required key, and env, cwd, test, ignoreErrors and waitAfterCompletion stay optional, so with additionalProperties: false already on the entry, required was the one missing piece. The new case's schema_path follows the existing patternProperties chain in cfn_init.json, and the valid-command case keeps the happy path covered. I also scanned the good fixture templates that use AWS::CloudFormation::Init commands and found none without command, so the snapshot results should be unchanged.
OKAN-SOFTWARE
left a comment
There was a problem hiding this comment.
Validated commit b9c495a locally using Python 3.12.14.
The new missing-command regression test fails with the current main-branch schema and passes with this change.
python -m pytest -q test/unit/rules/resources — 1,355 passed.
Additional checks covered empty command entries, mixed valid/invalid entries, multiple configuration blocks, Ref, Fn::Sub, Fn::If, and an AWS::NoValue branch. Valid inputs remained accepted, and missing commands were reported at the corresponding entry.
No blocking issues found within this review’s scope. Validation covered local rule behavior and unit tests; no AWS deployment was performed.
07f7028 to
2407485
Compare
The cfn_init.json schema had no `required` list for `commands` entries, so an entry without `command` passed lint, then failed at cfn-init time on the instance. Add `required: ["command"]` and a regression test. Fixes aws-cloudformation#4874
2407485 to
a9e47b5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4914 +/- ##
=======================================
Coverage 94.80% 94.80%
=======================================
Files 441 441
Lines 16165 16165
Branches 3135 3135
=======================================
Hits 15326 15326
Misses 463 463
Partials 376 376
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Issue #, if available: Fixes #4874
Description of changes:
The cfn_init.json schema had no
requiredlist forcommandsentries, so an entry withoutcommandpassed lint, then failed at cfn-init time on the instance. Addrequired: ["command"]and a regression test.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.