mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2924 from rackspace/lb_tweak
[rackspace|loadbalancers] Fix requiring nodes during load balancer creation
This commit is contained in:
commit
b428a858ac
2 changed files with 15 additions and 7 deletions
|
@ -37,11 +37,15 @@ module Fog
|
|||
end
|
||||
|
||||
def access_rules
|
||||
@access_rules ||= begin
|
||||
Fog::Rackspace::LoadBalancers::AccessRules.new({
|
||||
unless @access_rules
|
||||
@access_rules = Fog::Rackspace::LoadBalancers::AccessRules.new({
|
||||
:service => service,
|
||||
:load_balancer => self})
|
||||
|
||||
# prevents loading access rules from non-existent load balancers
|
||||
@access_rules.clear unless persisted?
|
||||
end
|
||||
@access_rules
|
||||
end
|
||||
|
||||
def access_rules=(new_access_rules=[])
|
||||
|
@ -49,11 +53,15 @@ module Fog
|
|||
end
|
||||
|
||||
def nodes
|
||||
@nodes ||= begin
|
||||
Fog::Rackspace::LoadBalancers::Nodes.new({
|
||||
:service => service,
|
||||
:load_balancer => self})
|
||||
unless @nodes
|
||||
@nodes = Fog::Rackspace::LoadBalancers::Nodes.new({
|
||||
:service => service,
|
||||
:load_balancer => self})
|
||||
|
||||
# prevents loading nodes from non-existent load balancers
|
||||
@nodes.clear unless persisted?
|
||||
end
|
||||
@nodes
|
||||
end
|
||||
|
||||
def nodes=(new_nodes=[])
|
||||
|
|
|
@ -9,10 +9,10 @@ module Fog
|
|||
'port' => port,
|
||||
'protocol' => protocol,
|
||||
'virtualIps' => virtual_ips,
|
||||
'nodes' => nodes
|
||||
}
|
||||
}
|
||||
|
||||
data['loadBalancer']['nodes'] = nodes if nodes && !nodes.empty?
|
||||
data['loadBalancer']['algorithm'] = options[:algorithm] if options.has_key? :algorithm
|
||||
data['loadBalancer']['timeout'] = options[:timeout] if options.has_key? :timeout
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue