cantemo-portal-agent 1.2.1 → 1.2.3

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: e171c53876f59041d8c032a5ec5603b5f25a962b
4
- data.tar.gz: 19e7b87575175471a9484439aee1d23b8b211491
3
+ metadata.gz: 4ee35911bd6bae5512fa8dbd656bcf191fe548f9
4
+ data.tar.gz: dcf5c261b9b184b9734c3b0cc9d4e9c996464e98
5
5
  SHA512:
6
- metadata.gz: e72d5bfc3ed43872318954bacf30bbc140d2f884bd67419c64fc8568dc2fdd78c628f25a4b95fb942b33494b41d09afaa46ea4798e1b303271337178c966f296
7
- data.tar.gz: 1e211ac9951ad604a900068e0b4d85b5d36fcc685660c9288d25855da209cf787145940d87c4673fedfc2b3ca93c72b220c4e4fe526819ed40b8d32d0be62b93
6
+ metadata.gz: 0fcf6fe6526c7db201d74242d7d13d897944ab2ff0b0d09bb2adec07e98c3053dabd1abd083b5b4c0f5afc50153ed3dfcdbbf7a2c6c1517d6b43e5c16d293f03
7
+ data.tar.gz: 28e97981b20cc01ff0c379483d5d52717f9ef07ed7e013c62bcc32cd5b133f592b19b1bd3b5afbc5a8e84e0f460f4557547d2411fe7206f4cd1d725a66567c89
@@ -1,7 +1,7 @@
1
1
  module Cantemo
2
2
  module Portal
3
3
  class Agent
4
- VERSION = '1.2.1'.freeze
4
+ VERSION = '1.2.3'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ module Cantemo
7
7
 
8
8
  class Client
9
9
 
10
- def initialize(args = { })
10
+ def self.new(args = { })
11
11
  api_host = args[:host]
12
12
  api_port = args[:port]
13
13
  api_host_use_ssl = args[:ssl]
@@ -13,7 +13,7 @@ module Envoi
13
13
 
14
14
  attr_accessor :aswatchadmin_executable_path, :default_username
15
15
 
16
- DEFAULT_ASWATCHADMIN_EXECUTABLE_PATH = '/Library/Aspera/bin/aswatchadmin'
16
+ DEFAULT_ASWATCHADMIN_EXECUTABLE_PATH = '/Library/Aspera/bin/d'
17
17
 
18
18
  DAEMON_NAME_FIELD_NAME = 'name'
19
19
  DAEMON_CONFIGURATION_FIELD_NAME = 'configuration'
@@ -44,7 +44,7 @@ module Envoi
44
44
  api_config = agent_config
45
45
  @api_client = args[:api_client] || begin
46
46
  client_args = Hash[api_config.map { |k,v| [ k.respond_to?(:to_sym) ? k.to_sym.downcase : k, v ]}]
47
- _client = Cantemo::Portal::API::Client.new(client_args)
47
+ _client = ::Cantemo::Portal::API::Client.new(client_args)
48
48
 
49
49
  begin
50
50
  _client.version
@@ -293,8 +293,6 @@ module Envoi
293
293
  if item_id
294
294
  item_shape_import_response = api_client.item_shape_import(item_id: item_id,
295
295
  tag: shape_tag, fileId: file_id)
296
-
297
-
298
296
  else
299
297
  import_args = {
300
298
  storage_id: storage_id,
@@ -224,7 +224,8 @@ module Envoi::Mam::Cantemo
224
224
  logger.debug { "Maximum number of active processors reached for watch folder. #{wf.name || wf.paths}" }
225
225
  next
226
226
  end
227
- t = Thread.new(wf, file) do |wf, file|
227
+ t = Thread.new(file) do |file|
228
+ wf = file.watch_folder
228
229
  begin
229
230
  process_file(file)
230
231
  rescue => e
@@ -268,7 +269,8 @@ module Envoi::Mam::Cantemo
268
269
  # AWF.run(watch_folders) { |wf| process_watch_folder(wf) }
269
270
 
270
271
  logger.info { 'Running...' }
271
- watch_folders.map { |wf| wf.run if wf.respond_to?(:run) }
272
+ watch_folders.map { |wf| wf.respond_to?(:run) ? wf.run : logger.debug { "Skip run for #{wf}" } }
273
+ logger.debug { 'Initial Run Complete.' }
272
274
  loop do
273
275
  begin
274
276
  poll
@@ -298,6 +298,10 @@ module Envoi
298
298
  !last_poll_time || (Time.now - last_poll_time) >= poll_interval
299
299
  end
300
300
 
301
+ def run
302
+ handler.run if handler.respond_to?(:run)
303
+ end
304
+
301
305
  def stable_files
302
306
  handler.stable_files
303
307
  end
@@ -92,7 +92,6 @@ module Envoi
92
92
  process_definition(@definition)
93
93
  initialize_listener
94
94
  logger.debug ( "Watch Folder Handler '#{self.class.name}' Initialized. ")
95
- perform_initial_inventory
96
95
  end
97
96
 
98
97
  def initialize_logger(args = { })
@@ -148,17 +147,17 @@ module Envoi
148
147
  def initialize_listener(args = { })
149
148
  @listener = ::Listen.to(*paths, {}) do |m, a, r|
150
149
  if !r.empty?
151
- log "#{r.length} file(s) removed."
150
+ logger.info { "#{r.length} file(s) removed." }
152
151
  lock.synchronize { r.each { |f| process_deleted_path(f) } }
153
152
  end
154
153
 
155
154
  if !m.empty?
156
- log "#{m.length} file(s) modified."
155
+ logger.info { "#{m.length} file(s) modified." }
157
156
  lock.synchronize { process_add_or_modified_path(m, :modified) }
158
157
  end
159
158
 
160
159
  if !a.empty?
161
- log "#{a.length} file(s) added."
160
+ logger.info { "#{a.length} file(s) added." }
162
161
  lock.synchronize { process_add_or_modified_path(a, :added) }
163
162
  end
164
163
 
@@ -214,8 +213,13 @@ module Envoi
214
213
  @known_path_map.select { |p,f| f.stable? }.values
215
214
  end
216
215
 
216
+ def run_once(options = { })
217
+ perform_initial_inventory
218
+ end
219
+
217
220
  def run(options = { })
218
221
  logger.info { "Starting handler for #{paths}" }
222
+ perform_initial_inventory
219
223
  listener.start
220
224
  end
221
225
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantemo-portal-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Whitson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asperalm
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: faraday
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.15'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.15'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: listen
71
57
  requirement: !ruby/object:Gem::Requirement