event-reporting-handler 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6573d0110ed246194a99f83c4a0aa64e1f16d4f4
4
- data.tar.gz: 1943dcd3edbed56dbb1d5ad9445411b64cb58241
3
+ metadata.gz: 5f01111a0b1b7cf0947d0aacc891cb428a161b5f
4
+ data.tar.gz: 2bdd9abf423878f141d4fc46a329c2207db6dbac
5
5
  SHA512:
6
- metadata.gz: a09244a3aef624bd3c06147fdf89cd192c3f44248527fb070b28e90b681dab1fa7e62a263726dc8bbe732bc3846ca0d7567d6a07a05ca7e88fb090a6b57114f4
7
- data.tar.gz: 9386705c6dfd4ea040d33c711de6bac9122098bffeb4b299ae04321784aaaa8e80b23a57a2c59967fd373db8740669dee4fd2f37f1af148279eb4317bb69e3bf
6
+ metadata.gz: b1e9ef712ad93fbc891f2b8eefc6478e983de0b47cb342a590591adc39af217b1ff7802387b08c85f12367688d34ff13cae0520418c80839974349090d1382bf
7
+ data.tar.gz: d75259c33efbeedaae5f54b3ce24dca59cd5f4bfb3bd68d9784933117fb9cdf5f10b24b04fd45f146f7906bedcf3a122a41b780626b81269089a5f0c6b5e6c67
@@ -62,15 +62,19 @@ module BloombergLP
62
62
 
63
63
  def publish_event(event, custom_attributes = {})
64
64
  json_to_publish = get_json_from_event(event, custom_attributes.merge(@whitelist_attributes))
65
- uri = URI(@http_url)
66
- res = Net::HTTP.start(uri.host, uri.port) do |http|
67
- http.post(uri.path, json_to_publish, 'Content-Type' => 'application/json')
68
- end
69
- case res
70
- when Net::HTTPSuccess, Net::HTTPRedirection
71
- Chef::Log.debug("Successfully sent http request with #{json_to_publish} to #{@http_url}")
72
- else
73
- Chef::Log.warn("Error in sending http request to #{@http_url} Code is #{res.code} Msg is #{res.message}")
65
+ begin
66
+ uri = URI(@http_url)
67
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
68
+ http.post(uri.path, json_to_publish, 'Content-Type' => 'application/json')
69
+ end
70
+ case res
71
+ when Net::HTTPSuccess, Net::HTTPRedirection
72
+ Chef::Log.debug("Successfully sent http request with #{json_to_publish} to #{@http_url}")
73
+ else
74
+ Chef::Log.warn("Error in sending http request to #{@http_url} Code is #{res.code} Msg is #{res.message}")
75
+ end
76
+ rescue StandardError => e # catch all exceptions so that chef run does not fail
77
+ Chef::Log.warn("Exception raised when sending http request to #{@http_url} : #{e}")
74
78
  end
75
79
  end
76
80
 
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module BloombergLP
6
6
  module EventReportingHandler
7
- VERSION = '0.1.15'
7
+ VERSION = '0.1.16'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event-reporting-handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shahul Khajamohideen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler