ey_enzyme 0.9.44.c21 → 0.9.44.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_enzyme/multi_logger.rb +0 -14
- data/lib/ey_enzyme/version.rb +1 -1
- metadata +79 -159
- data/spec/api_spec.rb +0 -44
- data/spec/log_upload_error_notify_spec.rb +0 -45
- data/spec/logging_spec.rb +0 -21
- data/spec/retry_report_and_notify_success_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -9
@@ -1,19 +1,9 @@
|
|
1
|
-
require 'logglier'
|
2
|
-
|
3
1
|
module EY::Enzyme
|
4
2
|
class MultiLogger
|
5
3
|
|
6
|
-
def self.loggly_url
|
7
|
-
'https://logs.engineyard.loggly.com/inputs/7d877a85-c36a-4e60-a6ba-1d55185e2b91'
|
8
|
-
end
|
9
|
-
|
10
4
|
def initialize(log_file)
|
11
5
|
@enzyme_log = Logger.new(log_file)
|
12
6
|
@stderr_log = Logger.new($stderr)
|
13
|
-
begin
|
14
|
-
@loggly_log = Logglier.new(self.class.loggly_url, :verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
15
|
-
rescue
|
16
|
-
end
|
17
7
|
end
|
18
8
|
|
19
9
|
def debug(message)
|
@@ -37,10 +27,6 @@ module EY::Enzyme
|
|
37
27
|
def log(level, message)
|
38
28
|
@stderr_log.send(level, message)
|
39
29
|
@enzyme_log.send(level, message)
|
40
|
-
begin
|
41
|
-
@loggly_log.send(level, message) if @loggly_log
|
42
|
-
rescue
|
43
|
-
end
|
44
30
|
end
|
45
31
|
end
|
46
32
|
end
|
data/lib/ey_enzyme/version.rb
CHANGED
metadata
CHANGED
@@ -1,171 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_enzyme
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.44.pre
|
5
5
|
prerelease: 7
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 44
|
10
|
-
- c
|
11
|
-
- 21
|
12
|
-
version: 0.9.44.c21
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Engine Yard Inc.
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2010-02-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: json
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70297366943200 !ruby/object:Gem::Requirement
|
26
17
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rest-client
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *70297366943200
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rest-client
|
27
|
+
requirement: &70297366942680 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 13
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 6
|
48
|
-
- 1
|
31
|
+
- !ruby/object:Gem::Version
|
49
32
|
version: 1.6.1
|
50
33
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: chef
|
54
34
|
prerelease: false
|
55
|
-
|
35
|
+
version_requirements: *70297366942680
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: chef
|
38
|
+
requirement: &70297366942200 !ruby/object:Gem::Requirement
|
56
39
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 10
|
64
|
-
- 8
|
65
|
-
- patch
|
66
|
-
- 3
|
67
|
-
version: 0.10.8.patch3
|
40
|
+
requirements:
|
41
|
+
- - =
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.6.0.2
|
68
44
|
type: :runtime
|
69
|
-
version_requirements: *id003
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: chef-deploy
|
72
45
|
prerelease: false
|
73
|
-
|
46
|
+
version_requirements: *70297366942200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: chef-deploy
|
49
|
+
requirement: &70297366941720 !ruby/object:Gem::Requirement
|
74
50
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 29
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
- 2
|
82
|
-
- 5
|
51
|
+
requirements:
|
52
|
+
- - =
|
53
|
+
- !ruby/object:Gem::Version
|
83
54
|
version: 0.2.5
|
84
55
|
type: :runtime
|
85
|
-
version_requirements: *id004
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: logglier
|
88
56
|
prerelease: false
|
89
|
-
|
90
|
-
|
91
|
-
requirements:
|
92
|
-
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
hash: 29
|
95
|
-
segments:
|
96
|
-
- 0
|
97
|
-
- 2
|
98
|
-
- 5
|
99
|
-
version: 0.2.5
|
100
|
-
type: :runtime
|
101
|
-
version_requirements: *id005
|
102
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *70297366941720
|
58
|
+
- !ruby/object:Gem::Dependency
|
103
59
|
name: rake
|
104
|
-
|
105
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70297366941240 !ruby/object:Gem::Requirement
|
106
61
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
segments:
|
112
|
-
- 0
|
113
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
114
66
|
type: :development
|
115
|
-
version_requirements: *id006
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: rspec
|
118
67
|
prerelease: false
|
119
|
-
|
68
|
+
version_requirements: *70297366941240
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: &70297366940760 !ruby/object:Gem::Requirement
|
120
72
|
none: false
|
121
|
-
requirements:
|
73
|
+
requirements:
|
122
74
|
- - ~>
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
|
125
|
-
segments:
|
126
|
-
- 1
|
127
|
-
- 2
|
128
|
-
version: "1.2"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.2'
|
129
77
|
type: :development
|
130
|
-
version_requirements: *id007
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: fakeweb
|
133
78
|
prerelease: false
|
134
|
-
|
79
|
+
version_requirements: *70297366940760
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: fakeweb
|
82
|
+
requirement: &70297366940280 !ruby/object:Gem::Requirement
|
135
83
|
none: false
|
136
|
-
requirements:
|
137
|
-
- -
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
version: "0"
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
143
88
|
type: :development
|
144
|
-
version_requirements: *id008
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: fakeweb-matcher
|
147
89
|
prerelease: false
|
148
|
-
|
90
|
+
version_requirements: *70297366940280
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: fakeweb-matcher
|
93
|
+
requirement: &70297366939800 !ruby/object:Gem::Requirement
|
149
94
|
none: false
|
150
|
-
requirements:
|
151
|
-
- -
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
|
154
|
-
segments:
|
155
|
-
- 0
|
156
|
-
version: "0"
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
157
99
|
type: :development
|
158
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70297366939800
|
159
102
|
description: Gem for kicking off chef recipes
|
160
103
|
email: ninja@engineyard.com
|
161
|
-
executables:
|
104
|
+
executables:
|
162
105
|
- ey-enzyme
|
163
106
|
- ey-recipes
|
164
107
|
extensions: []
|
165
|
-
|
166
108
|
extra_rdoc_files: []
|
167
|
-
|
168
|
-
files:
|
109
|
+
files:
|
169
110
|
- lib/ey_enzyme/api.rb
|
170
111
|
- lib/ey_enzyme/cli.rb
|
171
112
|
- lib/ey_enzyme/cookbook_set.rb
|
@@ -175,49 +116,28 @@ files:
|
|
175
116
|
- lib/ey_enzyme.rb
|
176
117
|
- bin/ey-enzyme
|
177
118
|
- bin/ey-recipes
|
178
|
-
- spec/api_spec.rb
|
179
|
-
- spec/log_upload_error_notify_spec.rb
|
180
|
-
- spec/logging_spec.rb
|
181
|
-
- spec/retry_report_and_notify_success_spec.rb
|
182
|
-
- spec/spec_helper.rb
|
183
119
|
homepage: http://github.com/engineyard/ey_enzyme
|
184
120
|
licenses: []
|
185
|
-
|
186
121
|
post_install_message:
|
187
122
|
rdoc_options: []
|
188
|
-
|
189
|
-
require_paths:
|
123
|
+
require_paths:
|
190
124
|
- lib
|
191
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
126
|
none: false
|
193
|
-
requirements:
|
194
|
-
- -
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
|
197
|
-
|
198
|
-
- 0
|
199
|
-
version: "0"
|
200
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
132
|
none: false
|
202
|
-
requirements:
|
203
|
-
- -
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
hash: 25
|
206
|
-
segments:
|
207
|
-
- 1
|
208
|
-
- 3
|
209
|
-
- 1
|
133
|
+
requirements:
|
134
|
+
- - ! '>'
|
135
|
+
- !ruby/object:Gem::Version
|
210
136
|
version: 1.3.1
|
211
137
|
requirements: []
|
212
|
-
|
213
138
|
rubyforge_project:
|
214
|
-
rubygems_version: 1.8.
|
139
|
+
rubygems_version: 1.8.10
|
215
140
|
signing_key:
|
216
141
|
specification_version: 3
|
217
142
|
summary: Gem for kicking off chef recipes
|
218
|
-
test_files:
|
219
|
-
- spec/api_spec.rb
|
220
|
-
- spec/log_upload_error_notify_spec.rb
|
221
|
-
- spec/logging_spec.rb
|
222
|
-
- spec/retry_report_and_notify_success_spec.rb
|
223
|
-
- spec/spec_helper.rb
|
143
|
+
test_files: []
|
data/spec/api_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
require 'stringio'
|
3
|
-
|
4
|
-
describe "enzyme API" do
|
5
|
-
|
6
|
-
before { FakeWeb.allow_net_connect = false }
|
7
|
-
after { FakeWeb.allow_net_connect = true }
|
8
|
-
|
9
|
-
def new_api(*args)
|
10
|
-
old_stderr = $stderr
|
11
|
-
$stderr = StringIO.new
|
12
|
-
api = EY::Enzyme::API.new(*args)
|
13
|
-
$stderr = old_stderr
|
14
|
-
api
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with an EY::Enzyme::API" do
|
18
|
-
before do
|
19
|
-
@enzyme_api = new_api("https://cloud.engineyard.com/dracul",
|
20
|
-
"i-d8babcb5",
|
21
|
-
"8c40f5769f8987489ec66a3abc944123fc0f043c",
|
22
|
-
File.dirname(__FILE__) + '/../tmp/test.log')
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should be able to post errors" do
|
26
|
-
FakeWeb.register_uri(
|
27
|
-
:post,
|
28
|
-
"https://cloud.engineyard.com/dracul/error",
|
29
|
-
:body => {}.to_json
|
30
|
-
)
|
31
|
-
|
32
|
-
begin
|
33
|
-
raise "we fail"
|
34
|
-
rescue => e
|
35
|
-
#WE need to do this because the exception is expected to have a backtrace
|
36
|
-
@enzyme_api.notify_error("user", e)
|
37
|
-
end
|
38
|
-
|
39
|
-
FakeWeb.should have_requested(:post, "https://cloud.engineyard.com/dracul/error")
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "EY::Enzyme::CookbookSet#upload" do
|
4
|
-
before do
|
5
|
-
FakeWeb.clean_registry
|
6
|
-
@api_url = "https://cloud.engineyard.example.com/dracul"
|
7
|
-
|
8
|
-
fake_cheflog_location = File.expand_path(File.dirname(__FILE__) + '/../tmp/clitestlog')
|
9
|
-
logfile_location = File.expand_path(File.dirname(__FILE__) + '/../tmp/clitestlog')
|
10
|
-
@cookbooks = EY::Enzyme::CLI.new(:logfile => logfile_location, :api => @api_url).main_cookbooks
|
11
|
-
|
12
|
-
#HAX: (might as well be a mock)
|
13
|
-
@cookbooks.instance_eval {
|
14
|
-
@chef_log = fake_cheflog_location
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
it "posts the log file to /store" do
|
19
|
-
FakeWeb.register_uri(
|
20
|
-
:post,
|
21
|
-
@api_url + "/store",
|
22
|
-
:body => {}.to_json
|
23
|
-
)
|
24
|
-
@cookbooks.upload
|
25
|
-
end
|
26
|
-
|
27
|
-
it "posts an error when attempt to upload logs returns 500" do
|
28
|
-
FakeWeb.register_uri(
|
29
|
-
:post,
|
30
|
-
@api_url + "/store",
|
31
|
-
:body => {}.to_json,
|
32
|
-
:status => ["500", "Internal Server Error"]
|
33
|
-
)
|
34
|
-
FakeWeb.register_uri(
|
35
|
-
:post,
|
36
|
-
@api_url + "/error",
|
37
|
-
:body => {}.to_json
|
38
|
-
)
|
39
|
-
@cookbooks.upload
|
40
|
-
posted = JSON.parse(FakeWeb.last_request.body.to_s)
|
41
|
-
posted["where_failed"].should == "logupload"
|
42
|
-
posted["message"].should == "failed to upload main log"
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/logging_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe EY::Enzyme::MultiLogger do
|
4
|
-
|
5
|
-
before do
|
6
|
-
FakeWeb.clean_registry
|
7
|
-
FakeWeb.allow_net_connect = false
|
8
|
-
end
|
9
|
-
|
10
|
-
it "it should have a loggly_url" do
|
11
|
-
EY::Enzyme::MultiLogger.loggly_url.should_not == nil
|
12
|
-
EY::Enzyme::MultiLogger.loggly_url.should == 'https://logs.engineyard.loggly.com/inputs/7d877a85-c36a-4e60-a6ba-1d55185e2b91'
|
13
|
-
end
|
14
|
-
|
15
|
-
it "it should log something to loggly" do
|
16
|
-
FakeWeb.register_uri(:post, EY::Enzyme::MultiLogger.loggly_url, :body => {}.to_json)
|
17
|
-
logger = EY::Enzyme::MultiLogger.new($stdout)
|
18
|
-
logger.debug("test")
|
19
|
-
FakeWeb.should have_requested(:post, EY::Enzyme::MultiLogger.loggly_url)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "EY::Enzyme::API" do
|
4
|
-
before do
|
5
|
-
FakeWeb.clean_registry
|
6
|
-
@api_url = "https://cloud.engineyard.example.com/dracul"
|
7
|
-
|
8
|
-
logfile_location = File.expand_path(File.dirname(__FILE__) + '/../tmp/clitestlog')
|
9
|
-
@cli = EY::Enzyme::CLI.new(:logfile => logfile_location, :api => @api_url)
|
10
|
-
@api = @cli.instance_eval{ @api }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "notify_success" do
|
14
|
-
it "can notify success" do
|
15
|
-
FakeWeb.register_uri(
|
16
|
-
:post,
|
17
|
-
@api_url + "/completed",
|
18
|
-
:body => {}.to_json
|
19
|
-
)
|
20
|
-
@api.notify_success
|
21
|
-
end
|
22
|
-
|
23
|
-
it "retries on 502" do
|
24
|
-
FakeWeb.register_uri(
|
25
|
-
:post,
|
26
|
-
@api_url + "/completed",
|
27
|
-
[
|
28
|
-
{:body => {}.to_json, :status => ["502", "Bad Gateway"]},
|
29
|
-
{:body => {}.to_json, :status => ["200", "Success"]},
|
30
|
-
]
|
31
|
-
)
|
32
|
-
lambda{ @api.notify_success }.should_not raise_error
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "report" do
|
37
|
-
it "can report chef statuses" do
|
38
|
-
FakeWeb.register_uri(
|
39
|
-
:post,
|
40
|
-
@api_url + "/report",
|
41
|
-
:body => {}.to_json
|
42
|
-
)
|
43
|
-
@api.report 'report some status'
|
44
|
-
|
45
|
-
posted = JSON.parse(FakeWeb.last_request.body.to_s)
|
46
|
-
posted["message"].should == "report some status"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "doesn't raise or retry on 502" do
|
50
|
-
FakeWeb.register_uri(
|
51
|
-
:post,
|
52
|
-
@api_url + "/report",
|
53
|
-
[
|
54
|
-
{:body => {}.to_json, :status => ["502", "Bad Gateway"]},
|
55
|
-
{:body => lambda{ raise "no!" }}, #bad bad hax, doesn't work the way you would hope
|
56
|
-
]
|
57
|
-
)
|
58
|
-
lambda{ @api.report 'some status update' }.should_not raise_error
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
2
|
-
|
3
|
-
require 'ey_enzyme'
|
4
|
-
require 'fakeweb'
|
5
|
-
require 'fakeweb_matcher'
|
6
|
-
|
7
|
-
tmpdir = File.expand_path(File.dirname(__FILE__) + '/../tmp')
|
8
|
-
FileUtils.mkdir_p tmpdir
|
9
|
-
FileUtils.rm Dir.glob("#{tmpdir}/*")
|