Skip to content

(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

Merged
merged 3 commits into from
Dec 18, 2014
Merged

(MODULES-1582) File location placeholder #377

merged 3 commits into from
Dec 18, 2014

Conversation

petems
Copy link
Contributor

@petems petems commented Dec 9, 2014

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! 💃

@@ -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)
Copy link
Contributor

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|$)/ ?

Copy link
Contributor

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 "... % ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do 👍

Peter Souter added 3 commits December 18, 2014 23:08
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 "... % ..."
hunner added a commit that referenced this pull request Dec 18, 2014
@hunner hunner merged commit be46f0e into puppetlabs:master Dec 18, 2014
@petems petems deleted the MODULES-1582-improve_validate_cmd branch December 18, 2014 23:47
petems added a commit to petems/puppetlabs-concat that referenced this pull request Feb 12, 2015
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)
petems added a commit to petems/puppetlabs-concat that referenced this pull request Feb 12, 2015
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)
petems added a commit to petems/puppetlabs-concat that referenced this pull request Feb 18, 2015
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants