Sophie

Sophie

distrib > Fedora > 16 > x86_64 > by-pkgid > a81ca95b69f26d8f7c7b906346041e14 > files > 1

wallaby-0.15.1-3.fc16.src.rpm

From 2c584644a5fc8e0dd0b1bc0e3919c27a112fd9ff Mon Sep 17 00:00:00 2001
From: Will Benton <willb@redhat.com>
Date: Thu, 21 Jun 2012 16:18:07 -0500
Subject: [PATCH 01/11] Fixes to skeleton group support.

In older versions of Wallaby, the default group configuration
could take precedence over the skeleton group configuration
for walk-in nodes.  This commit fixes that behavior and adds
regression tests to identify it in the future.
---
 lib/mrg/grid/config/Configuration.rb |    4 ++--
 spec/skeleton_group_spec.rb          |   17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/mrg/grid/config/Configuration.rb b/lib/mrg/grid/config/Configuration.rb
index 4adc725..36629e7 100644
--- a/lib/mrg/grid/config/Configuration.rb
+++ b/lib/mrg/grid/config/Configuration.rb
@@ -425,7 +425,7 @@ module Mrg
 
               return 0 if version == 0
 
-              groups = Store::ENABLE_SKELETON_GROUP ? [skel, default] : [default]
+              groups = Store::ENABLE_SKELETON_GROUP ? [default, skel] : [default]
               toc, = VersionedNodeConfig.find_freshest(:select_by=>{:node=>VersionedNode[to]}, :group_by=>[:node], :version=>ver)
               
               unless toc
@@ -448,7 +448,7 @@ module Mrg
           
            def internal_set_node_config(node, config)
              node_obj = VersionedNode[node]
-             vnc = VersionedNodeConfig.create(:version=>self, :node=>node_obj, :config=>config)
+             vnc = VersionedNodeConfig.create(:version=>self, :node=>node_obj, :config=>config) 
              # vnc.send(:update, :created, self.version)
            end
           end
diff --git a/spec/skeleton_group_spec.rb b/spec/skeleton_group_spec.rb
index b423bcd..838b9a5 100644
--- a/spec/skeleton_group_spec.rb
+++ b/spec/skeleton_group_spec.rb
@@ -27,7 +27,7 @@ module Mrg
           end
 
           ["when another node exists at activation", "when no other nodes exist at activation"].each do |dowhen|
-            it "should give new #{kind} nodes the last-activated configuration for the skeleton group #{dowhen}" do
+            it "should give new #{kind} nodes the last-activated configuration for the skeleton group #{dowhen} and there is no default group" do
               @store.addParam("FOO")
               n_expected = @store.addNode("blah") if dowhen == "when another node exists at activation"
               g = @store.getGroupByName(Group::SKELETON_GROUP_NAME)
@@ -38,6 +38,21 @@ module Mrg
               n = @store.send(msg, "fake")
               n.getConfig("version"=>::Rhubarb::Util::timestamp)["FOO"].should == "BAR"
             end
+
+            it "should give new #{kind} nodes the last-activated configuration for the skeleton group #{dowhen} and there is a default group" do
+              @store.addParam("FOO")
+              @store.getDefaultGroup.modifyParams("REPLACE", {"FOO"=>"ARGH"}, {})
+              @store.activateConfiguration
+              n_expected = @store.addNode("blah") if dowhen == "when another node exists at activation"
+              g = @store.getGroupByName(Group::SKELETON_GROUP_NAME)
+              g.modifyParams("REPLACE", {"FOO"=>"BAR"})
+              @store.activateConfiguration
+              g.modifyParams("REPLACE", {"FOO"=>"BLAH"})
+              
+              n = @store.send(msg, "fake")
+
+              n.getConfig("version"=>::Rhubarb::Util::timestamp)["FOO"].should == "BAR"
+            end
           end
         end
 
-- 
1.7.7.6