summaryrefslogtreecommitdiffstats
path: root/0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2011-03-16 17:01:09 -0400
committerTodd Zullinger <tmz@pobox.com>2011-03-16 17:01:09 -0400
commit97a1f9e0c101fb87e10c7a299537adbda9532fd6 (patch)
treed53ae5a85de2161648815a3f342260d4247187c0 /0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch
parent9bfa9137f0d797cefc7fd74239679c62010cd0f1 (diff)
downloadpuppet-package-97a1f9e0c101fb87e10c7a299537adbda9532fd6.tar.gz
puppet-package-97a1f9e0c101fb87e10c7a299537adbda9532fd6.tar.xz
puppet-package-97a1f9e0c101fb87e10c7a299537adbda9532fd6.zip
Apply a few upstream fixes for 0.25.5 regressions
The patches are from 2.6.7rc1. (#4922) Don't truncate remotely-sourced files on 404 (#5073) Download plugins even if you're filtering on tags (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs
Diffstat (limited to '0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch')
-rw-r--r--0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch123
1 files changed, 123 insertions, 0 deletions
diff --git a/0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch b/0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch
new file mode 100644
index 0000000..3501750
--- /dev/null
+++ b/0001-5073-Download-plugins-even-if-you-re-filtering-on-ta.patch
@@ -0,0 +1,123 @@
+From 852fb9744320c253772c85e52b262b0290fb7dd4 Mon Sep 17 00:00:00 2001
+From: Matt Robinson <matt@puppetlabs.com>
+Date: Tue, 15 Mar 2011 16:13:15 -0700
+Subject: [PATCH/puppet] (#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.
+---
+ lib/puppet/configurer/downloader.rb | 1 +
+ lib/puppet/configurer/plugin_handler.rb | 9 +++++++-
+ spec/unit/configurer/downloader_spec.rb | 32 +++++++++++++++++++++---------
+ 3 files changed, 31 insertions(+), 11 deletions(-)
+
+diff --git a/lib/puppet/configurer/downloader.rb b/lib/puppet/configurer/downloader.rb
+index 1b587ed..b369620 100644
+--- a/lib/puppet/configurer/downloader.rb
++++ b/lib/puppet/configurer/downloader.rb
+@@ -50,6 +50,7 @@ class Puppet::Configurer::Downloader
+
+ def catalog
+ catalog = Puppet::Resource::Catalog.new
++ catalog.host_config = false
+ catalog.add_resource(file)
+ catalog
+ end
+diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb
+index cfc6b5a..ae088f2 100644
+--- a/lib/puppet/configurer/plugin_handler.rb
++++ b/lib/puppet/configurer/plugin_handler.rb
+@@ -9,7 +9,14 @@ module Puppet::Configurer::PluginHandler
+ # Retrieve facts from the central server.
+ def download_plugins
+ return nil unless download_plugins?
+- Puppet::Configurer::Downloader.new("plugin", Puppet[:plugindest], Puppet[:pluginsource], Puppet[:pluginsignore]).evaluate.each { |file| load_plugin(file) }
++ plugin_downloader = Puppet::Configurer::Downloader.new(
++ "plugin",
++ Puppet[:plugindest],
++ Puppet[:pluginsource],
++ Puppet[:pluginsignore]
++ )
++
++ plugin_downloader.evaluate.each { |file| load_plugin(file) }
+ end
+
+ def load_plugin(file)
+diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb
+index c57f39f..4080263 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
+--
+1.7.4.1
+