Class: GoldenBrindle::Cluster::Base
- Defined in:
- lib/golden_brindle/actions/cluster.rb
Direct Known Subclasses
Actions::Cluster::Restart, Actions::Cluster::Start, Actions::Cluster::Stop
Instance Attribute Summary
Attributes inherited from Base
#done_validating, #original_args, #valid
Instance Method Summary collapse
Methods inherited from Base
#config_keys, #help, #initialize, #load_config, #options
Methods included from Validations
#can_change_user?, #failure, #valid?, #valid_dir?, #valid_exists?, #valid_file?, #valid_group?, #valid_user?
Constructor Details
This class inherits a constructor from GoldenBrindle::Base
Instance Method Details
#configure ⇒ Object
5 6 7 8 9 10 |
# File 'lib/golden_brindle/actions/cluster.rb', line 5 def configure [ ["-c", "--conf_path PATH", "Path to golden_brindle configuration files", :@cwd, "."], ["-V", "", "Verbose output", :@verbose, false] ] end |
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/golden_brindle/actions/cluster.rb', line 18 def run command = self.class.to_s.downcase.split('::').last counter = 0 errors = 0 Dir.chdir @cwd do Dir.glob("**/*.{yml,conf}").each do |conf| cmd = "golden_brindle #{command} -C #{File.join(@cwd,conf)}" cmd += " -d" if command == "start" #daemonize only when start puts cmd if @verbose output = `#{cmd}` puts output if @verbose status = $?.success? puts "golden_brindle #{command} returned an error." unless status status ? counter += 1 : errors += 1 end end puts "Success:#{counter}; Errors: #{errors}" end |
#validate ⇒ Object
12 13 14 15 16 |
# File 'lib/golden_brindle/actions/cluster.rb', line 12 def validate @cwd = File.(@cwd) valid_dir? @cwd, "Invalid path to golden_brindle configuration files: #{@cwd}" @valid end |