puppet-lint icon indicating copy to clipboard operation
puppet-lint copied to clipboard

False positive "Single Quoted String Containing Variables" in single quoted strings.

Open func0der opened this issue 3 years ago • 0 comments

A similar issue has been reported a couple of years ago: https://github.com/rodjek/puppet-lint/issues/113 But it seems that the problem is still there.

Example:

exec{ 'wrong single quoted string containing a variable':
    command   => '/bin/bash "/opt/software/software-bin.${SOME_ENVIRONMENT_VARIABLE}/binary do-something"',
  }

In this particular case the software has a directory for each version and the current version is stored in a an environment variable. But the use case is totally irrelevant for this issue.

The reported issue is Single Quoted String Containing Variables. Yet this should not be triggered, because the whole string is enclosed in single quotes. Therefore we INTENTIONALLY are preventing variable substitution.

If we made a mistake and the intended behavior should have been variable substitution DURING a puppet run and not during bash execution, it should be found by tests and not by linting.

func0der avatar May 05 '21 16:05 func0der