Detect Hiera files that are not valid hashes#184
Merged
Conversation
This was reported on slack via @ikonia. with such malformed keys, Hiera just reports a string: ``` irb(main):002> require 'yaml' => true irb(main):003> yamlargs = (Psych::VERSION >= '4.0') ? { aliases: true } : {} => {aliases: true} irb(main):004> hiera_file='spec/fixtures/hiera/hiera_key_no_value.yaml' => "spec/fixtures/hiera/hiera_key_no_value.yaml" irb(main):005> YAML.load_file(hiera_file, **yamlargs) => "prometheus::initstyle:sysv prometheus::node_exporter::init_style:sysv" irb(main):006> ``` And puppetserver will fail to compile a catalog: ``` Notice: Catalog compiled by *** Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, /etc/puppetlabs/code/environments/***.yaml: file does not contain a valid yaml hash on node *** Warning: Not using cache on failed catalog ```
tuxmea
approved these changes
May 22, 2025
smortex
approved these changes
May 23, 2025
kenyon
approved these changes
May 23, 2025
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.
This was reported on slack via @ikonia. with such malformed keys, Hiera just reports a string:
And puppetserver will fail to compile a catalog: