From bc21cc0286f9642f149c0deda2d2f4648ec7f300 Mon Sep 17 00:00:00 2001 From: Varun Tiwari Date: Fri, 26 May 2017 13:28:13 -0700 Subject: [PATCH] fix haproxyctl start/stop issue as it wasn't starting all the services on controller plane --- lib/haproxyctl.rb | 2 +- lib/haproxyctl/environment.rb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/haproxyctl.rb b/lib/haproxyctl.rb index 07e88fe..8bb1b3e 100644 --- a/lib/haproxyctl.rb +++ b/lib/haproxyctl.rb @@ -7,7 +7,7 @@ module HAProxyCTL def start puts 'starting haproxy...' - system("#{exec} -f #{config_path} -D -p #{pidfile}") + system("#{exec} -f #{config_path} #{conf_fol} -D -p #{pidfile}") newpids = check_running if newpids.all? {|newpid| newpid =~ /^\d+$/} puts "haproxy is running on pid #{newpids.join(', ')}" diff --git a/lib/haproxyctl/environment.rb b/lib/haproxyctl/environment.rb index aee53fd..625251a 100644 --- a/lib/haproxyctl/environment.rb +++ b/lib/haproxyctl/environment.rb @@ -1,6 +1,6 @@ module HAProxyCTL module Environment - attr_accessor :pidof, :config_path, :config, :exec + attr_accessor :pidof, :config_path, :config, :exec, :conf_fol def version puts "HAProxyCTL #{HAProxyCTL::VERSION}" @@ -18,6 +18,17 @@ def has_exec? !exec.nil? end + def conf_fol + @conf_fol ||= begin + @x = "" + Dir.foreach('/etc/haproxy/conf.d') do |i| + next if i == '.' or i == '..' + @x = "#{@x} -f /etc/haproxy/conf.d/#{i}" + end + (@x) + end + end + def exec return(@exec) if @exec