deputy 0.1.56 → 0.1.57
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/Readme.md +8 -0
- data/VERSION +1 -1
- data/bin/deputy +1 -0
- data/deputy.gemspec +8 -9
- data/lib/deputy.rb +16 -7
- metadata +7 -8
data/.gitmodules
ADDED
data/Readme.md
CHANGED
@@ -4,7 +4,10 @@ Report values to [Sheriff](https://github.com/dawanda/sheriff) or run plugins fr
|
|
4
4
|
|
5
5
|
sudo gem install deputy
|
6
6
|
|
7
|
+
# Configuration
|
8
|
+
|
7
9
|
Put into `~/.deputy.yml` or `/etc/deputy.yml`
|
10
|
+
|
8
11
|
sheriff_url: http://sheriff.mydomain.com
|
9
12
|
# overwrite defaults if needed
|
10
13
|
max_random_start_delay: 30
|
@@ -12,8 +15,13 @@ Put into `~/.deputy.yml` or `/etc/deputy.yml`
|
|
12
15
|
silent_on_errors: true
|
13
16
|
|
14
17
|
Basic auth login can be added to the url:
|
18
|
+
|
15
19
|
sheriff_url: http://username:password@sheriff.mydomain.com
|
16
20
|
|
21
|
+
Disable Deputy for local use:
|
22
|
+
|
23
|
+
disabled: true
|
24
|
+
|
17
25
|
Add deputy to cron with `deputy --install-cron` (logs to /tmp/deputy.log)
|
18
26
|
|
19
27
|
# Usage
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.57
|
data/bin/deputy
CHANGED
@@ -19,6 +19,7 @@ BANNER
|
|
19
19
|
|
20
20
|
opts.on("-h", "--help","Show this.") { puts opts; exit }
|
21
21
|
opts.on('-v', '--version','Show Version'){ puts Deputy::VERSION; exit}
|
22
|
+
opts.on('-vv', '--verbose','Verbose Mode'){ options[:verbose] = true }
|
22
23
|
opts.on('--install-cron','Install crontask'){ Deputy.install_cron; exit}
|
23
24
|
opts.on('--no-wait','Do not wait before executing plugins'){ options[:no_wait] = true }
|
24
25
|
opts.on('--run-plugins','Run all plugins for this minute (belongs into crontask)') do
|
data/deputy.gemspec
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.1.
|
7
|
+
s.name = "deputy"
|
8
|
+
s.version = "0.1.57"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date =
|
13
|
-
s.
|
14
|
-
s.email = %q{mirko@dawanda.com}
|
12
|
+
s.date = "2012-11-05"
|
13
|
+
s.email = "mirko@dawanda.com"
|
15
14
|
s.executables = ["deputy"]
|
16
15
|
s.files = [
|
16
|
+
".gitmodules",
|
17
17
|
"Gemfile",
|
18
18
|
"Gemfile.lock",
|
19
19
|
"Rakefile",
|
@@ -25,17 +25,16 @@ Gem::Specification.new do |s|
|
|
25
25
|
"spec/deputy_spec.rb",
|
26
26
|
"spec/spec_helper.rb"
|
27
27
|
]
|
28
|
-
s.homepage =
|
28
|
+
s.homepage = "http://github.com/dawanda/deputy"
|
29
29
|
s.require_paths = ["lib"]
|
30
|
-
s.rubygems_version =
|
31
|
-
s.summary =
|
30
|
+
s.rubygems_version = "1.8.24"
|
31
|
+
s.summary = "Report to the sheriff"
|
32
32
|
s.test_files = [
|
33
33
|
"spec/deputy_spec.rb",
|
34
34
|
"spec/spec_helper.rb"
|
35
35
|
]
|
36
36
|
|
37
37
|
if s.respond_to? :specification_version then
|
38
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
39
38
|
s.specification_version = 3
|
40
39
|
|
41
40
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/deputy.rb
CHANGED
@@ -8,7 +8,7 @@ def eval_and_fetch_constants(x)
|
|
8
8
|
begin
|
9
9
|
eval(x)
|
10
10
|
rescue Exception => e
|
11
|
-
raise e unless Deputy.config['silent_on_errors']
|
11
|
+
raise e unless Deputy.config['silent_on_errors']
|
12
12
|
end
|
13
13
|
new = (Module.constants.map{|c| c.to_s} - old)
|
14
14
|
new = new.select{|c| c.to_s =~ /^TEMP/ } # do not fetch required libs, just user-defined
|
@@ -108,7 +108,7 @@ module Deputy
|
|
108
108
|
start_time = Time.now.to_i
|
109
109
|
sleep_random_interval unless options[:no_wait]
|
110
110
|
|
111
|
-
content = get("/plugins.rb")
|
111
|
+
content = get("/plugins.rb", options)
|
112
112
|
|
113
113
|
exceptions = []
|
114
114
|
Scout.plugins(content).each do |interval, plugin|
|
@@ -146,14 +146,22 @@ module Deputy
|
|
146
146
|
url = "http://#{url}" unless url =~ %r{://}
|
147
147
|
options[:http_basic_authentication] = extract_auth_from_url!(url)
|
148
148
|
url = add_host_to_url(url, options.delete(:host))
|
149
|
+
puts "getting #{url} with options: #{options.inspect}" if options[:verbose]
|
149
150
|
|
150
|
-
|
151
|
-
|
151
|
+
http_options = {}
|
152
|
+
http_options[:http_basic_authentication] = options[:http_basic_authentication] if options[:http_basic_authentication]
|
153
|
+
|
154
|
+
res = Timeout.timeout(config['timeout']||10) do
|
155
|
+
open(url, http_options).read
|
152
156
|
end
|
157
|
+
puts "result: #{res.inspect}" if options[:verbose]
|
158
|
+
res
|
153
159
|
rescue Exception => e
|
154
160
|
e.message << url.to_s
|
155
|
-
unless config['silent_on_errors']
|
161
|
+
unless config['silent_on_errors']
|
156
162
|
raise e
|
163
|
+
else
|
164
|
+
puts "caught error: #{e.message} with #{e.backtrace}"
|
157
165
|
end
|
158
166
|
end
|
159
167
|
|
@@ -163,10 +171,11 @@ module Deputy
|
|
163
171
|
|
164
172
|
def self.config
|
165
173
|
home = File.expand_path('~')
|
166
|
-
["#{home}/.deputy.yml", '/etc/deputy.yml']
|
174
|
+
possible_config_files = ["#{home}/.deputy.yml", '/etc/deputy.yml']
|
175
|
+
possible_config_files.each do |file|
|
167
176
|
return YAML.load(File.read(file)) if File.exist?(file)
|
168
177
|
end
|
169
|
-
raise "No
|
178
|
+
raise "No configuration file found in " + possible_config_files.join('or') + "\nSee http://github.com/dawanda/deputy for more documentation"
|
170
179
|
end
|
171
180
|
|
172
181
|
def self.minutes_to_wait(start_time, interval)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deputy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 105
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 57
|
10
|
+
version: 0.1.57
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable: deputy
|
18
|
+
date: 2012-11-05 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description:
|
@@ -28,6 +27,7 @@ extensions: []
|
|
28
27
|
extra_rdoc_files: []
|
29
28
|
|
30
29
|
files:
|
30
|
+
- .gitmodules
|
31
31
|
- Gemfile
|
32
32
|
- Gemfile.lock
|
33
33
|
- Rakefile
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- lib/deputy.rb
|
39
39
|
- spec/deputy_spec.rb
|
40
40
|
- spec/spec_helper.rb
|
41
|
-
has_rdoc: true
|
42
41
|
homepage: http://github.com/dawanda/deputy
|
43
42
|
licenses: []
|
44
43
|
|
@@ -68,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
67
|
requirements: []
|
69
68
|
|
70
69
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
70
|
+
rubygems_version: 1.8.24
|
72
71
|
signing_key:
|
73
72
|
specification_version: 3
|
74
73
|
summary: Report to the sheriff
|