OS Management Hub: Populate package_classification in package data sources #2459
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.
This PR fixes a data accuracy bug by populating the
package_classificationattribute in two OS Management Hub data sources. The attributewas defined in the schema but was not being set, returning a
nullvalue to users.Fixes #2457
Description of Change
The
package_classificationattribute is now correctly populated for the following data sources:oci_os_management_hub_managed_instance_installed_packages(set to"INSTALLED")oci_os_management_hub_managed_instance_updatable_packages(set to"UPDATABLE")Rationale
The root cause was a
FIXMEleft by the code generator. The OCI Go SDK'sPackageSummarytype is polymorphic, and thepackageClassificationfield is a discriminator that is not exposed as a readable struct field. This caused the generator to fail, and theline was commented out.
The solution follows the established pattern in the
available_packagesdata source by setting the appropriate hardcoded constant based onthe context of the data source.
Testing
make build,make test).resource.TestCheckResourceAttrassertions to the acceptance tests for both affected data sources to verify the attribute ispopulated correctly and prevent future regressions.