aspera-cli 4.7.0 → 4.9.0
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
- checksums.yaml.gz.sig +0 -0
- data/README.md +1267 -999
- data/bin/ascli +20 -1
- data/bin/asession +37 -34
- data/docs/test_env.conf +7 -3
- data/examples/aoc.rb +13 -12
- data/examples/dascli +23 -0
- data/examples/faspex4.rb +34 -29
- data/examples/{transfer.rb → node.rb} +31 -59
- data/examples/server.rb +93 -0
- data/lib/aspera/aoc.rb +153 -143
- data/lib/aspera/ascmd.rb +56 -45
- data/lib/aspera/ats_api.rb +9 -6
- data/lib/aspera/cli/basic_auth_plugin.rb +18 -16
- data/lib/aspera/cli/extended_value.rb +33 -30
- data/lib/aspera/cli/formater.rb +105 -111
- data/lib/aspera/cli/info.rb +3 -2
- data/lib/aspera/cli/listener/line_dump.rb +1 -0
- data/lib/aspera/cli/listener/logger.rb +1 -0
- data/lib/aspera/cli/listener/progress.rb +13 -12
- data/lib/aspera/cli/listener/progress_multi.rb +21 -20
- data/lib/aspera/cli/main.rb +110 -90
- data/lib/aspera/cli/manager.rb +99 -88
- data/lib/aspera/cli/plugin.rb +98 -39
- data/lib/aspera/cli/plugins/alee.rb +6 -5
- data/lib/aspera/cli/plugins/aoc.rb +581 -450
- data/lib/aspera/cli/plugins/ats.rb +84 -83
- data/lib/aspera/cli/plugins/bss.rb +30 -27
- data/lib/aspera/cli/plugins/config.rb +488 -397
- data/lib/aspera/cli/plugins/console.rb +17 -15
- data/lib/aspera/cli/plugins/cos.rb +26 -35
- data/lib/aspera/cli/plugins/faspex.rb +206 -172
- data/lib/aspera/cli/plugins/faspex5.rb +109 -74
- data/lib/aspera/cli/plugins/node.rb +379 -189
- data/lib/aspera/cli/plugins/orchestrator.rb +71 -65
- data/lib/aspera/cli/plugins/preview.rb +131 -122
- data/lib/aspera/cli/plugins/server.rb +50 -150
- data/lib/aspera/cli/plugins/shares.rb +61 -27
- data/lib/aspera/cli/plugins/sync.rb +15 -14
- data/lib/aspera/cli/transfer_agent.rb +75 -64
- data/lib/aspera/cli/version.rb +2 -1
- data/lib/aspera/colors.rb +29 -28
- data/lib/aspera/command_line_builder.rb +50 -43
- data/lib/aspera/cos_node.rb +64 -38
- data/lib/aspera/data_repository.rb +1 -0
- data/lib/aspera/environment.rb +33 -10
- data/lib/aspera/fasp/agent_base.rb +35 -30
- data/lib/aspera/fasp/agent_connect.rb +35 -30
- data/lib/aspera/fasp/agent_direct.rb +68 -60
- data/lib/aspera/fasp/agent_httpgw.rb +71 -64
- data/lib/aspera/fasp/agent_node.rb +24 -23
- data/lib/aspera/fasp/agent_trsdk.rb +19 -20
- data/lib/aspera/fasp/error.rb +2 -1
- data/lib/aspera/fasp/error_info.rb +79 -68
- data/lib/aspera/fasp/installation.rb +130 -126
- data/lib/aspera/fasp/listener.rb +1 -0
- data/lib/aspera/fasp/parameters.rb +71 -60
- data/lib/aspera/fasp/parameters.yaml +69 -17
- data/lib/aspera/fasp/resume_policy.rb +14 -11
- data/lib/aspera/fasp/transfer_spec.rb +6 -5
- data/lib/aspera/fasp/uri.rb +25 -24
- data/lib/aspera/faspex_gw.rb +83 -72
- data/lib/aspera/hash_ext.rb +23 -13
- data/lib/aspera/id_generator.rb +16 -13
- data/lib/aspera/keychain/encrypted_hash.rb +61 -46
- data/lib/aspera/keychain/macos_security.rb +26 -24
- data/lib/aspera/log.rb +35 -39
- data/lib/aspera/nagios.rb +36 -28
- data/lib/aspera/node.rb +19 -19
- data/lib/aspera/oauth.rb +120 -100
- data/lib/aspera/open_application.rb +25 -22
- data/lib/aspera/persistency_action_once.rb +9 -8
- data/lib/aspera/persistency_folder.rb +13 -9
- data/lib/aspera/preview/file_types.rb +261 -266
- data/lib/aspera/preview/generator.rb +74 -73
- data/lib/aspera/preview/image_error.png +0 -0
- data/lib/aspera/preview/options.rb +7 -6
- data/lib/aspera/preview/utils.rb +30 -33
- data/lib/aspera/preview/video_error.png +0 -0
- data/lib/aspera/proxy_auto_config.rb +27 -23
- data/lib/aspera/rest.rb +73 -74
- data/lib/aspera/rest_call_error.rb +1 -0
- data/lib/aspera/rest_error_analyzer.rb +23 -19
- data/lib/aspera/rest_errors_aspera.rb +43 -40
- data/lib/aspera/secret_hider.rb +74 -0
- data/lib/aspera/ssh.rb +13 -10
- data/lib/aspera/sync.rb +49 -47
- data/lib/aspera/temp_file_manager.rb +7 -5
- data/lib/aspera/timer_limiter.rb +9 -8
- data/lib/aspera/uri_reader.rb +17 -18
- data/lib/aspera/web_auth.rb +17 -15
- data.tar.gz.sig +5 -0
- metadata +119 -35
- metadata.gz.sig +0 -0
- data/bin/dascli +0 -13
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'English'
|
3
4
|
require 'singleton'
|
4
5
|
require 'aspera/log'
|
@@ -22,15 +23,15 @@ module Aspera
|
|
22
23
|
class Installation
|
23
24
|
include Singleton
|
24
25
|
# known product names
|
25
|
-
PRODUCT_CONNECT='Aspera Connect'
|
26
|
-
PRODUCT_CLI_V1='Aspera CLI'
|
27
|
-
PRODUCT_DRIVE='Aspera Drive'
|
28
|
-
PRODUCT_ENTSRV='Enterprise Server'
|
26
|
+
PRODUCT_CONNECT = 'Aspera Connect'
|
27
|
+
PRODUCT_CLI_V1 = 'Aspera CLI'
|
28
|
+
PRODUCT_DRIVE = 'Aspera Drive'
|
29
|
+
PRODUCT_ENTSRV = 'Enterprise Server'
|
29
30
|
# protobuf generated files from sdk
|
30
|
-
EXT_RUBY_PROTOBUF='_pb.rb'
|
31
|
-
RB_SDK_FOLDER='lib'
|
32
|
-
ONE_YEAR_SECONDS=365 * 24 * 60 * 60
|
33
|
-
DEFAULT_ASPERA_CONF
|
31
|
+
EXT_RUBY_PROTOBUF = '_pb.rb'
|
32
|
+
RB_SDK_FOLDER = 'lib'
|
33
|
+
ONE_YEAR_SECONDS = 365 * 24 * 60 * 60
|
34
|
+
DEFAULT_ASPERA_CONF = <<~END_OF_CONFIG_FILE
|
34
35
|
<?xml version='1.0' encoding='UTF-8'?>
|
35
36
|
<CONF version="2">
|
36
37
|
<default>
|
@@ -41,10 +42,12 @@ module Aspera
|
|
41
42
|
</default>
|
42
43
|
</CONF>
|
43
44
|
END_OF_CONFIG_FILE
|
44
|
-
|
45
|
+
DUMMY_CERT_INFO='/C=US/ST=California/L=Emeryville/O=Aspera Inc./OU=Corporate/CN=Aspera Inc./emailAddress=info@asperasoft.com'
|
46
|
+
private_constant :PRODUCT_CONNECT,:PRODUCT_CLI_V1,:PRODUCT_DRIVE,:PRODUCT_ENTSRV,:EXT_RUBY_PROTOBUF,:RB_SDK_FOLDER,
|
47
|
+
:ONE_YEAR_SECONDS,:DEFAULT_ASPERA_CONF,:DUMMY_CERT_INFO
|
45
48
|
# set ascp executable path
|
46
49
|
def ascp_path=(v)
|
47
|
-
@path_to_ascp=v
|
50
|
+
@path_to_ascp = v
|
48
51
|
end
|
49
52
|
|
50
53
|
def ascp_path
|
@@ -52,19 +55,19 @@ module Aspera
|
|
52
55
|
end
|
53
56
|
|
54
57
|
def sdk_ruby_folder
|
55
|
-
ruby_pb_folder=File.join(sdk_folder,RB_SDK_FOLDER)
|
58
|
+
ruby_pb_folder = File.join(sdk_folder,RB_SDK_FOLDER)
|
56
59
|
FileUtils.mkdir_p(ruby_pb_folder) unless Dir.exist?(ruby_pb_folder)
|
57
60
|
return ruby_pb_folder
|
58
61
|
end
|
59
62
|
|
60
63
|
# location of SDK files
|
61
64
|
def sdk_folder=(v)
|
62
|
-
@sdk_dir=v
|
65
|
+
@sdk_dir = v
|
63
66
|
sdk_folder
|
64
67
|
end
|
65
68
|
|
66
69
|
# backward compatibility in sample program
|
67
|
-
|
70
|
+
alias_method :folder=, :sdk_folder=
|
68
71
|
|
69
72
|
# @return the path to folder where SDK is installed
|
70
73
|
def sdk_folder
|
@@ -77,43 +80,43 @@ module Aspera
|
|
77
80
|
# or select one from installed_products()
|
78
81
|
def use_ascp_from_product(product_name)
|
79
82
|
if product_name.eql?(FIRST_FOUND)
|
80
|
-
pl=installed_products.first
|
83
|
+
pl = installed_products.first
|
81
84
|
raise "no FASP installation found\nPlease check manual on how to install FASP." if pl.nil?
|
82
85
|
else
|
83
|
-
pl=installed_products.
|
86
|
+
pl = installed_products.find{|i|i[:name].eql?(product_name)}
|
84
87
|
raise "no such product installed: #{product_name}" if pl.nil?
|
85
88
|
end
|
86
|
-
self.ascp_path=pl[:ascp_path]
|
89
|
+
self.ascp_path = pl[:ascp_path]
|
87
90
|
Log.log.debug("ascp_path=#{@path_to_ascp}")
|
88
91
|
end
|
89
92
|
|
90
93
|
# @return the list of installed products in format of product_locations
|
91
94
|
def installed_products
|
92
95
|
if @found_products.nil?
|
93
|
-
scan_locations=product_locations.clone
|
96
|
+
scan_locations = product_locations.clone
|
94
97
|
# add SDK as first search path
|
95
98
|
scan_locations.unshift({
|
96
99
|
expected: 'SDK',
|
97
100
|
app_root: sdk_folder,
|
98
|
-
sub_bin:
|
101
|
+
sub_bin: ''
|
99
102
|
})
|
100
103
|
# search installed products: with ascp
|
101
|
-
@found_products=scan_locations.select! do |item|
|
104
|
+
@found_products = scan_locations.select! do |item|
|
102
105
|
# skip if not main folder
|
103
106
|
next false unless Dir.exist?(item[:app_root])
|
104
107
|
Log.log.debug("Found #{item[:app_root]}")
|
105
108
|
sub_bin = item[:sub_bin] || BIN_SUBFOLDER
|
106
|
-
item[:ascp_path]=File.join(item[:app_root],sub_bin,ascp_filename)
|
109
|
+
item[:ascp_path] = File.join(item[:app_root],sub_bin,ascp_filename)
|
107
110
|
# skip if no ascp
|
108
111
|
next false unless File.exist?(item[:ascp_path])
|
109
112
|
# read info from product info file if present
|
110
|
-
product_info_file="#{item[:app_root]}/#{PRODUCT_INFO}"
|
113
|
+
product_info_file = "#{item[:app_root]}/#{PRODUCT_INFO}"
|
111
114
|
if File.exist?(product_info_file)
|
112
|
-
res_s=XmlSimple.xml_in(File.read(product_info_file),{'ForceArray'=>false})
|
113
|
-
item[:name]=res_s['name']
|
114
|
-
item[:version]=res_s['version']
|
115
|
+
res_s = XmlSimple.xml_in(File.read(product_info_file),{'ForceArray' => false})
|
116
|
+
item[:name] = res_s['name']
|
117
|
+
item[:version] = res_s['version']
|
115
118
|
else
|
116
|
-
item[:name]=item[:expected]
|
119
|
+
item[:name] = item[:expected]
|
117
120
|
end
|
118
121
|
true # select this version
|
119
122
|
end
|
@@ -122,7 +125,7 @@ module Aspera
|
|
122
125
|
end
|
123
126
|
|
124
127
|
# all ascp files (in SDK)
|
125
|
-
FILES=[
|
128
|
+
FILES = %i[ascp ascp4 ssh_bypass_key_dsa ssh_bypass_key_rsa aspera_license aspera_conf fallback_cert fallback_key].freeze
|
126
129
|
|
127
130
|
# get path of one resource file of currently activated product
|
128
131
|
# keys and certs are generated locally... (they are well known values, arch. independant)
|
@@ -130,46 +133,43 @@ module Aspera
|
|
130
133
|
case k
|
131
134
|
when :ascp,:ascp4
|
132
135
|
use_ascp_from_product(FIRST_FOUND) if @path_to_ascp.nil?
|
133
|
-
file
|
136
|
+
file = @path_to_ascp
|
134
137
|
# note that there might be a .exe at the end
|
135
|
-
file=file.gsub('ascp','ascp4') if k.eql?(:ascp4)
|
138
|
+
file = file.gsub('ascp','ascp4') if k.eql?(:ascp4)
|
136
139
|
when :transferd
|
137
|
-
file=transferd_filepath
|
140
|
+
file = transferd_filepath
|
138
141
|
when :ssh_bypass_key_dsa
|
139
|
-
file=File.join(sdk_folder,'aspera_bypass_dsa.pem')
|
140
|
-
File.write(file,get_key('dsa',1)) unless File.exist?(file)
|
141
|
-
File.chmod(0400,file)
|
142
|
+
file=Environment.write_file_restricted(File.join(sdk_folder,'aspera_bypass_dsa.pem')) {get_key('dsa',1)}
|
142
143
|
when :ssh_bypass_key_rsa
|
143
|
-
file=File.join(sdk_folder,'aspera_bypass_rsa.pem')
|
144
|
-
File.write(file,get_key('rsa',2)) unless File.exist?(file)
|
145
|
-
File.chmod(0400,file)
|
144
|
+
file=Environment.write_file_restricted(File.join(sdk_folder,'aspera_bypass_rsa.pem')) {get_key('rsa',2)}
|
146
145
|
when :aspera_license
|
147
|
-
file=File.join(sdk_folder,'aspera-license')
|
148
|
-
|
149
|
-
|
146
|
+
file=Environment.write_file_restricted(File.join(sdk_folder,'aspera-license')) do
|
147
|
+
clear=[
|
148
|
+
Zlib::Inflate.inflate(DataRepository.instance.data(6)),
|
149
|
+
"==SIGNATURE==\n",
|
150
|
+
Base64.strict_encode64(DataRepository.instance.data(7))
|
151
|
+
]
|
152
|
+
Base64.strict_encode64(clear.join)
|
153
|
+
end
|
150
154
|
when :aspera_conf
|
151
|
-
file=File.join(sdk_folder,'aspera.conf')
|
152
|
-
File.write(file,DEFAULT_ASPERA_CONF) unless File.exist?(file)
|
153
|
-
File.chmod(0400,file)
|
155
|
+
file=Environment.write_file_restricted(File.join(sdk_folder,'aspera.conf')) {DEFAULT_ASPERA_CONF}
|
154
156
|
when :fallback_cert,:fallback_key
|
155
|
-
file_key=File.join(sdk_folder,'aspera_fallback_key.pem')
|
156
|
-
file_cert=File.join(sdk_folder,'aspera_fallback_cert.pem')
|
157
|
+
file_key = File.join(sdk_folder,'aspera_fallback_key.pem')
|
158
|
+
file_cert = File.join(sdk_folder,'aspera_fallback_cert.pem')
|
157
159
|
if !File.exist?(file_key) || !File.exist?(file_cert)
|
158
160
|
require 'openssl'
|
159
161
|
# create new self signed certificate for http fallback
|
160
162
|
private_key = OpenSSL::PKey::RSA.new(1024)
|
161
163
|
cert = OpenSSL::X509::Certificate.new
|
162
|
-
cert.subject = cert.issuer = OpenSSL::X509::Name.parse(
|
164
|
+
cert.subject = cert.issuer = OpenSSL::X509::Name.parse(DUMMY_CERT_INFO)
|
163
165
|
cert.not_before = Time.now
|
164
166
|
cert.not_after = Time.now + ONE_YEAR_SECONDS
|
165
167
|
cert.public_key = private_key.public_key
|
166
168
|
cert.serial = 0x0
|
167
169
|
cert.version = 2
|
168
170
|
cert.sign(private_key, OpenSSL::Digest.new('SHA1'))
|
169
|
-
|
170
|
-
|
171
|
-
File.chmod(0400,file_key)
|
172
|
-
File.chmod(0400,file_cert)
|
171
|
+
Environment.write_file_restricted(file_key, force: true) {private_key.to_pem}
|
172
|
+
Environment.write_file_restricted(file_cert, force: true) {cert.to_pem}
|
173
173
|
end
|
174
174
|
file = k.eql?(:fallback_cert) ? file_cert : file_key
|
175
175
|
else
|
@@ -181,10 +181,10 @@ module Aspera
|
|
181
181
|
|
182
182
|
# @return the file path of local connect where API's URI can be read
|
183
183
|
def connect_uri
|
184
|
-
connect=get_product_folders(PRODUCT_CONNECT)
|
185
|
-
folder=File.join(connect[:run_root],VARRUN_SUBFOLDER)
|
184
|
+
connect = get_product_folders(PRODUCT_CONNECT)
|
185
|
+
folder = File.join(connect[:run_root],VARRUN_SUBFOLDER)
|
186
186
|
['','s'].each do |ext|
|
187
|
-
uri_file=File.join(folder,"http#{ext}.uri")
|
187
|
+
uri_file = File.join(folder,"http#{ext}.uri")
|
188
188
|
Log.log.debug("checking connect port file: #{uri_file}")
|
189
189
|
if File.exist?(uri_file)
|
190
190
|
return File.open(uri_file, &:gets).strip
|
@@ -195,7 +195,7 @@ module Aspera
|
|
195
195
|
|
196
196
|
# @ return path to configuration file of aspera CLI
|
197
197
|
def cli_conf_file
|
198
|
-
connect=get_product_folders(PRODUCT_CLI_V1)
|
198
|
+
connect = get_product_folders(PRODUCT_CLI_V1)
|
199
199
|
return File.join(connect[:app_root],BIN_SUBFOLDER,'.aspera_cli_conf')
|
200
200
|
end
|
201
201
|
|
@@ -205,7 +205,7 @@ module Aspera
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def bypass_keys
|
208
|
-
return [
|
208
|
+
return %i[ssh_bypass_key_dsa ssh_bypass_key_rsa].map{|i|Installation.instance.path(i)}
|
209
209
|
end
|
210
210
|
|
211
211
|
# use in plugin `config`
|
@@ -217,12 +217,12 @@ module Aspera
|
|
217
217
|
def get_exe_version(exe_path,vers_arg)
|
218
218
|
raise 'ERROR: nil arg' if exe_path.nil?
|
219
219
|
return nil unless File.exist?(exe_path)
|
220
|
-
exe_version=nil
|
221
|
-
cmd_out
|
220
|
+
exe_version = nil
|
221
|
+
cmd_out = %x("#{exe_path}" #{vers_arg})
|
222
222
|
raise "An error occured when testing #{ascp_filename}: #{cmd_out}" unless $CHILD_STATUS == 0
|
223
223
|
# get version from ascp, only after full extract, as windows requires DLLs (SSL/TLS/etc...)
|
224
|
-
m=cmd_out.match(/ version ([0-9.]+)/)
|
225
|
-
exe_version=m[1] unless m.nil?
|
224
|
+
m = cmd_out.match(/ version ([0-9.]+)/)
|
225
|
+
exe_version = m[1] unless m.nil?
|
226
226
|
return exe_version
|
227
227
|
end
|
228
228
|
|
@@ -230,12 +230,14 @@ module Aspera
|
|
230
230
|
# extracts ascp binary for current system architecture
|
231
231
|
# @return ascp version (from execution)
|
232
232
|
def install_sdk(sdk_url)
|
233
|
+
# SDK is organized by architecture, check this first, in case architecture is not supported
|
234
|
+
arch_filter = "#{Environment.architecture}/"
|
233
235
|
require 'zip'
|
234
|
-
sdk_zip_path=File.join(Dir.tmpdir,'sdk.zip')
|
236
|
+
sdk_zip_path = File.join(Dir.tmpdir,'sdk.zip')
|
235
237
|
if sdk_url.start_with?('file:')
|
236
238
|
# require specific file scheme: the path part is "relative", or absolute if there are 4 slash
|
237
239
|
raise 'use format: file:///<path>' unless sdk_url.start_with?('file:///')
|
238
|
-
sdk_zip_path=sdk_url.gsub(%r{^file:///},'')
|
240
|
+
sdk_zip_path = sdk_url.gsub(%r{^file:///},'')
|
239
241
|
else
|
240
242
|
Aspera::Rest.new(base_url: sdk_url, redirect_max: 3).call(operation: 'GET',save_to_file: sdk_zip_path)
|
241
243
|
end
|
@@ -245,18 +247,16 @@ module Aspera
|
|
245
247
|
File.rename(sdk_folder,"#{sdk_folder}.#{Time.now.strftime('%Y%m%d%H%M%S')}")
|
246
248
|
# TODO: delete old archives ?
|
247
249
|
end
|
248
|
-
# SDK is organized by architecture
|
249
|
-
arch_filter="#{Environment.architecture}/"
|
250
250
|
# extract files from archive
|
251
251
|
Zip::File.open(sdk_zip_path) do |zip_file|
|
252
252
|
zip_file.each do |entry|
|
253
253
|
# skip folder entries
|
254
254
|
next if entry.name.end_with?('/')
|
255
|
-
dest_folder=nil
|
255
|
+
dest_folder = nil
|
256
256
|
# binaries
|
257
|
-
dest_folder=sdk_folder if entry.name.include?(arch_filter)
|
257
|
+
dest_folder = sdk_folder if entry.name.include?(arch_filter)
|
258
258
|
# ruby adapters
|
259
|
-
dest_folder=sdk_ruby_folder if entry.name.end_with?(EXT_RUBY_PROTOBUF)
|
259
|
+
dest_folder = sdk_ruby_folder if entry.name.end_with?(EXT_RUBY_PROTOBUF)
|
260
260
|
next if dest_folder.nil?
|
261
261
|
File.open(File.join(dest_folder,File.basename(entry.name)), 'wb') do |output_stream|
|
262
262
|
IO.copy_stream(entry.get_input_stream, output_stream)
|
@@ -267,53 +267,53 @@ module Aspera
|
|
267
267
|
# ensure license file are generated so that ascp invokation for version works
|
268
268
|
path(:aspera_license)
|
269
269
|
path(:aspera_conf)
|
270
|
-
ascp_path=File.join(sdk_folder,ascp_filename)
|
270
|
+
ascp_path = File.join(sdk_folder,ascp_filename)
|
271
271
|
raise "No #{ascp_filename} found in SDK archive" unless File.exist?(ascp_path)
|
272
272
|
FileUtils.chmod(0755,ascp_path)
|
273
273
|
FileUtils.chmod(0755,ascp_path.gsub('ascp','ascp4'))
|
274
|
-
ascp_version=get_ascp_version(File.join(sdk_folder,ascp_filename))
|
275
|
-
trd_path=transferd_filepath
|
274
|
+
ascp_version = get_ascp_version(File.join(sdk_folder,ascp_filename))
|
275
|
+
trd_path = transferd_filepath
|
276
276
|
Log.log.warn("No #{trd_path} in SDK archive") unless File.exist?(trd_path)
|
277
277
|
FileUtils.chmod(0755,trd_path) if File.exist?(trd_path)
|
278
|
-
transferd_version=get_exe_version(trd_path,'version')
|
279
|
-
sdk_version = transferd_version||ascp_version
|
278
|
+
transferd_version = get_exe_version(trd_path,'version')
|
279
|
+
sdk_version = transferd_version || ascp_version
|
280
280
|
File.write(File.join(sdk_folder,PRODUCT_INFO),"<product><name>IBM Aspera SDK</name><version>#{sdk_version}</version></product>")
|
281
281
|
return sdk_version
|
282
282
|
end
|
283
283
|
|
284
284
|
private
|
285
285
|
|
286
|
-
BIN_SUBFOLDER='bin'
|
287
|
-
ETC_SUBFOLDER='etc'
|
288
|
-
VARRUN_SUBFOLDER=File.join('var','run')
|
286
|
+
BIN_SUBFOLDER = 'bin'
|
287
|
+
ETC_SUBFOLDER = 'etc'
|
288
|
+
VARRUN_SUBFOLDER = File.join('var','run')
|
289
289
|
# product information manifest: XML (part of aspera product)
|
290
|
-
PRODUCT_INFO='product-info.mf'
|
290
|
+
PRODUCT_INFO = 'product-info.mf'
|
291
291
|
# policy for product selection
|
292
|
-
FIRST_FOUND='FIRST'
|
292
|
+
FIRST_FOUND = 'FIRST'
|
293
293
|
|
294
294
|
private_constant :BIN_SUBFOLDER,:ETC_SUBFOLDER,:VARRUN_SUBFOLDER,:PRODUCT_INFO
|
295
295
|
|
296
296
|
def initialize
|
297
|
-
@path_to_ascp=nil
|
298
|
-
@sdk_dir=nil
|
299
|
-
@found_products=nil
|
297
|
+
@path_to_ascp = nil
|
298
|
+
@sdk_dir = nil
|
299
|
+
@found_products = nil
|
300
300
|
end
|
301
301
|
|
302
302
|
# @return folder paths for specified applications
|
303
303
|
# @param name Connect or CLI
|
304
304
|
def get_product_folders(name)
|
305
|
-
found=installed_products.select{|i|i[:expected].eql?(name)
|
305
|
+
found = installed_products.select{|i|i[:expected].eql?(name) || i[:name].eql?(name)}
|
306
306
|
raise "Product: #{name} not found, please install." if found.empty?
|
307
307
|
return found.first
|
308
308
|
end
|
309
309
|
|
310
310
|
# filename for ascp with optional extension (Windows)
|
311
311
|
def ascp_filename
|
312
|
-
return 'ascp'+Environment.exe_extension
|
312
|
+
return 'ascp' + Environment.exe_extension
|
313
313
|
end
|
314
314
|
|
315
315
|
def transferd_filepath
|
316
|
-
return File.join(sdk_folder,'asperatransferd'+Environment.exe_extension)
|
316
|
+
return File.join(sdk_folder,'asperatransferd' + Environment.exe_extension)
|
317
317
|
end
|
318
318
|
|
319
319
|
# @return product folders depending on OS fields
|
@@ -325,50 +325,56 @@ module Aspera
|
|
325
325
|
def product_locations
|
326
326
|
case Aspera::Environment.os
|
327
327
|
when Aspera::Environment::OS_WINDOWS; return [{
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
328
|
+
expected: PRODUCT_CONNECT,
|
329
|
+
app_root: File.join(ENV['LOCALAPPDATA'],'Programs','Aspera','Aspera Connect'),
|
330
|
+
log_root: File.join(ENV['LOCALAPPDATA'],'Aspera','Aspera Connect','var','log'),
|
331
|
+
run_root: File.join(ENV['LOCALAPPDATA'],'Aspera','Aspera Connect')
|
332
|
+
},{
|
333
|
+
expected: PRODUCT_CLI_V1,
|
334
|
+
app_root: File.join('C:','Program Files','Aspera','cli'),
|
335
|
+
log_root: File.join('C:','Program Files','Aspera','cli','var','log')
|
336
|
+
},{
|
337
|
+
expected: PRODUCT_ENTSRV,
|
338
|
+
app_root: File.join('C:','Program Files','Aspera','Enterprise Server'),
|
339
|
+
log_root: File.join('C:','Program Files','Aspera','Enterprise Server','var','log')
|
340
|
+
}]
|
341
341
|
when Aspera::Environment::OS_X; return [{
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
342
|
+
expected: PRODUCT_CONNECT,
|
343
|
+
app_root: File.join(Dir.home,'Applications','Aspera Connect.app'),
|
344
|
+
log_root: File.join(Dir.home,'Library','Logs','Aspera_Connect'),
|
345
|
+
run_root: File.join(Dir.home,'Library','Application Support','Aspera','Aspera Connect'),
|
346
|
+
sub_bin: File.join('Contents','Resources')
|
347
|
+
},{
|
348
|
+
expected: PRODUCT_CONNECT,
|
349
|
+
app_root: File.join('','Applications','Aspera Connect.app'),
|
350
|
+
log_root: File.join(Dir.home,'Library','Logs','Aspera_Connect'),
|
351
|
+
run_root: File.join(Dir.home,'Library','Application Support','Aspera','Aspera Connect'),
|
352
|
+
sub_bin: File.join('Contents','Resources')
|
353
|
+
},{
|
354
|
+
expected: PRODUCT_CLI_V1,
|
355
|
+
app_root: File.join(Dir.home,'Applications','Aspera CLI'),
|
356
|
+
log_root: File.join(Dir.home,'Library','Logs','Aspera')
|
357
|
+
},{
|
358
|
+
expected: PRODUCT_ENTSRV,
|
359
|
+
app_root: File.join('','Library','Aspera'),
|
360
|
+
log_root: File.join(Dir.home,'Library','Logs','Aspera')
|
361
|
+
},{
|
362
|
+
expected: PRODUCT_DRIVE,
|
363
|
+
app_root: File.join('','Applications','Aspera Drive.app'),
|
364
|
+
log_root: File.join(Dir.home,'Library','Logs','Aspera_Drive'),
|
365
|
+
sub_bin: File.join('Contents','Resources')
|
366
|
+
}]
|
361
367
|
else; return [{ # other: Linux and Unix family
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
368
|
+
expected: PRODUCT_CONNECT,
|
369
|
+
app_root: File.join(Dir.home,'.aspera','connect'),
|
370
|
+
run_root: File.join(Dir.home,'.aspera','connect')
|
371
|
+
},{
|
372
|
+
expected: PRODUCT_CLI_V1,
|
373
|
+
app_root: File.join(Dir.home,'.aspera','cli')
|
374
|
+
},{
|
375
|
+
expected: PRODUCT_ENTSRV,
|
376
|
+
app_root: File.join('','opt','aspera')
|
377
|
+
}]
|
372
378
|
end
|
373
379
|
end
|
374
380
|
|
@@ -376,10 +382,8 @@ module Aspera
|
|
376
382
|
# @param type rsa or dsa
|
377
383
|
# @param id in repository 1 for dsa, 2 for rsa
|
378
384
|
def get_key(type,id)
|
379
|
-
|
380
|
-
|
381
|
-
# validate valie and generate key in connonical format
|
382
|
-
OpenSSL::PKey.const_get(type.upcase).send(:new,hf.insert(1,bin).join("\n")).to_pem
|
385
|
+
# generate PEM from DER
|
386
|
+
OpenSSL::PKey.const_get(type.upcase).new(DataRepository.instance.data(id)).to_pem
|
383
387
|
end
|
384
388
|
end # Installation
|
385
389
|
end
|