genesis_collector 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/chef/handler/genesis.rb +12 -0
- data/lib/genesis_collector/network_interfaces.rb +1 -1
- data/lib/genesis_collector/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf580c6e7c7d908644417461cdd1289c33fafd74
|
4
|
+
data.tar.gz: e002b3168daf4bb67b3307255d855b80f5a50192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24efe9a3a8d1c0df521fc1ea64c2ed9141b5a688b8ba81472d3af79a02ce0a9548fec34fc7a9b1a35b8d7569eeccf2c6bc5f162661be7eeb3fee5ea5316e0bca
|
7
|
+
data.tar.gz: 15261eab99feae8d834ba6300ea96d88b1516b9a0cc157810c5a18f503fae7f2dfea026a19be05cf40669a2d1a45a41865f6d8ab4c2187bb9dde67714aa11d2d
|
data/LICENSE.txt
CHANGED
data/lib/chef/handler/genesis.rb
CHANGED
@@ -2,6 +2,11 @@ require 'chef/handler'
|
|
2
2
|
require 'chef/mash'
|
3
3
|
require 'genesis_collector'
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'bugsnag'
|
7
|
+
rescue LoadError
|
8
|
+
end
|
9
|
+
|
5
10
|
class Chef
|
6
11
|
class Handler
|
7
12
|
class Genesis < Chef::Handler
|
@@ -9,6 +14,11 @@ class Chef
|
|
9
14
|
|
10
15
|
def initialize(config = {})
|
11
16
|
@config = Mash.new(config)
|
17
|
+
if defined?(Bugsnag)
|
18
|
+
Bugsnag.configure do |config|
|
19
|
+
config.api_key = @config.delete('bugsnag_api_key')
|
20
|
+
end
|
21
|
+
end
|
12
22
|
end
|
13
23
|
|
14
24
|
def report
|
@@ -22,6 +32,7 @@ class Chef
|
|
22
32
|
@collector = GenesisCollector::Collector.new(@config.merge(chef_node: run_context.node))
|
23
33
|
@collector.collect!
|
24
34
|
rescue => e
|
35
|
+
Bugsnag.notify(e) if defined?(Bugsnag)
|
25
36
|
Chef::Log.error("Error collecting system information for Genesis:\n" + e.message)
|
26
37
|
Chef::Log.error(e.backtrace.join("\n"))
|
27
38
|
end
|
@@ -29,6 +40,7 @@ class Chef
|
|
29
40
|
def send_report
|
30
41
|
@collector.submit!
|
31
42
|
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
|
43
|
+
Bugsnag.notify(e) if defined?(Bugsnag)
|
32
44
|
Chef::Log.error("Could not connect to Genesis. Connection error:\n" + e.message)
|
33
45
|
Chef::Log.error(e.backtrace.join("\n"))
|
34
46
|
end
|
@@ -6,7 +6,7 @@ module GenesisCollector
|
|
6
6
|
def collect_network_interfaces
|
7
7
|
interfaces = {}
|
8
8
|
Socket.getifaddrs.each do |ifaddr|
|
9
|
-
next if ifaddr.name.start_with?('lo')
|
9
|
+
next if ifaddr.name.start_with?('lo', 'docker', 'veth')
|
10
10
|
interfaces[ifaddr.name] ||= {}
|
11
11
|
interfaces[ifaddr.name][:addresses] ||= []
|
12
12
|
next unless ifaddr.addr.ipv4?
|