Class: Halb::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/halb/deploy.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(load_balancers, machine) ⇒ Deploy

Returns a new instance of Deploy.



5
6
7
8
# File 'lib/halb/deploy.rb', line 5

def initialize(load_balancers, machine)
  @load_balancers=load_balancers
  @machine = machine
end

Class Method Details

.with(load_balancers, machines) ⇒ Object



10
11
12
13
# File 'lib/halb/deploy.rb', line 10

def self.with(load_balancers, machines)
  this_machine = machines[Socket.gethostname.downcase]
  new(load_balancers, this_machine)
end

Instance Method Details

#active_balancerObject



15
16
17
# File 'lib/halb/deploy.rb', line 15

def active_balancer
  @load_balancers.detect { |lb| lb.active? }
end

#put_into_productionObject



23
24
25
# File 'lib/halb/deploy.rb', line 23

def put_into_production
  active_balancer.remove_from_maintenance(@machine)
end

#remove_from_productionObject



19
20
21
# File 'lib/halb/deploy.rb', line 19

def remove_from_production
  active_balancer.put_in_maintenance(@machine)
end