diff options
| author | Matt Robinson <matt@puppetlabs.com> | 2011-03-15 16:13:15 -0700 |
|---|---|---|
| committer | Matt Robinson <matt@puppetlabs.com> | 2011-03-15 23:48:08 -0700 |
| commit | 852fb9744320c253772c85e52b262b0290fb7dd4 (patch) | |
| tree | 9d3cef147e874cfb9857e6fc6290c7cf7a16b3f1 /spec/unit/configurer | |
| parent | a6d0e99e97d18b622793a807e985580cb65a8c7c (diff) | |
| download | puppet-852fb9744320c253772c85e52b262b0290fb7dd4.tar.gz puppet-852fb9744320c253772c85e52b262b0290fb7dd4.tar.xz puppet-852fb9744320c253772c85e52b262b0290fb7dd4.zip | |
(#5073) Download plugins even if you're filtering on tags
When we eval a resource in transaction.rb it was being skipped when
filtering on tags and downloading the plugins. There's a lot of
complicated conditions for whether to skip a resource, but this is a
condensed version of the path that was causing plugins not to be
downloaded.
skip?
missing_tags?
!ignore_tags?
!host_config
The Puppet::Configurer::Downloader creates separate catalogs and applies them
to get custom facts and plugins, so should be setting host_config to false.
Puppet::Util::Settings also sets host_config to false when you call use on
settings, while normal catalog application defaults to true.
Thanks to Stefan Schulte <stefan.schulte@taunusstein.net> for suggesting
the implementation fix.
Diffstat (limited to 'spec/unit/configurer')
| -rwxr-xr-x | spec/unit/configurer/downloader_spec.rb | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index c57f39fb5..4080263e7 100755 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -5,6 +5,8 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/configurer/downloader' describe Puppet::Configurer::Downloader do + require 'puppet_spec/files' + include PuppetSpec::Files it "should require a name" do lambda { Puppet::Configurer::Downloader.new }.should raise_error(ArgumentError) end @@ -96,25 +98,35 @@ describe Puppet::Configurer::Downloader do describe "when creating the catalog to do the downloading" do before do - @dler = Puppet::Configurer::Downloader.new("foo", "path", "source") + @dler = Puppet::Configurer::Downloader.new("foo", "/download/path", "source") end it "should create a catalog and add the file to it" do - file = mock 'file' - catalog = mock 'catalog' - - @dler.expects(:file).returns file - - Puppet::Resource::Catalog.expects(:new).returns catalog - catalog.expects(:add_resource).with(file) + catalog = @dler.catalog + catalog.resources.size.should == 1 + catalog.resources.first.class.should == Puppet::Type::File + catalog.resources.first.name.should == "/download/path" + end - @dler.catalog.should equal(catalog) + it "should specify that it is not managing a host catalog" do + @dler.catalog.host_config.should == false end + end describe "when downloading" do before do - @dler = Puppet::Configurer::Downloader.new("foo", "path", "source") + @dl_name = tmpfile("downloadpath") + source_name = tmpfile("source") + File.open(source_name, 'w') {|f| f.write('hola mundo') } + @dler = Puppet::Configurer::Downloader.new("foo", @dl_name, source_name) + end + + it "should not skip downloaded resources when filtering on tags" do + Puppet[:tags] = 'maytag' + @dler.evaluate + + File.exists?(@dl_name).should be_true end it "should log that it is downloading" do |
