cantemo-portal-agent 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cantemo/portal/agent/cli/commands/watch_folder.rb +1 -0
- data/lib/cantemo/portal/agent/cli/commands/watch_folders.rb +4 -3
- data/lib/cantemo/portal/agent/version.rb +1 -1
- data/lib/envoi/mam/agent.rb +16 -9
- data/lib/envoi/mam/agent/cli/commands/cantemo-agent.rb +0 -2
- data/lib/envoi/mam/agent/cli/commands/cantemo.rb +1 -1
- data/lib/envoi/mam/cantemo/agent.rb +123 -99
- data/lib/envoi/mam/cantemo/agent/watch_folder_manager.rb +75 -127
- data/lib/envoi/watch_folder_utility/watch_folder.rb +307 -0
- data/lib/envoi/watch_folder_utility/watch_folder/handler/listen.rb +28 -55
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d670e7ef575f0152b7bf5d77d2763de6a64e363
|
4
|
+
data.tar.gz: e76ed955968ebd2182b49e29badbbff6e7b606bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e52761626f536e564d71856e361f16b3d2d1418da3e464723256ffad5459cf512a67b684e9628da912c78031ca520e407748881c1804eb79123cac37846c917
|
7
|
+
data.tar.gz: f8a9a3ba1f3621feb3e8958c51a0068bcaf6e81264bca425605e1d2ade8fe75adcf3891a04a2ae353296138401457b330ce59278650a54491d99e93ecc6790af
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative('watch_folders')
|
@@ -51,7 +51,7 @@ args[:config_file_path].map! { |v| File.expand_path(v) } if config_file_path.is_
|
|
51
51
|
|
52
52
|
command = ARGV.first.dup
|
53
53
|
|
54
|
-
|
54
|
+
daemon_control_command_present = command && begin
|
55
55
|
command.downcase!
|
56
56
|
%w(start stop restart run zap killall status).include?(command)
|
57
57
|
end
|
@@ -68,7 +68,7 @@ if command
|
|
68
68
|
end
|
69
69
|
|
70
70
|
|
71
|
-
daemonize = (
|
71
|
+
daemonize = (daemon_control_command_present && %w(start restart).include?(command)) || args[:daemonize]
|
72
72
|
|
73
73
|
# puts "#{__FILE__}:#{__LINE__ } #{args}"
|
74
74
|
# next_command = ARGV.shift
|
@@ -76,4 +76,5 @@ daemonize = (control_command_present && %(start restart).include?(command)) || a
|
|
76
76
|
|
77
77
|
class Watcher < Envoi::Mam::Cantemo::Agent::WatchFolderManager; end
|
78
78
|
# daemonize ? Watcher.run_as_daemon(args, { force: true }) : Watcher.run(args)
|
79
|
-
|
79
|
+
# daemon_control_command_present ? Watcher.run_as_daemon(args) : Watcher.run(args)
|
80
|
+
Watcher.run_as_daemon(args)
|
data/lib/envoi/mam/agent.rb
CHANGED
@@ -12,7 +12,7 @@ module Envoi
|
|
12
12
|
|
13
13
|
def initialize(args = { })
|
14
14
|
@initial_args = args.clone
|
15
|
-
@config = args[:config]
|
15
|
+
@config = args[:config] || { }
|
16
16
|
@notifiers = args[:notifiers] || [ ]
|
17
17
|
|
18
18
|
@dry_run = args.fetch(:dry_run, false)
|
@@ -80,29 +80,36 @@ module Envoi
|
|
80
80
|
{ success: success }
|
81
81
|
end
|
82
82
|
|
83
|
-
def self.
|
83
|
+
def self.load_config_from_file(args)
|
84
84
|
config_file_path = args[:config_file_path]
|
85
|
+
config_file_path = File.expand_path(config_file_path)
|
85
86
|
config_file_path = config_file_path.find { |v| File.exists?(v) } if config_file_path.is_a?(Array)
|
86
|
-
|
87
|
+
raise "Missing Config File. '#{config_file_path}'" unless config_file_path && !config_file_path.empty? && File.exists?(config_file_path)
|
87
88
|
|
88
89
|
begin
|
89
90
|
config = JSON.parse(File.read(config_file_path))
|
90
91
|
rescue => e
|
91
|
-
|
92
|
+
raise "Failed to Load Config File. '#{config_file_path}' '#{e.message}'"
|
92
93
|
end
|
93
|
-
|
94
|
-
|
95
|
-
self.new(args.merge({ :config => config }))
|
94
|
+
config
|
96
95
|
end
|
97
96
|
|
98
|
-
def self.
|
97
|
+
def self.load_config_from_service(args)
|
99
98
|
args_out = { }
|
100
99
|
args_out[:app_id] = args[:config_service_app_id]
|
101
100
|
args_out[:token] = args[:config_service_app_token]
|
102
101
|
args_out[:api_url] = args[:config_service_app_url]
|
103
102
|
config = Envoi::Mam::Agent::ConfigServiceClient.config_get(args_out)
|
104
|
-
|
103
|
+
config
|
104
|
+
end
|
105
105
|
|
106
|
+
def self.load_from_config_file(args)
|
107
|
+
config = load_config_from_file(args)
|
108
|
+
self.new(args.merge({ :config => config }))
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.load_from_config_service(args)
|
112
|
+
config = load_config_from_service(args)
|
106
113
|
self.new(args.merge({ :config => config }))
|
107
114
|
end
|
108
115
|
|
@@ -6,83 +6,89 @@ require 'vidispine/api/utilities'
|
|
6
6
|
module Envoi
|
7
7
|
|
8
8
|
module Mam
|
9
|
-
|
9
|
+
|
10
10
|
module Cantemo
|
11
11
|
|
12
12
|
class Agent < Envoi::Mam::Agent
|
13
|
-
|
14
|
-
DEFAULT_SHAPE_TAG
|
15
|
-
DEFAULT_DESTINATION_PATH
|
13
|
+
|
14
|
+
DEFAULT_SHAPE_TAG = 'original'
|
15
|
+
DEFAULT_DESTINATION_PATH = '.'
|
16
16
|
DEFAULT_PRESERVE_FILE_PATH = true
|
17
17
|
|
18
18
|
attr_accessor :default_aspera_ascp_args,
|
19
19
|
:default_aspera_ascp_path,
|
20
20
|
:default_vidispine_shape_tag,
|
21
21
|
:default_preserve_file_path
|
22
|
-
|
22
|
+
|
23
23
|
def after_initialize
|
24
|
-
args
|
25
|
-
@default_aspera_ascp_path
|
26
|
-
@default_aspera_args
|
24
|
+
args = initial_args
|
25
|
+
@default_aspera_ascp_path = args[:default_aspera_ascp_path]
|
26
|
+
@default_aspera_args = args.fetch(:default_ascp_args, Envoi::Mam::Agent::TransferClient::Aspera::DEFAULT_ASCP_ARGS)
|
27
27
|
@default_preserve_file_path = args.fetch(:default_preserve_file_path, DEFAULT_PRESERVE_FILE_PATH)
|
28
28
|
end
|
29
|
-
|
30
|
-
def dry_run?;
|
31
|
-
|
29
|
+
|
30
|
+
def dry_run?;
|
31
|
+
@dry_run
|
32
|
+
end
|
33
|
+
|
32
34
|
def agent_config
|
33
|
-
@agent_config ||= config['cantemo'] || config
|
35
|
+
@agent_config ||= config['cantemo'] || config || {}
|
34
36
|
end
|
35
|
-
|
36
|
-
def
|
37
|
-
|
37
|
+
|
38
|
+
def agent_config_storages
|
39
|
+
agent_config['storages']
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize_api_client(args = {})
|
43
|
+
api_config = agent_config
|
38
44
|
@api_client = args[:api_client] || begin
|
39
|
-
|
40
|
-
api_host
|
41
|
-
api_port
|
42
|
-
api_host_use_ssl
|
43
|
-
api_username
|
44
|
-
api_password
|
45
|
-
api_auth_token
|
46
|
-
api_base_path
|
45
|
+
|
46
|
+
api_host = api_config['host']
|
47
|
+
api_port = api_config['port']
|
48
|
+
api_host_use_ssl = api_config['ssl']
|
49
|
+
api_username = api_config['username']
|
50
|
+
api_password = api_config['password']
|
51
|
+
api_auth_token = api_config['api_auth_token']
|
52
|
+
api_base_path = api_config['api_base_path']
|
47
53
|
api_default_query_data = api_config['default_query_data']
|
48
54
|
|
49
55
|
api_url = api_config['url'] || api_config['uri']
|
50
56
|
if api_url
|
51
|
-
api_uri
|
52
|
-
api_host
|
53
|
-
api_port
|
57
|
+
api_uri = URI(api_url)
|
58
|
+
api_host ||= api_uri.host
|
59
|
+
api_port ||= api_uri.port
|
54
60
|
api_userinfo = api_uri.userinfo
|
55
61
|
if api_userinfo
|
56
62
|
_api_username, _api_password = api_userinfo.split(':')
|
57
|
-
api_username
|
58
|
-
api_password
|
63
|
+
api_username ||= _api_username
|
64
|
+
api_password ||= _api_password
|
59
65
|
end
|
60
|
-
api_host_use_ssl
|
61
|
-
api_uri_query
|
66
|
+
api_host_use_ssl = api_uri.scheme == 'https' if api_host_use_ssl.nil?
|
67
|
+
api_uri_query = api_uri.query
|
62
68
|
api_default_query_data ||= Hash[api_uri_query.split('&').map { |kp| kp.split('=') }]
|
63
|
-
api_base_path
|
69
|
+
api_base_path ||= api_uri.path
|
64
70
|
end
|
65
71
|
|
66
|
-
api_port
|
72
|
+
api_port ||= (api_host_use_ssl ? 443 : 80)
|
67
73
|
api_base_path ||= '/'
|
68
74
|
|
69
|
-
api_endpoint_prefix
|
75
|
+
api_endpoint_prefix = 'VSAPI'
|
70
76
|
api_noauth_endpoint_prefix = 'APInoauth'
|
71
77
|
|
72
|
-
client_args
|
73
|
-
client_args[:http_host_address]
|
74
|
-
client_args[:http_host_port]
|
75
|
-
client_args[:http_host_use_ssl]
|
76
|
-
client_args[:username]
|
77
|
-
client_args[:password]
|
78
|
-
client_args[:default_base_path]
|
79
|
-
client_args[:default_query_data]
|
80
|
-
client_args[:api_endpoint_prefix]
|
78
|
+
client_args = {}
|
79
|
+
client_args[:http_host_address] = api_host if api_host
|
80
|
+
client_args[:http_host_port] = api_port if api_port
|
81
|
+
client_args[:http_host_use_ssl] = api_host_use_ssl if api_host_use_ssl
|
82
|
+
client_args[:username] = api_username if api_username
|
83
|
+
client_args[:password] = api_password if api_password
|
84
|
+
client_args[:default_base_path] = api_base_path if api_base_path
|
85
|
+
client_args[:default_query_data] = api_default_query_data if api_default_query_data
|
86
|
+
client_args[:api_endpoint_prefix] = api_endpoint_prefix
|
81
87
|
client_args[:api_noauth_endpoint_prefix] = api_noauth_endpoint_prefix
|
82
88
|
|
83
89
|
if api_auth_token
|
84
90
|
# Cantemo Portal supports an auth token for authentication, replace basic auth with auth-token
|
85
|
-
client_args[:authorization_header_key]
|
91
|
+
client_args[:authorization_header_key] = 'Auth-Token'
|
86
92
|
client_args[:authorization_header_value] = api_auth_token
|
87
93
|
end
|
88
94
|
|
@@ -91,39 +97,38 @@ module Envoi
|
|
91
97
|
begin
|
92
98
|
_client.version
|
93
99
|
rescue => e
|
94
|
-
|
95
|
-
raise e
|
100
|
+
raise "Error connecting to Portal: #{e.message}"
|
96
101
|
end
|
97
102
|
|
98
103
|
_client
|
99
104
|
end
|
100
105
|
|
101
106
|
@default_vidispine_shape_tag = args[:default_shape_tag] || api_config['default_shape_tag'] || api_config['shape_tag'] || DEFAULT_SHAPE_TAG
|
102
|
-
|
107
|
+
|
103
108
|
end
|
104
|
-
|
109
|
+
|
105
110
|
def item_get_shape_by_tag(item_id, shape_tag)
|
106
111
|
item_shapes_get_response = api_client.item_shapes_get(:item_id => item_id, :tag => shape_tag)
|
107
|
-
shape_id
|
112
|
+
shape_id = item_shapes_get_response['uri'].first
|
108
113
|
end
|
109
114
|
|
110
|
-
def download(args = {
|
115
|
+
def download(args = {})
|
111
116
|
|
112
|
-
item_id
|
117
|
+
item_id = args[:item_id]
|
113
118
|
shape_id = args[:shape_id]
|
114
119
|
unless shape_id && !shape_id.empty?
|
115
120
|
shape_tag = args[:shape_tag] || default_vidispine_shape_tag
|
116
|
-
shape_id
|
121
|
+
shape_id = item_get_shape_by_tag(item_id, shape_tag)
|
117
122
|
end
|
118
123
|
|
119
|
-
logger.info { "Getting file path for Item ID: #{item_id} Shape ID: #{shape_id}"}
|
124
|
+
logger.info { "Getting file path for Item ID: #{item_id} Shape ID: #{shape_id}" }
|
120
125
|
item_shape_get_response = api_client.item_shape_get(:item_id => item_id, :shape_id => shape_id)
|
121
126
|
|
122
127
|
files = item_shape_get_response['containerComponent']['file']
|
123
|
-
logger.debug { "Files: #{files}"}
|
128
|
+
logger.debug { "Files: #{files}" }
|
124
129
|
|
125
130
|
# file = files.first
|
126
|
-
files = [
|
131
|
+
files = [files.first] # just do the first file for now
|
127
132
|
files.each do |file|
|
128
133
|
begin
|
129
134
|
download_file(args, file)
|
@@ -135,13 +140,13 @@ module Envoi
|
|
135
140
|
end
|
136
141
|
|
137
142
|
def download_file(args, file)
|
138
|
-
logger.debug { "File: #{file}"}
|
143
|
+
logger.debug { "File: #{file}" }
|
139
144
|
transfer_type = args[:transfer_type]
|
140
145
|
|
141
146
|
file_storage_id = file['storage']
|
142
|
-
file_path
|
147
|
+
file_path = file['path']
|
143
148
|
|
144
|
-
file_storage_config =
|
149
|
+
file_storage_config = agent_config_storages[file_storage_id]
|
145
150
|
|
146
151
|
unless file_storage_config && !file_storage_config.empty?
|
147
152
|
raise Exception, "No configuration found for storage '#{file_storage_id}'"
|
@@ -151,8 +156,8 @@ module Envoi
|
|
151
156
|
preserve_path = args.fetch(:preserve_path, file_storage_config.fetch('preserve_path', default_preserve_file_path))
|
152
157
|
|
153
158
|
destination_path = args[:destination_path] || file_storage_config['destination_path'] || DEFAULT_DESTINATION_PATH
|
154
|
-
relative_path
|
155
|
-
relative_path
|
159
|
+
relative_path = preserve_path ? File.dirname(file_path) : nil
|
160
|
+
relative_path = nil if relative_path == '.'
|
156
161
|
|
157
162
|
target_path = relative_path ? File.join(destination_path, relative_path) : destination_path
|
158
163
|
target_path = target_path[0..-1] if target_path.start_with?('/') && !destination_path.start_with?('/')
|
@@ -168,15 +173,15 @@ module Envoi
|
|
168
173
|
if (transfer_type.empty? || transfer_type == :s3) && (s3_config && !s3_config.empty?)
|
169
174
|
target_path = File.expand_path(target_path) if target_path == '.'
|
170
175
|
target_path = File.join(target_path, File.basename(file_path))
|
171
|
-
client
|
176
|
+
client = Envoi::Mam::Agent::TransferClient::S3.new(agent: self)
|
172
177
|
return client.download(s3_config, file_path, target_path)
|
173
178
|
end
|
174
179
|
|
175
180
|
logger.warn { "No Supported TransferClient Configuration#{transfer_type && !transfer_type.empty? ? " for transfer type '#{transfer_type}' " : ''}Found in Storage Configuration." }
|
176
181
|
end
|
177
182
|
|
178
|
-
def upload(args = {
|
179
|
-
_response = {
|
183
|
+
def upload(args = {})
|
184
|
+
_response = {}
|
180
185
|
|
181
186
|
file_path = args[:file_path]
|
182
187
|
raise ArgumentError, "Path not found: '#{file_path}'" unless File.exists?(file_path)
|
@@ -184,16 +189,16 @@ module Envoi
|
|
184
189
|
if File.directory?(file_path)
|
185
190
|
# Non-recursive directory upload
|
186
191
|
file_paths = Dir.glob(File.join(file_path, '*.*'))
|
187
|
-
logger.debug { "File Paths: #{file_paths}"}
|
188
|
-
file_paths.map { |fp| upload(args.merge(file_path: fp))}
|
192
|
+
logger.debug { "File Paths: #{file_paths}" }
|
193
|
+
file_paths.map { |fp| upload(args.merge(file_path: fp)) }
|
189
194
|
return file_paths
|
190
195
|
end
|
191
196
|
logger.debug { "Preparing to upload '#{file_path}'" }
|
192
197
|
|
193
|
-
transfer_type
|
194
|
-
storage_id
|
195
|
-
vidispine_storage_config =
|
196
|
-
|
198
|
+
transfer_type = args[:transfer_type] || ''
|
199
|
+
storage_id = args[:storage_id]
|
200
|
+
vidispine_storage_config = agent_config_storages[storage_id]
|
201
|
+
|
197
202
|
unless vidispine_storage_config && !vidispine_storage_config.empty?
|
198
203
|
raise "No configuration found for storage '#{storage_id}'"
|
199
204
|
end
|
@@ -201,37 +206,37 @@ module Envoi
|
|
201
206
|
should_import_file = args.fetch(:import_file, vidispine_storage_config.fetch('import', true))
|
202
207
|
|
203
208
|
should_preserve_path = args.fetch(:preserve_path, vidispine_storage_config.fetch('preserve_path', default_preserve_file_path))
|
204
|
-
|
209
|
+
|
205
210
|
destination_path = args[:destination_path] || vidispine_storage_config['destination_path'] || '/'
|
206
|
-
relative_path
|
207
|
-
relative_path
|
208
|
-
|
211
|
+
relative_path = should_preserve_path ? File.dirname(file_path) : nil
|
212
|
+
relative_path = File.expand_path(relative_path) if relative_path == '.'
|
213
|
+
|
209
214
|
target_path = relative_path ? File.join(destination_path, relative_path) : destination_path
|
210
215
|
target_path = target_path[0..-1] if target_path.start_with?('/') && !destination_path.start_with?('/')
|
211
|
-
|
212
|
-
|
216
|
+
|
217
|
+
|
213
218
|
# upload file
|
214
219
|
|
215
220
|
transfer_response = begin
|
216
|
-
response
|
221
|
+
response = nil
|
217
222
|
aspera_config = vidispine_storage_config['aspera']
|
218
223
|
begin
|
219
224
|
if (transfer_type.empty? || transfer_type == :aspera) && (aspera_config && !aspera_config.empty?)
|
220
|
-
client
|
225
|
+
client = Envoi::Mam::Agent::TransferClient::Aspera.new(agent: self)
|
221
226
|
response = client.upload(aspera_config, file_path, target_path)
|
222
227
|
end
|
223
228
|
rescue => e
|
224
229
|
logger.error { "Aspera Transfer Failed. '#{e.message}'\n#{e.backtrace.first}" }
|
225
230
|
end
|
226
|
-
|
231
|
+
|
227
232
|
s3_config = vidispine_storage_config['s3']
|
228
233
|
begin
|
229
234
|
if !response && (transfer_type.empty? || transfer_type == :s3) && (s3_config && !s3_config.empty?)
|
230
235
|
_target_path = target_path
|
231
236
|
_target_path = File.expand_path(_target_path) if target_path == '.'
|
232
237
|
_target_path = File.join(_target_path, File.basename(file_path))
|
233
|
-
client
|
234
|
-
response
|
238
|
+
client = Envoi::Mam::Agent::TransferClient::S3.new(agent: self)
|
239
|
+
response = client.upload(s3_config, file_path, _target_path)
|
235
240
|
end
|
236
241
|
rescue => e
|
237
242
|
logger.error { "S3 Transfer Failed. '#{e.message}'" }
|
@@ -263,9 +268,9 @@ module Envoi
|
|
263
268
|
|
264
269
|
|
265
270
|
### IMPORT - START
|
266
|
-
import_file_args
|
271
|
+
import_file_args = args.dup
|
267
272
|
import_file_args[:response_object] = _response
|
268
|
-
import_file_args[:target_path]
|
273
|
+
import_file_args[:target_path] = target_path
|
269
274
|
import_file(import_file_args)
|
270
275
|
_response[:success] = true unless _response[:success] === false
|
271
276
|
### IMPORT - END
|
@@ -277,31 +282,46 @@ module Envoi
|
|
277
282
|
return _response
|
278
283
|
end
|
279
284
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
285
|
+
# @param [Hash] args
|
286
|
+
# @option args [String] :file_path
|
287
|
+
# @option args [Hash] :import_args ({})
|
288
|
+
# @option args [Hash] :import_options ({})
|
289
|
+
# @option args [String] :item_id
|
290
|
+
# @option args [Hash] :response_object ({})
|
291
|
+
# @option args [String] :shape_id (@default_vidispine_shape_tag)
|
292
|
+
# @option args [String] :storage_id
|
293
|
+
# @option args [String] :target_path
|
294
|
+
#
|
295
|
+
# @return [Hash{ :success->Boolean, :file_create_response->{}, :import_response->{} }]
|
296
|
+
def import_file(args = {})
|
297
|
+
_response = args[:response_object] || {}
|
298
|
+
|
299
|
+
file_path = args[:file_path]
|
284
300
|
storage_id = args[:storage_id]
|
285
301
|
|
286
302
|
target_path = args[:target_path]
|
287
303
|
|
288
|
-
item_id
|
304
|
+
item_id = args[:item_id]
|
289
305
|
shape_tag = args[:shape_tag] || default_vidispine_shape_tag
|
290
306
|
|
307
|
+
import_args_in = args[:import_args]
|
308
|
+
import_options = args[:import_options] || {}
|
309
|
+
|
310
|
+
|
291
311
|
# attach file to item as shape
|
292
312
|
path_on_storage = File.join(target_path, File.basename(file_path))
|
293
313
|
path_on_storage = path_on_storage[1..-1] if path_on_storage.start_with?('/')
|
294
314
|
# file_create_response = api_client.storage_file_create(storage_id: storage_id,
|
295
315
|
# path: path_on_storage, state: 'CLOSED')
|
296
|
-
file_create_response
|
316
|
+
file_create_response = api_client.storage_file_get_or_create(storage_id, path_on_storage, { :extended_response => true })
|
297
317
|
_response[:file_create_response] = file_create_response
|
298
|
-
file
|
318
|
+
file = file_create_response[:file]
|
299
319
|
|
300
320
|
file_id = file['id']
|
301
321
|
|
302
322
|
unless file_id
|
303
323
|
_file = file.dup
|
304
|
-
_file.keep_if { |k,v| v }
|
324
|
+
_file.keep_if { |k, v| v }
|
305
325
|
logger.error { "Failed to create file. #{_file}" }
|
306
326
|
_response[:success] = false
|
307
327
|
return _response
|
@@ -311,23 +331,28 @@ module Envoi
|
|
311
331
|
|
312
332
|
if item
|
313
333
|
shape = (item['shape'] || []).first
|
314
|
-
msg
|
334
|
+
msg = "File already exist and is associated to item #{item['id']} as shape #{shape['id']}."
|
315
335
|
logger.warn { "#{msg} #{file}" }
|
316
|
-
_response[:error]
|
336
|
+
_response[:error] = { :message => msg }
|
317
337
|
_response[:success] = false
|
318
338
|
return _response
|
319
339
|
end
|
320
340
|
|
321
341
|
if item_id
|
322
342
|
item_shape_import_response = api_client.item_shape_import(item_id: item_id,
|
323
|
-
tag:
|
343
|
+
tag: shape_tag, fileId: file_id)
|
324
344
|
|
325
345
|
|
326
346
|
else
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
347
|
+
import_args = {
|
348
|
+
storage_id: storage_id,
|
349
|
+
file_path: path_on_storage,
|
350
|
+
fileId: file_id,
|
351
|
+
storage_path_map: { '/' => storage_id }
|
352
|
+
}
|
353
|
+
import_args.merge!(import_args_in) if import_args_in
|
354
|
+
|
355
|
+
item_shape_import_response = api_client.item_add_using_file_path(import_args, import_options)
|
331
356
|
end
|
332
357
|
_response[:import_response] = item_shape_import_response
|
333
358
|
|
@@ -339,7 +364,6 @@ module Envoi
|
|
339
364
|
end
|
340
365
|
|
341
366
|
|
342
|
-
|
343
367
|
def ingest_file
|
344
368
|
# 1) export ASPERA_SCP_TOKEN="ATB3_AEA9dUI5dd2u1k8XBMVD0qInR-Lyylkz8AylTXLVt5_SMVGR8SO7Sdc0lj6RkoHK_DvAAEWac8bllF_Yan1NbbDTyPj_3BTA"
|
345
369
|
# 2) ascp -i asperaweb_id_dsa.openssh -P 33001 -l 20m /Users/nicholasstokes/Desktop/CantemoAgent.mov xfer@ats-aws-us-west-2.aspera.io:
|
@@ -363,10 +387,10 @@ module Envoi
|
|
363
387
|
|
364
388
|
# Agent
|
365
389
|
end
|
366
|
-
|
390
|
+
|
367
391
|
# Cantemo
|
368
392
|
end
|
369
|
-
|
393
|
+
|
370
394
|
end
|
371
395
|
|
372
396
|
end
|