right_agent 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/right_agent/core_payload_types/dev_repository.rb +32 -0
- data/lib/right_agent/error_tracker.rb +7 -3
- data/right_agent.gemspec +2 -2
- data/spec/error_tracker_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d22fd938943f06f9b04001c14079c25e7724671d
|
4
|
+
data.tar.gz: 843eb9bf0b111a56dc763aa0cabb3f895d328b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 727ddf697ab2329655a70636475d2698c28c4cfbf2f6665d552d43fe812ec894b262ddc0a3d621f15585d701d3c7ec6961e22cb7aedb38f737a9fa3cf59fe485
|
7
|
+
data.tar.gz: 40e8e9422e00f2d0fab4613853daf4ec1a8b915c103496c1249486f22267acab47ac3a2e248b0ec96f13ef670647a3eb0613b561c7a3a26de00aadf4fbe891f2
|
@@ -72,5 +72,37 @@ module RightScale
|
|
72
72
|
def serialized_members
|
73
73
|
[ @repo_type, @url, @tag, @cookbooks_path, @ssh_key, @username, @password, @repo_sha, @positions ]
|
74
74
|
end
|
75
|
+
|
76
|
+
# Maps the given DevRepository to a has that can be consumed by the RightScraper gem
|
77
|
+
#
|
78
|
+
# === Returns
|
79
|
+
# (Hash)::
|
80
|
+
# :repo_type (Symbol):: Type of repository: one of :git, :svn, :download or :local
|
81
|
+
# * :git denotes a 'git' repository that should be retrieved via 'git clone'
|
82
|
+
# * :svn denotes a 'svn' repository that should be retrieved via 'svn checkout'
|
83
|
+
# * :download denotes a tar ball that should be retrieved via HTTP GET (HTTPS if uri starts with https://)
|
84
|
+
# * :local denotes cookbook that is already local and doesn't need to be retrieved
|
85
|
+
# :url (String):: URL to repository (e.g. git://github.com/opscode/chef-repo.git)
|
86
|
+
# :tag (String):: git commit or svn branch that should be used to retrieve repository
|
87
|
+
# Optional, use 'master' for git and 'trunk' for svn if tag is nil.
|
88
|
+
# Not used for raw repositories.
|
89
|
+
# :cookbooks_path (Array):: Path to cookbooks inside repostory
|
90
|
+
# Optional (use location of repository as cookbook path if nil)
|
91
|
+
# :first_credential (String):: Either the Private SSH key used to retrieve git repositories, or the Username used to retrieve svn and raw repositories
|
92
|
+
# :second_credential (String):: Password used to retrieve svn and raw repositories
|
93
|
+
def to_scraper_hash
|
94
|
+
repo = {}
|
95
|
+
repo[:repo_type] = repo_type.to_sym unless repo_type.nil?
|
96
|
+
repo[:url] = url
|
97
|
+
repo[:tag] = tag
|
98
|
+
repo[:resources_path] = cookbooks_path
|
99
|
+
if !ssh_key.nil?
|
100
|
+
repo[:first_credential] = ssh_key
|
101
|
+
elsif !(username.nil? && password.nil?)
|
102
|
+
repo[:first_credential] = dev_repo.username
|
103
|
+
repo[:second_credential] = dev_repo.password
|
104
|
+
end
|
105
|
+
repo
|
106
|
+
end
|
75
107
|
end
|
76
108
|
end
|
@@ -47,6 +47,7 @@ module RightScale
|
|
47
47
|
|
48
48
|
# Log error and optionally track in stats
|
49
49
|
# Errbit notification is left to the callback configured in the stats tracker
|
50
|
+
# Logging works even if init was never called
|
50
51
|
#
|
51
52
|
# @param [String, Object] component reporting error; non-string is snake-cased
|
52
53
|
# @param [String] description of failure for use in logging
|
@@ -81,8 +82,11 @@ module RightScale
|
|
81
82
|
#
|
82
83
|
# @return [TrueClass] always true
|
83
84
|
def track(component, exception, packet = nil)
|
84
|
-
|
85
|
-
|
85
|
+
if @exception_stats
|
86
|
+
component = component.class.name.split("::").last.snake_case unless component.is_a?(String)
|
87
|
+
@exception_stats.track(component, exception, packet)
|
88
|
+
end
|
89
|
+
true
|
86
90
|
end
|
87
91
|
|
88
92
|
# Notify Errbit of error if notification enabled
|
@@ -140,7 +144,7 @@ module RightScale
|
|
140
144
|
#
|
141
145
|
# @return [Hash] current statistics
|
142
146
|
def stats(reset = false)
|
143
|
-
stats = {"exceptions" => @exception_stats.all}
|
147
|
+
stats = {"exceptions" => @exception_stats && @exception_stats.all}
|
144
148
|
reset_stats if reset
|
145
149
|
stats
|
146
150
|
end
|
data/right_agent.gemspec
CHANGED
@@ -25,8 +25,8 @@ require 'rbconfig'
|
|
25
25
|
|
26
26
|
Gem::Specification.new do |spec|
|
27
27
|
spec.name = 'right_agent'
|
28
|
-
spec.version = '2.3.
|
29
|
-
spec.date = '2014-
|
28
|
+
spec.version = '2.3.1'
|
29
|
+
spec.date = '2014-06-12'
|
30
30
|
spec.authors = ['Lee Kirchhoff', 'Raphael Simon', 'Tony Spataro', 'Scott Messier']
|
31
31
|
spec.email = 'lee@rightscale.com'
|
32
32
|
spec.homepage = 'https://github.com/rightscale/right_agent'
|
data/spec/error_tracker_spec.rb
CHANGED
@@ -142,6 +142,13 @@ describe RightScale::ErrorTracker do
|
|
142
142
|
@tracker.exception_stats.all.should == {"test" => {"total" => 1, "recent" => [{"count" => 1, "when" => 1000000,
|
143
143
|
"type" => "RuntimeError", "message" => "error", "where" => nil}]}}
|
144
144
|
end
|
145
|
+
|
146
|
+
it "only tracks if stats container exists" do
|
147
|
+
@tracker.instance_variable_set(:@exception_stats, nil)
|
148
|
+
request = RightScale::Request.new("/foo/bar", "payload")
|
149
|
+
@tracker.track("test", @exception, request).should be true
|
150
|
+
@tracker.exception_stats.should be nil
|
151
|
+
end
|
145
152
|
end
|
146
153
|
|
147
154
|
context :notify do
|
@@ -237,6 +244,12 @@ describe RightScale::ErrorTracker do
|
|
237
244
|
"when" => 1000000, "type" => "RuntimeError", "message" => "error", "where" => nil}]}}}
|
238
245
|
end
|
239
246
|
|
247
|
+
it "returns no exception stats if stats container not initialized" do
|
248
|
+
@tracker.instance_variable_set(:@exception_stats, nil)
|
249
|
+
@tracker.track(@agent, @exception).should be true
|
250
|
+
@tracker.stats.should == {"exceptions" => nil}
|
251
|
+
end
|
252
|
+
|
240
253
|
it "resets stats after collecting current stats" do
|
241
254
|
@tracker.track(@agent, @exception).should be true
|
242
255
|
@tracker.stats(true).should == {"exceptions" => {"agent_mock" => {"total" => 1, "recent" => [{"count" => 1,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Kirchhoff
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: right_support
|