opener-daemons 2.1.0 → 2.1.1

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: cd43444725d72e2076b674d5c1a4ae46b7c2a514
4
- data.tar.gz: a315f9989260c5c36efbe29d412120abcef97802
3
+ metadata.gz: b735bf7aefc0ca1766255d81d62e597462da367c
4
+ data.tar.gz: 8d724df16b36cf5d5b9368eec4c49b467b793607
5
5
  SHA512:
6
- metadata.gz: 29f9b444314f438ab37d2732f2d3dd115993122a31bc4dd63b3b2b7e98d6b4a8d12ff2f159fc57b16d501635d8d05db244717af95874ab4243a87be49c211f5a
7
- data.tar.gz: 0f9ce2a6d61f73eeac95b24045b75dfe628e2bdad9ce3e780fa50a287d63597e8138ca44d2f11455b343d22c1d85f8e403aff3dc7597b0e60b523c64039c8f06
6
+ metadata.gz: 8eb26750e9635ea9a32588266ea628666f09499169031a0753624ea17a9bd5c2410f4e39c88583c40ed6e3a7dfaaa31338e50c063cb3c8f5dc8c3e6c2d5daaa6
7
+ data.tar.gz: 67e25b0fd92b99955afeebfe83fe523f2a0301441da1358df04477d3b87ccda15a34c2c167206b010d66bf7bafc22f04243af6ad22407950081f67139d4e7339
@@ -37,9 +37,12 @@ module Opener
37
37
  # Called before the daemon is started.
38
38
  #
39
39
  def before_start
40
- Syslog.open(ENV['APP_NAME'], ::Syslog::LOG_CONS | ::Syslog::LOG_PID)
40
+ Core::Syslog.open(
41
+ ENV['APP_NAME'],
42
+ ::Syslog::LOG_CONS | ::Syslog::LOG_PID
43
+ )
41
44
 
42
- Syslog.info(
45
+ Core::Syslog.info(
43
46
  'Starting daemon',
44
47
  :queue => option(:queue_name),
45
48
  :threads => threads
@@ -85,7 +88,7 @@ module Opener
85
88
  def complete(message, output, timings)
86
89
  log_msg = "Finished message #{message.id}"
87
90
 
88
- Syslog.info(log_msg)
91
+ Core::Syslog.info(log_msg)
89
92
  end
90
93
 
91
94
  ##
@@ -18,15 +18,6 @@ module Opener
18
18
  return !!ENV['ROLLBAR_TOKEN']
19
19
  end
20
20
 
21
- ##
22
- # Returns `true` if Syslog should be enabled.
23
- #
24
- # @return [TrueClass|FalseClass]
25
- #
26
- def self.syslog?
27
- return !!ENV['ENABLE_SYSLOG']
28
- end
29
-
30
21
  ##
31
22
  # Returns the name of the input queue to use.
32
23
  #
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  module Daemons
3
- VERSION = '2.1.0'
3
+ VERSION = '2.1.1'
4
4
  end # Daemons
5
5
  end # Opener
@@ -45,7 +45,7 @@ module Opener
45
45
  output = config.component_instance.run(input)
46
46
  object = uploader.upload(config.identifier, output, config.metadata)
47
47
 
48
- Syslog.info(
48
+ Core::Syslog.info(
49
49
  "Wrote output to s3://#{Daemons.output_bucket}/#{object.key}",
50
50
  config.metadata
51
51
  )
@@ -79,7 +79,7 @@ module Opener
79
79
  :metadata => config.metadata
80
80
  )
81
81
 
82
- Syslog.info("Submitted response to #{next_url}", config.metadata)
82
+ Core::Syslog.info("Submitted response to #{next_url}", config.metadata)
83
83
  end
84
84
 
85
85
  private
@@ -1,6 +1,4 @@
1
1
  require 'timeout'
2
- require 'syslog'
3
- require 'logger'
4
2
  require 'securerandom'
5
3
 
6
4
  require 'aws-sdk'
@@ -9,6 +7,7 @@ require 'slop'
9
7
  require 'oni'
10
8
  require 'oni/daemons/sqs'
11
9
  require 'opener/callback_handler'
10
+ require 'opener/core'
12
11
  require 'new_relic/control'
13
12
  require 'rollbar'
14
13
  require 'json-schema'
@@ -21,7 +20,6 @@ require_relative 'daemons/pidfile'
21
20
  require_relative 'daemons/configuration'
22
21
  require_relative 'daemons/downloader'
23
22
  require_relative 'daemons/uploader'
24
- require_relative 'daemons/syslog'
25
23
 
26
24
  require_relative 'daemons/mapper'
27
25
  require_relative 'daemons/worker'
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'aws-sdk', '~> 1.0'
24
24
  spec.add_dependency 'slop', '~> 3.0'
25
25
  spec.add_dependency 'opener-callback-handler', '~> 1.0'
26
+ spec.add_dependency 'opener-core', '~> 2.0'
26
27
  spec.add_dependency 'newrelic_rpm'
27
28
  spec.add_dependency 'json-schema'
28
29
  spec.add_dependency 'rollbar', '~> 1.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-daemons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilco van Duinkerken
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-17 00:00:00.000000000 Z
12
+ date: 2014-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: opener-core
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.0'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: newrelic_rpm
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +204,6 @@ files:
190
204
  - lib/opener/daemons/mapper.rb
191
205
  - lib/opener/daemons/option_parser.rb
192
206
  - lib/opener/daemons/pidfile.rb
193
- - lib/opener/daemons/syslog.rb
194
207
  - lib/opener/daemons/uploader.rb
195
208
  - lib/opener/daemons/version.rb
196
209
  - lib/opener/daemons/worker.rb
@@ -1,58 +0,0 @@
1
- module Opener
2
- module Daemons
3
- ##
4
- # Wrapper around `Syslog` that makes it easier to disable loggers and to log
5
- # custom key/value pairs in message.
6
- #
7
- module Syslog
8
- ##
9
- # Configures Syslog.
10
- #
11
- # @see [Syslog.open]
12
- # @param [String] name The name of the program.
13
- # @param [Fixnum] facility
14
- #
15
- def self.open(name, facility = nil)
16
- ::Syslog.open(name, facility) if Daemons.syslog?
17
- end
18
-
19
- # methods defined using define_method() are slower than those defined
20
- # using eval() on JRuby and Rubinius.
21
- [:debug, :err, :fatal, :info, :warn, :unknown].each do |method|
22
- eval <<-EOF, nil, __FILE__, __LINE__ + 1
23
- def self.#{method}(message, meta = {})
24
- add(:#{method}, message, meta)
25
- end
26
- EOF
27
- end
28
-
29
- ##
30
- # Adds a new log message.
31
- #
32
- # @example
33
- # add(:info, 'Testing Syslog', :user_id => 19)
34
- #
35
- # @param [Symbol] type The type of log message to add, corresponds to the
36
- # logger method that will be called.
37
- #
38
- # @param [String] message The message to log.
39
- # @param [Hash] meta Extra meta data to log.
40
- #
41
- def self.add(type, message, meta = {})
42
- return unless Daemons.syslog?
43
-
44
- pairs = make_pairs(meta)
45
-
46
- ::Syslog.send(type, "#{pairs} #{message}".strip)
47
- end
48
-
49
- ##
50
- # @param [Hash] meta
51
- # @return [String]
52
- #
53
- def self.make_pairs(meta)
54
- return meta.map { |(key, value)| "#{key}=#{value.inspect}" }.join(' ')
55
- end
56
- end # Syslog
57
- end # Daemons
58
- end # Opener