diff options
author | Luke Kanies <luke@madstop.com> | 2008-07-02 21:16:45 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-07-02 21:16:45 -0500 |
commit | daf0d9db5dc400a9795a5f741c8c63184f5e8982 (patch) | |
tree | 80a2699e228beaaa9673355a5ff892947559d874 | |
parent | d56deb378704dbb07ae616df011a2ed7cb375920 (diff) | |
download | puppet-daf0d9db5dc400a9795a5f741c8c63184f5e8982.tar.gz puppet-daf0d9db5dc400a9795a5f741c8c63184f5e8982.tar.xz puppet-daf0d9db5dc400a9795a5f741c8c63184f5e8982.zip |
Backporting a test that was failing in master, and fixing it
Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r-- | lib/puppet/node/catalog.rb | 1 | ||||
-rwxr-xr-x | spec/unit/node/catalog.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 720b3752d..17927388a 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -95,6 +95,7 @@ class Puppet::Node::Catalog < Puppet::PGraph # isn't sufficient. return if newref == resource.ref if existing = @resource_table[newref] + return if existing == resource raise(ArgumentError, "Cannot alias %s to %s; resource %s already exists" % [resource.ref, name, newref]) end @resource_table[newref] = resource diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index b4f1503da..45174e5e5 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -472,6 +472,11 @@ describe Puppet::Node::Catalog, " when functioning as a resource container" do @catalog.resource("me", "other").should equal(@one) end + it "should ignore conflicting aliases that point to the aliased resource" do + @catalog.alias(@one, "other") + lambda { @catalog.alias(@one, "other") }.should_not raise_error + end + it "should fail to add an alias if the aliased name already exists" do @catalog.add_resource @one proc { @catalog.alias @two, "one" }.should raise_error(ArgumentError) |