Issue #5081 has been updated by Dan Carley.
Markus Roberts wrote: > why are you using ignoreimport here? Good question. For which "it's always worked that way" isn't a very good answer :) The intention is to ignore anything beyond the scope of a single manifest when checking the syntax of committed code. Because you won't have the rest of the `modulepath` or even the current module available to you when looking within a single commit. This matches the description from the manpage: <cite> A parameter that can be used in commit hooks, since it enables you to parse-check a single file rather than requiring that all files exist. </cite> Having looked at it more carefully, it seems that: - `--ignoreimport` isn't required when relying on auto-imports from `include` directives. Since they appear to be ignored when using `--parseonly`. - `--ignoreimport` is required if you have any explicit `import` directives in your manifests (of which I have some). Otherwise they will result `No file(s) found for import of`. In terms of "least surprise", it seems to me that `--parseonly --ignoreimport` should consider all classes within the manifest that it was told to operate on, but not anything that would be pulled in additionally with `include` or `import`. ---------------------------------------- Bug #5081: Syntax checking not working with --ignoreimport https://projects.puppetlabs.com/issues/5081 Author: Dan Carley Status: Needs more information Priority: Normal Assignee: Category: Target version: Affected Puppet version: 2.6.1 Keywords: Branch: The use of `--ignoreimport` with `--parseonly` isn't raising errors on bad syntax. I've traced the last time this was working back to the tag of `2.6.0rc4`. This is important for those of us who use syntax checks in commit hooks, in order to prevent buggy manifests from going out. It can be observed with the following: <pre> class test { file { "/tmp/foo": content => "bar", some invalid text } } </pre> <pre> d...@dan-macpro:~/projects/puppet$ git describe 2.6.0rc4 d...@dan-macpro:~/projects/puppet$ RUBYLIB=./lib ./bin/puppet --parseonly --ignoreimport ../test.pp; echo $? err: Could not parse for environment production: Syntax error at 'invalid'; expected '}' at /home/dan/projects/test.pp:4 1 </pre> <pre> d...@dan-macpro:~/projects/puppet$ git describe 2.6.3rc1-105-gb1ef091 d...@dan-macpro:~/projects/puppet$ RUBYLIB=./lib ./bin/puppet --parseonly --ignoreimport ../test.pp d...@dan-macpro:~/projects/puppet$ echo $? 0 </pre> -- 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.
