Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concat_file.rb is missing the code to run the validate_cmd #807

Open
jkbzh opened this issue Mar 22, 2024 · 0 comments
Open

concat_file.rb is missing the code to run the validate_cmd #807

jkbzh opened this issue Mar 22, 2024 · 0 comments

Comments

@jkbzh
Copy link

jkbzh commented Mar 22, 2024

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:

  1. Use your fragment.pp example to create /tmp/concat by running puppet
  2. Modify your example to change line 12 so the content is '3' (or anything else, doesn't matter)
  3. 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',
  4. Run puppet on the modified example
  5. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants