Unless I examined the code wrongly, the only thing that concact_file does with the validate_cmd
argument is ... validate that the arguments of that command are correct.
However, you seem to have forgotten the code to execute the validate_cmd. Even if you pass the correct
arguments, nothing happens.
Expected Behavior
I'd expect that the validate command be executed and abort the replacement of the file if the command returns 1.
Modify your example to change line 12 so the content is '3' (or anything else, doesn't matter)
Add a validate_command in line 7 that always returns 1 (the expected failure value) (doesn't matter if you add the ending %).
validate_cmd => '/usr/bin/false',
Run puppet on the modified example
You'll see that /tmp/concact was replaced with the new content, even if validate_cmd returned an error.
It doesn't matter if validate_cmd returns 0 or 1. There's no code executing validate_cmd or taking action on its result.
Environment
Version [9.0.0] (I hope I read it correctly from puppet module list)
Platform [Debian 12.5]
Additional Context
You are missing a call to execute validate_cmd. Something along the lines of whatpuppet::filedoes
here
Describe the Bug
Unless I examined the code wrongly, the only thing that concact_file does with the validate_cmd argument is ... validate that the arguments of that command are correct.
However, you seem to have forgotten the code to execute the validate_cmd. Even if you pass the correct arguments, nothing happens.
Expected Behavior
I'd expect that the validate command be executed and abort the replacement of the file if the command returns 1.
Steps to Reproduce
Steps to reproduce the behavior:
/tmp/concat
by running puppet%
).validate_cmd => '/usr/bin/false',
/tmp/concact
was replaced with the new content, even if validate_cmd returned an error.It doesn't matter if
validate_cmd
returns 0 or 1. There's no code executing validate_cmd or taking action on its result.Environment
Additional Context
You are missing a call to execute
validate_cmd
. Something along the lines of whatpuppet::file
does here