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

Variable not enclosed in {} AND single quoted string containing a variable #434

Closed
krissik opened this issue Jul 30, 2015 · 2 comments
Closed

Comments

@krissik
Copy link

krissik commented Jul 30, 2015

If I do two things wrong like this:

$var = 'foo'
exec {'bar $var':
  command => 'ls -alh'
}

puppet-lint doesn't warn me about "variable not enclosed in {} on line 2" and "single quoted string containing a variable".

I am using puppet-lint 1.1.0 and puppet 3.4.3.

@solarkennedy
Copy link

There are legitimate use cases where you need a literal $var, for which using a single quoted string is what you really mean. Take for example using the getvar function:

getvar('$::somefact')

I understand that there is a blurry line between linting and catching bugs. Yes if such a check existing I guess I would simply disable it when I needed to use getvar or defined or needed a literal $ in a bash script or nginx proxy directive, etc.

@rnelson0
Copy link
Collaborator

As described, this is operating as expected. If the contents instead sayexec {'bar ${var}':, it then triggers the check ERROR: single quoted string containing a variable found on line 2.

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

No branches or pull requests

3 participants