diff options
author | Thomas Wiest <twiest@redhat.com> | 2014-12-15 16:00:47 -0500 |
---|---|---|
committer | Thomas Wiest <twiest@redhat.com> | 2014-12-15 16:00:47 -0500 |
commit | 023f92f9e3eec7de6c1286549000be79189a4fde (patch) | |
tree | 0bb33e5ee852ea533f1f808a8e86e38c97699bb4 /roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb | |
parent | 2848232bdaed44fadb51548fe9d6c39fe89b8e11 (diff) | |
download | openshift-023f92f9e3eec7de6c1286549000be79189a4fde.tar.gz openshift-023f92f9e3eec7de6c1286549000be79189a4fde.tar.bz2 openshift-023f92f9e3eec7de6c1286549000be79189a4fde.tar.xz openshift-023f92f9e3eec7de6c1286549000be79189a4fde.zip |
changed atomic proxy to use pre-built container images
Diffstat (limited to 'roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb')
-rwxr-xr-x | roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb b/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb deleted file mode 100755 index 202a58124..000000000 --- a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -module OpenShift - module Ops - class Notify - def self.puts(msg) - $stdout.puts "#{Time.now}: #{msg}" - end - end - - class WatchForIpcs - IPC_DIR = '/var/run/ctr-ipc' - POLL_INTERVAL = 10 # second - HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' - HAPROXY_PID_FILE = '/var/run/haproxy.pid' - - def self.wait_for_service() - loop do - Dir.glob("#{IPC_DIR}/service/*").each do |svc_file| - svc = File.basename(svc_file) - action = File.read(svc_file) - Notify.puts "Found IPC service file: #{svc}" - Notify.puts " Action requested: #{action}" - - # Make sure we don't handle this multiple times - FileUtils.rm(svc_file) - - handle_service_ipc(svc, action) - end - - sleep POLL_INTERVAL - end - end - - def self.handle_service_ipc(svc, action) - cmd = nil - case svc - when 'httpd' - case action - when 'restart', 'reload' - cmd = "/usr/sbin/apachectl -k graceful" - end - when 'haproxy' - case action - when 'restart' - cmd = "/usr/sbin/haproxy -f #{HAPROXY_CONF} -p #{HAPROXY_PID_FILE} -sf $(/bin/cat #{HAPROXY_PID_FILE})" - end - end - - if cmd.nil? - Notify.puts " Warning: Not handling #{svc} #{action}" - return - end - - Notify.puts " Running: #{cmd}" - output = %x[#{cmd} 2>&1] - Notify.puts " Output: #{output}" - end - end - end -end - -if __FILE__ == $0 - OpenShift::Ops::WatchForIpcs.wait_for_service() -end |