god 0.7.18 → 0.7.19

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.
@@ -1,3 +1,9 @@
1
+ == 0.7.19 / 2009-09-21
2
+ * Minor Enhancements
3
+ * Teach `god status` to take a task name as a param and return
4
+ an exit code of 0 if all watches are up or a non-zero exit code
5
+ (equal to the number of non-up watches) if they are not.
6
+
1
7
  == 0.7.18 / 2009-09-09
2
8
  * Minor Enhancements
3
9
  * Better handling of unexpected exceptions in conditions
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 7
4
- :patch: 18
4
+ :patch: 19
data/bin/god CHANGED
@@ -33,7 +33,7 @@ begin
33
33
  remove <task or group name> remove task or group from god
34
34
  load <file> load a config into a running god
35
35
  log <task name> show realtime log for given task
36
- status show status of each task
36
+ status [task or group name] show status
37
37
  signal <task or group name> <sig> signal all matching tasks
38
38
  quit stop god
39
39
  terminate stop god and all tasks
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{god}
5
- s.version = "0.7.18"
5
+ s.version = "0.7.19"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tom Preston-Werner"]
9
- s.date = %q{2009-09-10}
9
+ s.date = %q{2009-09-21}
10
10
  s.default_executable = %q{god}
11
11
  s.description = %q{God is an easy to configure, easy to extend monitoring framework written in Ruby.}
12
12
  s.email = %q{tom@mojombo.com}
@@ -66,6 +66,8 @@ module God
66
66
  end
67
67
 
68
68
  def status_command
69
+ task = @args[1]
70
+
69
71
  watches = {}
70
72
  @server.status.each do |name, status|
71
73
  g = status[:group] || ''
@@ -74,12 +76,34 @@ module God
74
76
  end
75
77
  watches[g][name] = status
76
78
  end
77
- watches.keys.sort.each do |group|
78
- puts "#{group}:" unless group.empty?
79
- watches[group].keys.sort.each do |name|
80
- state = watches[group][name][:state]
81
- print " " unless group.empty?
82
- puts "#{name}: #{state}"
79
+ if task
80
+ failcount = 0
81
+ if watches[task]
82
+ puts "#{task}:"
83
+ watches[task].keys.sort.each do |name|
84
+ state = watches[task][name][:state]
85
+ failcount += 1 if state != :up
86
+ print " " unless task.empty?
87
+ puts "#{name}: #{state}"
88
+ end
89
+ elsif watches['']
90
+ watches[''].keys.sort.each do |name|
91
+ state = watches[''][name][:state]
92
+ failcount += 1 if state != :up
93
+ puts "#{name}: #{state}"
94
+ end
95
+ else
96
+ failcount = 1
97
+ end
98
+ exit!(failcount)
99
+ else
100
+ watches.keys.sort.each do |group|
101
+ puts "#{group}:" unless group.empty?
102
+ watches[group].keys.sort.each do |name|
103
+ state = watches[group][name][:state]
104
+ print " " unless group.empty?
105
+ puts "#{name}: #{state}"
106
+ end
83
107
  end
84
108
  end
85
109
  end
@@ -6,17 +6,17 @@ require 'set'
6
6
 
7
7
  include God
8
8
 
9
- # if Process.uid != 0
10
- # abort <<-EOF
11
- # \n
12
- # *********************************************************************
13
- # * *
14
- # * You need to run these tests as root *
15
- # * chroot and netlink (linux only) require it *
16
- # * *
17
- # *********************************************************************
18
- # EOF
19
- # end
9
+ if Process.uid != 0
10
+ abort <<-EOF
11
+ \n
12
+ *********************************************************************
13
+ * *
14
+ * You need to run these tests as root *
15
+ * chroot and netlink (linux only) require it *
16
+ * *
17
+ *********************************************************************
18
+ EOF
19
+ end
20
20
 
21
21
  begin
22
22
  require 'mocha'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: god
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.18
4
+ version: 0.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-10 00:00:00 -07:00
12
+ date: 2009-09-21 00:00:00 -07:00
13
13
  default_executable: god
14
14
  dependencies: []
15
15