diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-28 16:10:14 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-28 16:10:14 -0600 |
commit | 600d093df55e012e2e00a5b525daefb77c2eded1 (patch) | |
tree | e144354f71388c308b3265235b06d949df646f6e | |
parent | 421b3fce66db7ff69052bd666d20e746952bc52b (diff) | |
parent | bbf8a8bfc6a817ea19c4dabe3ce89f09d42df68d (diff) | |
download | puppet-600d093df55e012e2e00a5b525daefb77c2eded1.tar.gz puppet-600d093df55e012e2e00a5b525daefb77c2eded1.tar.xz puppet-600d093df55e012e2e00a5b525daefb77c2eded1.zip |
Merge branch 'master' of ssh://reductivelabs.com/opt/rl/git/puppet
-rw-r--r-- | lib/puppet/transportable.rb | 13 | ||||
-rwxr-xr-x | spec/unit/other/transbucket.rb | 12 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index cf92a3937..6f5b2761c 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -207,11 +207,18 @@ module Puppet end def to_ref - return nil unless self.type and self.name unless defined? @ref - @ref = Puppet::ResourceReference.new(self.type, self.name) + if self.type and self.name + @ref = Puppet::ResourceReference.new(self.type, self.name) + elsif self.type and ! self.name # This is old-school node types + @ref = Puppet::ResourceReference.new("node", self.type) + elsif ! self.type and self.name + @ref = Puppet::ResourceReference.new("component", self.name) + else + @ref = nil + end end - @ref.to_s + @ref.to_s if @ref end def to_type diff --git a/spec/unit/other/transbucket.rb b/spec/unit/other/transbucket.rb index 10c551752..84cf93fa4 100755 --- a/spec/unit/other/transbucket.rb +++ b/spec/unit/other/transbucket.rb @@ -37,7 +37,17 @@ describe Puppet::TransBucket do proc { @bucket.push "a test" }.should raise_error end - it "should return nil as its reference when type or name is missing" do + it "should return use 'node' as the type and the provided name as the title if only a type is provided" do + @bucket.type = "mystuff" + @bucket.to_ref.should == "Node[mystuff]" + end + + it "should return use 'component' as the type and the provided type as the title if only a name is provided" do + @bucket.name = "mystuff" + @bucket.to_ref.should == "Class[mystuff]" + end + + it "should return nil as its reference when type and name are missing" do @bucket.to_ref.should be_nil end |