Kyle Martinez
03/31/2026, 8:53 PMHash[Enum['core', 'sdk'], Array[SemVer], 0, 1] $pkg_details = { 'core' => ['10.0.1', '8.0.4'] }
Errors:
Error: Evaluation Error: Error while evaluating a Function Call, Class[Test]:
parameter 'pkg_details' entry 'core' index 0 expects a SemVer value, got String
parameter 'pkg_details' entry 'core' index 1 expects a SemVer value, got String
The goal is to have Hiera store the data as such:
profile::path_to::pkg_details:
core:
- '10.0.1'
- '8.0.4'
I wanted to avoid having two params on the class since I would still need to add logic to not allow both installs on the node. So the purpose is to allow the key in $pkg_details act as a selector since I do not want both on the same server anyways. Then an array of versions that are wanted to be installed. We previously had two different classes for SDK and CORE bundle but wanted to test out a single class since the automation was already pretty similar.
I am not too concerned if the data type becomes unwieldy since I can just alias it if needed. Also, I can get this to work if I convert the strings to SemVer in the class itself with:
$semvers = $pkg_details[$dotnet_type].map | String $version_str | {
SemVer.new($version_str)
}
We have wanted to try to get better at versioning and part of that was testing with this data struct so if anyone has any ideas that would be awesome. Thanks!