diff options
| author | Luke Kanies <luke@madstop.com> | 2008-01-20 21:21:37 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-01-20 21:21:37 -0800 |
| commit | 8a649ff28a46afe6b1e4dd002ac90c93651edfa3 (patch) | |
| tree | 709a701e2e6de344ca6561da29a49e32fef6cf19 | |
| parent | 52eba77e15e74f93d88a5763ca891a53de60b538 (diff) | |
| download | puppet-8a649ff28a46afe6b1e4dd002ac90c93651edfa3.tar.gz puppet-8a649ff28a46afe6b1e4dd002ac90c93651edfa3.tar.xz puppet-8a649ff28a46afe6b1e4dd002ac90c93651edfa3.zip | |
I think I've finally fixed #959, by having the Settings
class skip any resources that are already in memory.
| -rw-r--r-- | lib/puppet/util/settings.rb | 25 | ||||
| -rwxr-xr-x | spec/unit/util/settings.rb | 10 |
2 files changed, 23 insertions, 12 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index b672d9564..ff019edb8 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -510,18 +510,19 @@ class Puppet::Util::Settings end # Only files are convertable to transportable resources. - if obj.respond_to? :to_transportable - next if value(obj.name) =~ /^\/dev/ - transobjects = obj.to_transportable - transobjects = [transobjects] unless transobjects.is_a? Array - transobjects.each do |trans| - # transportable could return nil - next unless trans - unless done[:file].include? trans.name - @created << trans.name - objects << trans - done[:file][trans.name] = trans - end + next unless obj.respond_to? :to_transportable + next if value(obj.name) =~ /^\/dev/ + next if Puppet::Type::File[obj.value] # skip files that are in our global resource list. + + transobjects = obj.to_transportable + transobjects = [transobjects] unless transobjects.is_a? Array + transobjects.each do |trans| + # transportable could return nil + next unless trans + unless done[:file].include? trans.name + @created << trans.name + objects << trans + done[:file][trans.name] = trans end end end diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index 540743d7e..f00afd1b7 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -597,6 +597,14 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d file.should be_nil end + it "should not try to manage files in memory" do + main = Puppet::Type.type(:file).create(:path => "/maindir") + + trans = @settings.to_transportable + + lambda { trans.to_catalog }.should_not raise_error + end + it "should be able to turn the current configuration into a parseable manifest" it "should convert octal numbers correctly when producing a manifest" @@ -635,4 +643,6 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d proc { @settings.use(:whatever) }.should raise_error(RuntimeError) end + + after { Puppet::Type.allclear } end |
