Sha256: 6b62a7c577088805a2ef187c39a7689512d329ad6221987db5b837dacc3e6975

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

module MKIt
  class HAProxyWorker < AWorker

    def topics
      %w{create_proxy_config destroy_proxy_config update_proxy_config restart_proxy reload_proxy}
    end

    def do_the(job)
      MKItLogger.info("#{self.class} working on the job #{job.inspect}....")
      unless job.service_id.nil?
        srv = Service.find(job.service_id)
        config = srv.proxy_config
      end
      case job.topic.to_sym
      when :update_proxy_config
        MKItLogger.debug config.inspect
        MKIt::HAProxy.create_config_file(filename: config[:filename], data: config[:data])
        MKIt::HAProxy.reload
      when :destroy_proxy_config
        MKIt::HAProxy.delete_config_file(filename: job.data['filename'])
        MKIt::HAProxy.reload
      when :create_proxy_config
        MKIt::HAProxy.create_config_file(filename: config[:filename], data: config[:data])
        MKIt::HAProxy.reload
      when :reload_proxy
        MKIt::HAProxy.reload
      when :restart_proxy
        MKIt::HAProxy.restart
      else
        MKItLogger.warn("#{self.class} <<TODO>> job #{job.inspect}....")
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.8.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.7.2 lib/mkit/workers/haproxy_worker.rb
mkit-0.7.1 lib/mkit/workers/haproxy_worker.rb
mkit-0.7.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.6.3 lib/mkit/workers/haproxy_worker.rb
mkit-0.6.2 lib/mkit/workers/haproxy_worker.rb
mkit-0.6.1 lib/mkit/workers/haproxy_worker.rb
mkit-0.6.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.5.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.4.3 lib/mkit/workers/haproxy_worker.rb
mkit-0.4.2 lib/mkit/workers/haproxy_worker.rb
mkit-0.4.1 lib/mkit/workers/haproxy_worker.rb
mkit-0.4.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.3.0 lib/mkit/workers/haproxy_worker.rb
mkit-0.2.0 lib/mkit/workers/haproxy_worker.rb