Issue #11191 has been updated by Jeff McCune. Subject changed from Puppet should provide API access to compiler without a site.pp to Puppet should provide platform access to compiler functionality without an application site.pp
---------------------------------------- Bug #11191: Puppet should provide platform access to compiler functionality without an application site.pp https://projects.puppetlabs.com/issues/11191 Author: Jeff McCune Status: Needs Decision Priority: Normal Assignee: Nigel Kersten Category: API Target version: Affected Puppet version: development Keywords: empathy rspec-puppet rspec testing platform Branch: # Overview # I'm working with [rspec-puppet](https://github.com/rodjek/rspec-puppet) to add spec tests to a module I'm working on. I ran squarely into an issue where Puppet refuses to compile catalogs because I do not have a site.pp file. rspec-puppet does not need a site.pp file because it compiles catalogs in-memory. Simply touching an empty site.pp to create the file allows Puppet to work correctly with rspec-puppet. # Expected Behavior # I expect Puppet to work as a platform providing an API in this situation. It appears to be working as an application instead. I expect rspec-puppet to be able to consume a well defined compiler API and then perform operations on the catalog object produced by this compiler API. # Actual Behavior # The error I get is: <pre> % rspec ./spec/defines/pe_accounts_user_spec.rb -l 15 Run filtered including {:line_number=>15} F Failures: 1) pe_accounts::user expected defaults Failure/Error: it { should contain_user.with_param('shell', '/bin/bash') } Puppet::Error: Could not parse for environment production: No file(s) found for import of '/Users/jeff/.puppet/manifests/site.pp' at line 3 on node maynard.local # /vagrant/src/puppet/lib/puppet/parser/compiler.rb:27:in `compile' # ./spec/defines/../../../puppet/lib/puppet/indirector/catalog/compiler.rb:77:in `compile' # /vagrant/src/puppet/lib/puppet/util.rb:185:in `benchmark' # ./spec/defines/../../../puppet/lib/puppet/indirector/catalog/compiler.rb:75:in `compile' # ./spec/defines/../../../puppet/lib/puppet/indirector/catalog/compiler.rb:35:in `find' # /vagrant/src/puppet/lib/puppet/indirector/indirection.rb:189:in `find' # /vagrant/src/envpuppet/rspec-puppet/lib/rspec-puppet/support.rb:12:in `build_catalog' # /vagrant/src/envpuppet/rspec-puppet/lib/rspec-puppet/example/define_example_group.rb:53:in `catalogue' # /vagrant/src/envpuppet/rspec-puppet/lib/rspec-puppet/example/define_example_group.rb:7:in `subject' # ./spec/defines/pe_accounts_user_spec.rb:15 Finished in 0.00896 seconds 1 example, 1 failure Failed examples: rspec ./spec/defines/pe_accounts_user_spec.rb:15 # pe_accounts::user expected defaults </pre> # Work around # Creating a blank and empty site.pp works around the issue. <pre> % touch ~/.puppet/manifests/site.pp </pre> <pre> % rspec ./spec/defines/pe_accounts_user_spec.rb -l 15 Run filtered including {:line_number=>15} . Finished in 0.23748 seconds 1 example, 0 failures </pre> # References # * Dan's issue reported against upstream rspec-puppet <https://github.com/rodjek/rspec-puppet/issues/15> -- 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.
