-
Notifications
You must be signed in to change notification settings - Fork 583
(MODULES-1582) File location placeholder #377
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
(MODULES-1582) File location placeholder #377
Conversation
@@ -34,10 +38,17 @@ module Puppet::Parser::Functions | |||
begin | |||
tmpfile.write(content) | |||
tmpfile.close | |||
|
|||
if checkscript.include?('%') | |||
check_with_correct_location = checkscript.gsub(/%/,tmpfile.path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead check & match /\s%(\s|$)/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid any validate commands that have %'s in them other than "... % ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do 👍
This simply `gsub`'s the file path into where the % placeholder is.
These specs are pretty much the same as the originals, but now check that the output has the correct replacement for file location
Avoids any validate commands that have %'s in them other than "... % ..."
(MODULES-1582) File location placeholder
Correct command is `test -e $filename` Also % replacement in validate_cmd is not supported in a released version of puppetlabs-stdlib, it's fixed in 4.5.x but not not released yet (See: puppetlabs/puppetlabs-stdlib#377)
Correct command is `test -e $filename` Also % replacement in validate_cmd is not supported in a released version of puppetlabs-stdlib, it's fixed in 4.5.x but not not released yet (See: puppetlabs/puppetlabs-stdlib#377)
Correct command is `test -e $filename` Also % replacement in validate_cmd is not supported in a released version of puppetlabs-stdlib, it's fixed in 4.5.x but not not released yet (See: puppetlabs/puppetlabs-stdlib#377)
This makes the validate_cmd closer to the file implementation, and allows a user to
give a validate_cmd path where the filepath is not at the end of the string.
The example I found was with haproxy, which uses the following command for file validation:
/usr/sbin/haproxy -f /etc/haproxy.cfg -c
Currently this isn't possible to do with stdlib, so I made this PR to fix it! 💃