Issue #1198 has been updated by Uwe Stuehler.
Mike Pountney wrote:
> Currently, the parser treats the following cases as equivalent:
>
> [...]
>
> I think it would be beneficial to throw a compile error in the first case if
> $content is not defined, eg fail('Attempt to use unquoted, undefined variable
> $content'). This would sensibly catch many cases where I have:
I would intuitively expect a warning in both cases, not just in the unquoted
case.
I've seen many people decorating variables even whey they are expected to
contain a string with gratuitous quotes that would suppress the warning
unintentionally. Also, considering resource names and if I understand the
original suggestion correctly, this would not even produce a warning when I
would like to have it fail:
file { "${vasedir}/subdir/file":
...
}
Is this related to if not a duplicated by #4408?
----------------------------------------
Feature #1198: alter parser to throw an error on use of an undefined, unquoted,
variable.
https://projects.puppetlabs.com/issues/1198
Author: Mike Pountney
Status: Accepted
Priority: Low
Assignee:
Category: language
Target version: unplanned
Patch: None
Affected Puppet version: 0.25.4
Keywords:
Branch:
Currently, the parser treats the following cases as equivalent:
<pre>
file {"/tmp/testfile":
content => $content
}
file {"/tmp/testfile":
content => "$content"
}
</pre>
I think it would be beneficial to throw a compile error in the first case if
$content is not defined, eg fail('Attempt to use unquoted, undefined variable
$content'). This would sensibly catch many cases where I have:
* typo'd on variable names,
* misjudged scoping,
* forgotten to define a variable that I am using in a defined type,
* broken a facter fact.
The second form provides a means for people to continue with the current logic
of 'all variables are an empty string if undefined' for such things as 'if
"$myvar"' statements.
Anyway, please feel free to tell me that this ain't gonna happen, just wanted
to throw it out there...
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.