Merged
Conversation
dcf2973 to
20c3201
Compare
20c3201 to
37525d7
Compare
Note: Required after the update to `hashicorp/packer-plugin-sdk` v0.6.6. Change `DirPerm` in `OutputConfig` from `os.FileMode` to `*os.FileMode` so that HCL2 can correctly represent the field as optional/nullable. When `directory_permission` is not set in a onfiguration, the packer-sdc generated flat struct receives a cty null value for the field. Assigning a cty null to a non-pointer `os.FileMode` causes a runtime panic: "null value is not allowed". Using a pointer type allows the field to be nil when omitted, which is handled in `Prepare()` by falling back to the default permission of `0750`. The corresponding generated `hcl2spec.go` files (`output_config` and `step_export`) are updated to mirror the pointer type. Because the pointer is now declared in the source struct, future runs of `make generate` will regenerate these files with `*os.FileMode`. Fixes: - Runtime error: null value is not allowed [directory_permission] - Build error: cannot use DirPerm (type *os.FileMode) as os.FileMode Ref: #675 Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
37525d7 to
4d7cefd
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Important
Required after the update to
hashicorp/packer-plugin-sdkv0.6.6 in #675.Change
DirPerminOutputConfigfromos.FileModeto*os.FileModeso that HCL2 can correctly represent the field as optional/nullable.When
directory_permissionis not set in a onfiguration, the packer-sdc generated flat struct receives a cty null value for the field. Assigning a cty null to a non-pointeros.FileModecauses a runtime panic: "null value is not allowed". Using a pointer type allows the field to be nil when omitted, which is handled inPrepare()by falling back to the default permission of0750.The corresponding generated
hcl2spec.gofiles (output_configandstep_export) are updated to mirror the pointer type. Because the pointer is now declared in the source struct, future runs ofmake generatewill regenerate these files with*os.FileMode.Fixes:
Type
fix: Bug Fixfeat: Feature or Enhancementdocs: Documentationrefactor: Refactoringchore: Build, Dependencies, Workflows, etc.other: Other (Please describe.)Breaking Changes?
Tests
Output:
Documentation
Issue References
Ref: #675
Release Note
Additional Information