notifyme 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/notifyme/log/mail.rb +2 -2
- data/lib/notifyme/log.rb +26 -2
- data/lib/notifyme/start.rb +1 -1
- data/lib/notifyme.rb +1 -0
- metadata +18 -2
data/lib/notifyme/log/mail.rb
CHANGED
@@ -20,8 +20,8 @@ module NotifyMe
|
|
20
20
|
|
21
21
|
default_from_email = 'notifyme@' + default_host
|
22
22
|
|
23
|
-
param[:subject] = "NotifyMe report:
|
24
|
-
param[:subject] = param[:subject] %
|
23
|
+
param[:subject] = "NotifyMe report (#{fact(:hostname)} # #{fact(:ipaddress)}): #{task.name}"
|
24
|
+
param[:subject] = param[:subject] %
|
25
25
|
|
26
26
|
param[:from_email] ||= param[:account]
|
27
27
|
param[:from_email] ||= default_from_email
|
data/lib/notifyme/log.rb
CHANGED
@@ -35,6 +35,10 @@ module NotifyMe
|
|
35
35
|
@parameters = parameters
|
36
36
|
end
|
37
37
|
|
38
|
+
def fact(name)
|
39
|
+
Facter.fact(name).value
|
40
|
+
end
|
41
|
+
|
38
42
|
def can_log?(task)
|
39
43
|
history = @@log_history[task.name]
|
40
44
|
return true if history.nil?
|
@@ -73,6 +77,13 @@ module NotifyMe
|
|
73
77
|
def to_xml(task)
|
74
78
|
require 'rexml/document'
|
75
79
|
xml = REXML::Element.new 'task'
|
80
|
+
|
81
|
+
extra_task_info.each do |k, v|
|
82
|
+
el = REXML::Element.new k.to_s
|
83
|
+
el.text = v.to_s
|
84
|
+
xml.add_element el
|
85
|
+
end
|
86
|
+
|
76
87
|
fields.each do |f|
|
77
88
|
el = REXML::Element.new f.to_s
|
78
89
|
el.text = task.send(f)
|
@@ -83,7 +94,7 @@ module NotifyMe
|
|
83
94
|
|
84
95
|
def to_csv(task)
|
85
96
|
require 'csv'
|
86
|
-
row =
|
97
|
+
row = extra_task_info.values
|
87
98
|
fields.each do |f|
|
88
99
|
row << task.send(f)
|
89
100
|
end
|
@@ -92,6 +103,11 @@ module NotifyMe
|
|
92
103
|
|
93
104
|
def to_text(task)
|
94
105
|
output = ''
|
106
|
+
output << "\nSystem info:\n---------------\n"
|
107
|
+
extra_task_info.each do |k, v|
|
108
|
+
output << "#{k}: #{v}\n"
|
109
|
+
end
|
110
|
+
output << "\nTask info:\n---------------\n"
|
95
111
|
fields.each do |f|
|
96
112
|
output << "#{f}: #{task.send(f)}\n"
|
97
113
|
end
|
@@ -99,7 +115,7 @@ module NotifyMe
|
|
99
115
|
end
|
100
116
|
|
101
117
|
def to_hash(task)
|
102
|
-
hash =
|
118
|
+
hash = extra_task_info
|
103
119
|
fields.each do |f|
|
104
120
|
hash[f] = task.send(f)
|
105
121
|
end
|
@@ -109,6 +125,14 @@ module NotifyMe
|
|
109
125
|
def fields
|
110
126
|
[:name, :sleep_time, :start_run_time, :end_run_time, :result]
|
111
127
|
end
|
128
|
+
|
129
|
+
def extra_task_info
|
130
|
+
{
|
131
|
+
:hostname => fact(:hostname),
|
132
|
+
:ipaddress => fact(:ipaddress),
|
133
|
+
:system => fact(:lsbdistdescription)
|
134
|
+
}
|
135
|
+
end
|
112
136
|
end
|
113
137
|
end
|
114
138
|
end
|
data/lib/notifyme/start.rb
CHANGED
data/lib/notifyme.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifyme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.1.13
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: facter
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.6.17
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.6.17
|
62
78
|
description: NotifyMe takes care more than one tasks and process their results for
|
63
79
|
you, it's similar to *NIX's cronjob but can do more.
|
64
80
|
email: xianhua.zhou@gmail.com
|