auxesis-flapjack 0.4.6 → 0.4.8

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.
@@ -16,8 +16,16 @@ options = Flapjack::NotifierManagerOptions.parse(args)
16
16
  worker_path = File.join(File.dirname(__FILE__), 'flapjack-notifier')
17
17
 
18
18
  # set up pid dir
19
- pid_dir = "/var/run/flapjack"
20
- FileUtils.mkdir_p(pid_dir)
19
+ pid_dir = "/var/run/flapjack/"
20
+ unless File.exists?(pid_dir)
21
+ puts "#{pid_dir} doesn't exist."
22
+ exit 2
23
+ end
24
+
25
+ unless File.writable?(pid_dir)
26
+ puts "Can't write to #{pid_dir} - check permissions?"
27
+ exit 2
28
+ end
21
29
 
22
30
  daemon_args = (args + ['--', '--beanstalk', options.host,
23
31
  '--port', options.port.to_s,
data/flapjack.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'flapjack'
3
- s.version = '0.4.6'
3
+ s.version = '0.4.8'
4
4
  s.date = '2009-07-14'
5
5
 
6
6
  s.summary = "a scalable and distributed monitoring system"
@@ -41,15 +41,17 @@ module Flapjack
41
41
  options.host ||= "localhost"
42
42
  options.port ||= 11300
43
43
 
44
- unless options.recipients =~ /.+/
45
- puts "You must specify a recipients file!\n\n"
46
- puts opts
47
- exit 2
48
- end
49
-
50
- unless File.exists?(options.recipients)
51
- puts "The specified recipients file doesn't exist!"
52
- exit 2
44
+ unless ARGV[0] == "stop"
45
+ unless options.recipients =~ /.+/
46
+ puts "You must specify a recipients file!\n\n"
47
+ puts opts
48
+ exit 2
49
+ end
50
+
51
+ unless File.exists?(options.recipients)
52
+ puts "The specified recipients file doesn't exist!"
53
+ exit 2
54
+ end
53
55
  end
54
56
 
55
57
  unless %w(start stop restart).include?(args[0])
@@ -11,7 +11,7 @@ module Flapjack
11
11
 
12
12
  def initialize(opts={})
13
13
  @from_address = opts[:from_address]
14
- @website_uri = opts[:website_uri].gsub(/\/$/, '')
14
+ @website_uri = opts[:website_uri] ? opts[:website_uri].gsub(/\/$/, '') : "http://#{`hostname`}"
15
15
  @log = opts[:logger]
16
16
  @log ||= Log4r::Logger.new("notifier")
17
17
  end
@@ -10,10 +10,16 @@ module Flapjack
10
10
 
11
11
  @jid = opts[:jid]
12
12
  @password = opts[:password]
13
+ @log = opts[:logger]
13
14
  unless @jid && @password
14
15
  raise ArgumentError, "You have to provide a username and password"
15
16
  end
16
- @xmpp = Jabber::Simple.new(@jid, @password)
17
+
18
+ begin
19
+ @xmpp = Jabber::Simple.new(@jid, @password)
20
+ rescue SocketError => e
21
+ @log.error("XMPP: #{e.message}")
22
+ end
17
23
 
18
24
  end
19
25
 
@@ -15,3 +15,9 @@ module Daemons
15
15
  end
16
16
  end
17
17
  end
18
+
19
+ class Log4r::Logger
20
+ def error(args)
21
+ err(args)
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auxesis-flapjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindsay Holmwood