ey_stonith 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ module EY
11
11
  :dna => "/etc/chef/dna.json",
12
12
  :history => "/var/run/ey-monitor.history",
13
13
  :pid_path => "/var/run/ey-monitor.pid",
14
+ :log_path => "/var/log/ey-monitor.log",
14
15
  }
15
16
 
16
17
  def self.commands
@@ -29,7 +30,9 @@ module EY
29
30
 
30
31
  command :start do
31
32
  with_pid do
32
- EY::Stonith.meta_data = @options[:meta_data] if @options[:meta_data]
33
+ Stonith.meta_data = @options[:meta_data] if @options[:meta_data]
34
+ Stonith.logger = Logger.new(@config.log_path)
35
+ Stonith.logger.level = Logger::INFO
33
36
  EM.run { Box.new(@config, @history).start }
34
37
  end
35
38
  end
@@ -55,8 +58,8 @@ module EY
55
58
 
56
59
  def initialize(command, argv)
57
60
  parse!(argv)
58
- @config = Config.new(@options[:ey], @options[:redis], @options[:dna], @options[:history], @options[:pid_path])
59
- cmd = command.to_sym || :start
61
+ @config = Config.new(@options[:ey], @options[:redis], @options[:dna], @options[:history], @options[:pid_path], @options[:log_path])
62
+ cmd = command ? command.to_sym : :start
60
63
  @history = History.new(@config.history_path)
61
64
  instance_eval(&self.class.commands[cmd.to_sym])
62
65
  end
@@ -113,7 +116,11 @@ COMMANDS
113
116
 
114
117
  parser.on('-p', '--pid [FILE]', "Location of stonith pid file (default #{@options[:pid_path]}") do |path|
115
118
  @options[:pid_path] = Pathname.new(path)
116
- end
119
+ end
120
+
121
+ parser.on('-l', '--log [FILE]', "Location of stonith log file (default #{@options[:log_path]}") do |path|
122
+ @options[:log_path] = Pathname.new(path)
123
+ end
117
124
 
118
125
  parser.on_tail("-h", "--help", "Show this message") do
119
126
  puts parser
@@ -3,7 +3,7 @@ require 'json'
3
3
 
4
4
  module EY
5
5
  module Stonith
6
- class Config < Struct.new(:ey_cloud, :redis_yml, :dna_json, :history_path, :pid_path)
6
+ class Config < Struct.new(:ey_cloud, :redis_yml, :dna_json, :history_path, :pid_path, :log_path)
7
7
  def initialize(*args)
8
8
  super *args.map { |arg| arg && Pathname.new(arg) }
9
9
  end
data/lib/ey_stonith.rb CHANGED
@@ -21,9 +21,10 @@ module EY
21
21
  autoload :MetaData, 'ey_stonith/meta_data'
22
22
  autoload :Slave, 'ey_stonith/slave'
23
23
 
24
- @@logger = Logger.new(STDOUT)
25
- @@logger.level = Logger::INFO
24
+ def self.logger=(logger) @@logger = logger end
26
25
  def self.logger() @@logger end
26
+ self.logger = Logger.new(STDOUT)
27
+ logger.level = Logger::INFO
27
28
 
28
29
  def self.meta_data() @@meta_data end
29
30
  def self.meta_data=(meta) @@meta_data = meta end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ezra Zygmuntowicz
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-03-22 00:00:00 -07:00
19
+ date: 2010-03-23 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency