class KumoDockerCloud::HaproxyService

Public Class Methods

new(stack_name, docker_cloud_api = DockerCloudApi.new) click to toggle source
Calls superclass method
# File lib/kumo_dockercloud/haproxy_service.rb, line 3
def initialize(stack_name, docker_cloud_api = DockerCloudApi.new)
  super(stack_name, 'haproxy', docker_cloud_api)

  @client = docker_cloud_api.client
end

Public Instance Methods

disable_service(service) click to toggle source
# File lib/kumo_dockercloud/haproxy_service.rb, line 9
def disable_service(service)
  service_to_disable = service.name
  haproxy_containers = containers.map { |container| HaproxyContainer.new(container.uuid, @client) }

  raise KumoDockerCloud::HAProxyStateError.new('Could not get instances of the haproxy container for this environment') if haproxy_containers.empty?

  haproxy_containers.each do |haproxy_container|
    haproxy_container.disable_server(service_to_disable)
  end
end
enable_service(service) click to toggle source
# File lib/kumo_dockercloud/haproxy_service.rb, line 20
def enable_service(service)
  service_to_enable = service.name
  haproxy_containers = containers.map { |container| HaproxyContainer.new(container.uuid, @client) }

  raise KumoDockerCloud::HAProxyStateError.new('Could not get instances of the haproxy container for this environment') if haproxy_containers.empty?

  haproxy_containers.each do |haproxy_container|
    haproxy_container.enable_server(service_to_enable)
  end
end