[PATCH conductor 2/9] Make Strict Order strategy compatible with the changes
ifarkas at redhat.com
ifarkas at redhat.com
Thu Aug 16 14:44:02 UTC 2012
From: Imre Farkas <ifarkas at redhat.com>
---
.../strategies/strict_order/strategy.rb | 45 ++++++++++++++++++++++
.../strategies/strict_order/strict_order.rb | 30 +++++----------
2 files changed, 54 insertions(+), 21 deletions(-)
create mode 100644 src/vendor/provider_selection/strategies/strict_order/strategy.rb
diff --git a/src/vendor/provider_selection/strategies/strict_order/strategy.rb b/src/vendor/provider_selection/strategies/strict_order/strategy.rb
new file mode 100644
index 0000000..b33e18d
--- /dev/null
+++ b/src/vendor/provider_selection/strategies/strict_order/strategy.rb
@@ -0,0 +1,45 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module ProviderSelection
+ module Strategies
+ module StrictOrder
+
+ class Strategy
+
+ include ProviderSelection::ChainableStrategy::InstanceMethods
+
+ def calculate
+ rank = @strategies.calculate
+
+ if rank.pool.provider_priority_groups.any?
+ rank.pool.provider_priority_groups.each do |priority_group|
+ new_priority_group =
+ ProviderSelection::PriorityGroup.
+ create_from_active_record(priority_group,
+ rank.default_priority_group.matches)
+ rank.priority_groups << new_priority_group if new_priority_group.present?
+ end
+ end
+
+ rank
+ end
+
+ end
+
+ end
+ end
+end
diff --git a/src/vendor/provider_selection/strategies/strict_order/strict_order.rb b/src/vendor/provider_selection/strategies/strict_order/strict_order.rb
index 8847e32..d4a82fa 100644
--- a/src/vendor/provider_selection/strategies/strict_order/strict_order.rb
+++ b/src/vendor/provider_selection/strategies/strict_order/strict_order.rb
@@ -14,35 +14,23 @@
# limitations under the License.
#
-module ProviderSelection
- module Strategies
+require File.join(File.dirname(__FILE__), 'strategy')
- class StrictOrder
- include ProviderSelection::ChainableStrategy::InstanceMethods
- extend ProviderSelection::ChainableStrategy::ClassMethods
+module ProviderSelection
+ module Strategies
+ module StrictOrder
- @properties = {
- :edit_path => 'pool_provider_selection_provider_priority_groups_path'
- }
+ class Base
- def calculate
- rank = @strategies.calculate
+ extend ProviderSelection::ChainableStrategyOptions::ClassMethods
- if rank.pool.provider_priority_groups.any?
- rank.pool.provider_priority_groups.each do |priority_group|
- new_priority_group =
- ProviderSelection::PriorityGroup.
- create_from_active_record(priority_group,
- rank.default_priority_group.matches)
- rank.priority_groups << new_priority_group if new_priority_group.present?
- end
- end
+ @properties = {
+ :edit_path => 'pool_provider_selection_provider_priority_groups_path'
+ }
- rank
end
end
-
end
end
--
1.7.11.2
More information about the aeolus-devel
mailing list