aspera-cli 4.9.0 → 4.11.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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/BUGS.md +20 -0
  4. data/CHANGELOG.md +509 -0
  5. data/CONTRIBUTING.md +118 -0
  6. data/README.md +1241 -916
  7. data/bin/ascli +4 -4
  8. data/bin/asession +11 -11
  9. data/docs/test_env.conf +32 -21
  10. data/examples/aoc.rb +4 -4
  11. data/examples/dascli +16 -9
  12. data/examples/faspex4.rb +8 -8
  13. data/examples/node.rb +12 -12
  14. data/examples/server.rb +10 -10
  15. data/lib/aspera/aoc.rb +273 -266
  16. data/lib/aspera/ascmd.rb +56 -54
  17. data/lib/aspera/ats_api.rb +4 -4
  18. data/lib/aspera/cli/basic_auth_plugin.rb +15 -12
  19. data/lib/aspera/cli/extended_value.rb +5 -5
  20. data/lib/aspera/cli/formater.rb +64 -64
  21. data/lib/aspera/cli/info.rb +2 -2
  22. data/lib/aspera/cli/listener/line_dump.rb +1 -1
  23. data/lib/aspera/cli/listener/logger.rb +1 -1
  24. data/lib/aspera/cli/listener/progress.rb +5 -6
  25. data/lib/aspera/cli/listener/progress_multi.rb +14 -19
  26. data/lib/aspera/cli/main.rb +66 -67
  27. data/lib/aspera/cli/manager.rb +112 -110
  28. data/lib/aspera/cli/plugin.rb +57 -36
  29. data/lib/aspera/cli/plugins/alee.rb +4 -4
  30. data/lib/aspera/cli/plugins/aoc.rb +309 -670
  31. data/lib/aspera/cli/plugins/ats.rb +44 -46
  32. data/lib/aspera/cli/plugins/bss.rb +10 -10
  33. data/lib/aspera/cli/plugins/config.rb +497 -378
  34. data/lib/aspera/cli/plugins/console.rb +12 -12
  35. data/lib/aspera/cli/plugins/cos.rb +18 -20
  36. data/lib/aspera/cli/plugins/faspex.rb +112 -114
  37. data/lib/aspera/cli/plugins/faspex5.rb +71 -46
  38. data/lib/aspera/cli/plugins/node.rb +379 -283
  39. data/lib/aspera/cli/plugins/orchestrator.rb +46 -46
  40. data/lib/aspera/cli/plugins/preview.rb +122 -114
  41. data/lib/aspera/cli/plugins/server.rb +137 -83
  42. data/lib/aspera/cli/plugins/shares.rb +30 -29
  43. data/lib/aspera/cli/plugins/sync.rb +13 -33
  44. data/lib/aspera/cli/transfer_agent.rb +60 -59
  45. data/lib/aspera/cli/version.rb +1 -1
  46. data/lib/aspera/colors.rb +3 -3
  47. data/lib/aspera/command_line_builder.rb +27 -27
  48. data/lib/aspera/cos_node.rb +22 -20
  49. data/lib/aspera/data_repository.rb +1 -1
  50. data/lib/aspera/environment.rb +35 -15
  51. data/lib/aspera/fasp/agent_base.rb +15 -15
  52. data/lib/aspera/fasp/agent_connect.rb +23 -21
  53. data/lib/aspera/fasp/agent_direct.rb +66 -64
  54. data/lib/aspera/fasp/agent_httpgw.rb +141 -78
  55. data/lib/aspera/fasp/agent_node.rb +23 -21
  56. data/lib/aspera/fasp/agent_trsdk.rb +20 -20
  57. data/lib/aspera/fasp/error.rb +3 -2
  58. data/lib/aspera/fasp/error_info.rb +11 -8
  59. data/lib/aspera/fasp/installation.rb +79 -79
  60. data/lib/aspera/fasp/listener.rb +1 -1
  61. data/lib/aspera/fasp/parameters.rb +86 -71
  62. data/lib/aspera/fasp/parameters.yaml +7 -4
  63. data/lib/aspera/fasp/resume_policy.rb +8 -8
  64. data/lib/aspera/fasp/transfer_spec.rb +35 -2
  65. data/lib/aspera/fasp/uri.rb +7 -7
  66. data/lib/aspera/faspex_gw.rb +7 -5
  67. data/lib/aspera/hash_ext.rb +3 -3
  68. data/lib/aspera/id_generator.rb +5 -5
  69. data/lib/aspera/keychain/encrypted_hash.rb +38 -105
  70. data/lib/aspera/keychain/macos_security.rb +128 -57
  71. data/lib/aspera/log.rb +7 -7
  72. data/lib/aspera/nagios.rb +19 -18
  73. data/lib/aspera/node.rb +209 -35
  74. data/lib/aspera/oauth.rb +37 -36
  75. data/lib/aspera/open_application.rb +19 -11
  76. data/lib/aspera/persistency_action_once.rb +4 -4
  77. data/lib/aspera/persistency_folder.rb +16 -15
  78. data/lib/aspera/preview/file_types.rb +8 -8
  79. data/lib/aspera/preview/generator.rb +67 -67
  80. data/lib/aspera/preview/utils.rb +27 -27
  81. data/lib/aspera/proxy_auto_config.js +41 -41
  82. data/lib/aspera/proxy_auto_config.rb +21 -14
  83. data/lib/aspera/rest.rb +72 -67
  84. data/lib/aspera/rest_call_error.rb +2 -1
  85. data/lib/aspera/rest_error_analyzer.rb +18 -17
  86. data/lib/aspera/rest_errors_aspera.rb +16 -16
  87. data/lib/aspera/secret_hider.rb +15 -13
  88. data/lib/aspera/ssh.rb +11 -10
  89. data/lib/aspera/sync.rb +158 -44
  90. data/lib/aspera/temp_file_manager.rb +2 -2
  91. data/lib/aspera/uri_reader.rb +4 -4
  92. data/lib/aspera/web_auth.rb +14 -13
  93. data.tar.gz.sig +0 -0
  94. metadata +11 -36
  95. metadata.gz.sig +0 -0
data/lib/aspera/ssh.rb CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'net/ssh'
4
4
 
5
- # Hack: deactivate ed25519 and ecdsa private keys from ssh identities, as it usually hurts
5
+ # HACK: deactivate ed25519 and ecdsa private keys from ssh identities, as it usually hurts
6
6
  begin
7
- module Net;module SSH;module Authentication;class Session;private; def default_keys; %w[~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa];end;end;end;end;end # rubocop:disable Layout/AccessModifierIndentation, Layout/EmptyLinesAroundAccessModifier, Layout/LineLength
7
+ module Net; module SSH; module Authentication; class Session; private; def default_keys; %w[~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa]; end; end; end; end; end # rubocop:disable Layout/AccessModifierIndentation, Layout/EmptyLinesAroundAccessModifier, Layout/LineLength, Style/Semicolon
8
8
  rescue StandardError
9
9
  # ignore errors
10
10
  end
@@ -15,26 +15,26 @@ module Aspera
15
15
  class Ssh
16
16
  # ssh_options: same as Net::SSH.start
17
17
  # see: https://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
18
- def initialize(host,username,ssh_options)
19
- Log.log.debug("ssh:#{username}@#{host}")
20
- Log.log.debug("ssh_options:#{ssh_options}")
18
+ def initialize(host, username, ssh_options)
19
+ Log.log.debug{"ssh:#{username}@#{host}"}
20
+ Log.log.debug{"ssh_options:#{ssh_options}"}
21
21
  @host = host
22
22
  @username = username
23
23
  @ssh_options = ssh_options
24
24
  @ssh_options[:logger] = Log.log
25
25
  end
26
26
 
27
- def execute(cmd,input=nil)
27
+ def execute(cmd, input=nil)
28
28
  if cmd.is_a?(Array)
29
29
  # concatenate arguments, enclose in double quotes
30
30
  cmd = cmd.map{|v|%Q("#{v}")}.join(' ')
31
31
  end
32
- Log.log.debug("cmd=#{cmd}")
32
+ Log.log.debug{"cmd=#{cmd}"}
33
33
  response = []
34
34
  Net::SSH.start(@host, @username, @ssh_options) do |session|
35
35
  ssh_channel = session.open_channel do |channel|
36
36
  # prepare stdout processing
37
- channel.on_data{|_chan,data|response.push(data)}
37
+ channel.on_data{|_chan, data|response.push(data)}
38
38
  # prepare stderr processing, stderr if type = 1
39
39
  channel.on_extended_data do |_chan, _type, data|
40
40
  errormsg = "#{cmd}: [#{data.chomp}]"
@@ -45,13 +45,14 @@ module Aspera
45
45
  raise errormsg
46
46
  end
47
47
  # send commannd to SSH channel (execute)
48
- channel.send('cexe'.reverse,cmd){|_ch,_success|channel.send_data(input) unless input.nil?}
48
+ channel.send('cexe'.reverse, cmd){|_ch, _success|channel.send_data(input) unless input.nil?}
49
49
  end
50
50
  # wait for channel to finish (command exit)
51
51
  ssh_channel.wait
52
52
  # main ssh session loop
53
53
  session.loop
54
- end # session
54
+ end # start
55
+ # response as single string
55
56
  return response.join
56
57
  end
57
58
  end
data/lib/aspera/sync.rb CHANGED
@@ -1,90 +1,204 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'aspera/command_line_builder'
4
+ require 'aspera/fasp/installation'
5
+ require 'json'
6
+ require 'base64'
4
7
 
5
8
  module Aspera
6
9
  # builds command line arg for async
7
10
  class Sync
8
- INSTANCE_PARAMS =
11
+ PARAMS_VX_INSTANCE =
9
12
  {
10
13
  'alt_logdir' => { cltype: :opt_with_arg, accepted_types: :string},
11
14
  'watchd' => { cltype: :opt_with_arg, accepted_types: :string},
12
15
  'apply_local_docroot' => { cltype: :opt_without_arg},
13
- 'quiet' => { cltype: :opt_without_arg}
16
+ 'quiet' => { cltype: :opt_without_arg},
17
+ 'ws_connect' => { cltype: :opt_without_arg}
14
18
  }.freeze
15
- SESSION_PARAMS =
19
+
20
+ # map sync session parameters to transfer spec: sync -> ts, true if same
21
+ PARAMS_VX_SESSION =
16
22
  {
17
23
  'name' => { cltype: :opt_with_arg, accepted_types: :string},
18
24
  'local_dir' => { cltype: :opt_with_arg, accepted_types: :string},
19
25
  'remote_dir' => { cltype: :opt_with_arg, accepted_types: :string},
20
26
  'local_db_dir' => { cltype: :opt_with_arg, accepted_types: :string},
21
27
  'remote_db_dir' => { cltype: :opt_with_arg, accepted_types: :string},
22
- 'host' => { cltype: :opt_with_arg, accepted_types: :string},
23
- 'user' => { cltype: :opt_with_arg, accepted_types: :string},
24
- 'private_key_path' => { cltype: :opt_with_arg, accepted_types: :string},
28
+ 'host' => { cltype: :opt_with_arg, accepted_types: :string, ts: :remote_host},
29
+ 'user' => { cltype: :opt_with_arg, accepted_types: :string, ts: :remote_user},
30
+ 'private_key_paths' => { cltype: :opt_with_arg, accepted_types: :array, clswitch: '--private-key-path'},
25
31
  'direction' => { cltype: :opt_with_arg, accepted_types: :string},
26
32
  'checksum' => { cltype: :opt_with_arg, accepted_types: :string},
27
- 'tcp_port' => { cltype: :opt_with_arg, accepted_types: :int},
33
+ 'tags' => { cltype: :opt_with_arg, accepted_types: :hash, ts: true,
34
+ clswitch: '--tags64', clconvert: 'Aspera::Fasp::Parameters.clconv_json64'},
35
+ 'tcp_port' => { cltype: :opt_with_arg, accepted_types: :int, ts: :ssh_port},
28
36
  'rate_policy' => { cltype: :opt_with_arg, accepted_types: :string},
29
37
  'target_rate' => { cltype: :opt_with_arg, accepted_types: :string},
30
38
  'cooloff' => { cltype: :opt_with_arg, accepted_types: :int},
31
39
  'pending_max' => { cltype: :opt_with_arg, accepted_types: :int},
32
40
  'scan_intensity' => { cltype: :opt_with_arg, accepted_types: :string},
33
- 'cipher' => { cltype: :opt_with_arg, accepted_types: :string},
41
+ 'cipher' => { cltype: :opt_with_arg, accepted_types: :string, ts: true},
34
42
  'transfer_threads' => { cltype: :opt_with_arg, accepted_types: :int},
35
- 'preserve_time' => { cltype: :opt_without_arg},
36
- 'preserve_access_time' => { cltype: :opt_without_arg},
37
- 'preserve_modification_time' => { cltype: :opt_without_arg},
38
- 'preserve_uid' => { cltype: :opt_without_arg},
39
- 'preserve_gid' => { cltype: :opt_without_arg},
40
- 'create_dir' => { cltype: :opt_without_arg},
43
+ 'preserve_time' => { cltype: :opt_without_arg, ts: :preserve_times},
44
+ 'preserve_access_time' => { cltype: :opt_without_arg, ts: nil},
45
+ 'preserve_modification_time' => { cltype: :opt_without_arg, ts: nil},
46
+ 'preserve_uid' => { cltype: :opt_without_arg, ts: :preserve_file_owner_uid},
47
+ 'preserve_gid' => { cltype: :opt_without_arg, ts: :preserve_file_owner_gid},
48
+ 'create_dir' => { cltype: :opt_without_arg, ts: true},
41
49
  'reset' => { cltype: :opt_without_arg},
42
- # note: only one env var, but multiple sessions... may be a problem
43
- 'remote_password' => { cltype: :envvar, clvarname: 'ASPERA_SCP_PASS'},
44
- 'cookie' => { cltype: :envvar, clvarname: 'ASPERA_SCP_COOKIE'},
45
- 'token' => { cltype: :envvar, clvarname: 'ASPERA_SCP_TOKEN'},
50
+ # NOTE: only one env var, but multiple sessions... could be a problem
51
+ 'remote_password' => { cltype: :envvar, clvarname: 'ASPERA_SCP_PASS', ts: true},
52
+ 'cookie' => { cltype: :envvar, clvarname: 'ASPERA_SCP_COOKIE', ts: true},
53
+ 'token' => { cltype: :envvar, clvarname: 'ASPERA_SCP_TOKEN', ts: true},
46
54
  'license' => { cltype: :envvar, clvarname: 'ASPERA_SCP_LICENSE'}
47
55
  }.freeze
48
56
 
49
- Aspera::CommandLineBuilder.normalize_description(INSTANCE_PARAMS)
50
- Aspera::CommandLineBuilder.normalize_description(SESSION_PARAMS)
57
+ Aspera::CommandLineBuilder.normalize_description(PARAMS_VX_INSTANCE)
58
+ Aspera::CommandLineBuilder.normalize_description(PARAMS_VX_SESSION)
51
59
 
52
- private_constant :INSTANCE_PARAMS,:SESSION_PARAMS
60
+ PARAMS_VX_KEYS = %w[instance sessions].freeze
53
61
 
54
- def initialize(sync_params)
55
- @sync_params = sync_params
56
- end
62
+ TS_TO_PARAMS = {
63
+ 'remote_host' => 'remote.host',
64
+ 'remote_user' => 'remote.user',
65
+ 'remote_password' => 'remote.pass',
66
+ 'sshfp' => 'remote.fingerprint',
67
+ 'ssh_port' => 'remote.port',
68
+ 'wss_port' => 'remote.ws_port',
69
+ 'proxy' => 'remote.proxy',
70
+ 'token' => 'remote.token',
71
+ 'tags' => 'tags'
72
+ }.freeze
73
+
74
+ ASYNC_EXECUTABLE = 'async'
57
75
 
58
- MANDATORY_KEYS = %w[instance sessions].freeze
76
+ private_constant :PARAMS_VX_INSTANCE, :PARAMS_VX_SESSION, :PARAMS_VX_KEYS, :ASYNC_EXECUTABLE
59
77
 
60
- def compute_args
61
- raise StandardError,'parameter must be Hash' unless @sync_params.is_a?(Hash)
62
- raise StandardError,"parameter hash must have at least 'sessions', and optionally 'instance' keys." unless
63
- @sync_params.keys.push('instance').uniq.sort.eql?(MANDATORY_KEYS)
64
- raise StandardError,'sessions key must be Array' unless @sync_params['sessions'].is_a?(Array)
65
- raise StandardError,'sessions key must has at least one element (hash)' unless @sync_params['sessions'].first.is_a?(Hash)
78
+ class << self
79
+ def update_parameters_with_transfer_spec(sync_params, transfer_spec)
80
+ if sync_params.key?('local')
81
+ # async native JSON format
82
+ raise StandardError, 'local must be Hash' unless sync_params['local'].is_a?(Hash)
83
+ TS_TO_PARAMS.each do |ts_param, sy_path|
84
+ next unless transfer_spec.key?(ts_param)
85
+ sy_dig = sy_path.split('.')
86
+ param = sy_dig.pop
87
+ hash = sy_dig.empty? ? sync_params : sync_params[sy_dig.first]
88
+ hash = sync_params[sy_dig.first] = {} if hash.nil?
89
+ hash[param] = transfer_spec[ts_param]
90
+ end
91
+ # 'remote.path',
92
+ sync_params['remote']['connect_mode'] ||= sync_params['remote'].key?('ws_port') ? 'ws' : 'ssh'
93
+ sync_params['remote']['private_key_paths'] ||= Fasp::Installation.instance.bypass_keys if transfer_spec.key?('token')
94
+ sync_params['remote']['path'] ||= '/' if transfer_spec.dig(*%w[tags aspera node file_id])
95
+ elsif sync_params.key?('sessions')
96
+ sync_params['sessions'].each do |session|
97
+ PARAMS_VX_SESSION.each do |async_param, behaviour|
98
+ if behaviour.key?(:ts)
99
+ tspec_param = behaviour[:ts].is_a?(TrueClass) ? async_param : behaviour[:ts].to_s
100
+ session[async_param] ||= transfer_spec[tspec_param] if transfer_spec.key?(tspec_param)
101
+ end
102
+ end
103
+ session['private_key_paths'] = Fasp::Installation.instance.bypass_keys if transfer_spec.key?('token')
104
+ session['remote_dir'] = '/' if transfer_spec.dig(*%w[tags aspera node file_id])
105
+ end
106
+ else
107
+ raise 'At least one of `local` or `sessions` must be present in async parameters'
108
+ end
109
+ Log.dump(:sync, sync_params)
110
+ end
111
+ end
66
112
 
67
- env_args = {
113
+ attr_reader :env_args
114
+
115
+ def initialize(sync_params)
116
+ raise StandardError, 'parameter must be Hash' unless sync_params.is_a?(Hash)
117
+ @env_args = {
68
118
  args: [],
69
119
  env: {}
70
120
  }
121
+ if sync_params.key?('local')
122
+ # async native JSON format
123
+ raise StandardError, 'remote must be Hash' unless sync_params['remote'].is_a?(Hash)
124
+ @env_args[:args] = "--conf64=#{Base64.strict_encode64(JSON.generate(sync_params))}"
125
+ elsif sync_params.key?('sessions')
126
+ # ascli JSON format
127
+ raise StandardError, "Only 'sessions', and optionally 'instance' keys are allowed" unless
128
+ sync_params.keys.push('instance').uniq.sort.eql?(PARAMS_VX_KEYS)
129
+ raise StandardError, 'sessions key must be Array' unless sync_params['sessions'].is_a?(Array)
130
+ raise StandardError, 'sessions key requires at least one Hash' unless sync_params['sessions'].first.is_a?(Hash)
71
131
 
72
- if @sync_params.has_key?('instance')
73
- raise StandardError,'instance key must be hash' unless @sync_params['instance'].is_a?(Hash)
74
- instance_builder = CommandLineBuilder.new(@sync_params['instance'],INSTANCE_PARAMS)
75
- instance_builder.process_params
76
- instance_builder.add_env_args(env_args[:env],env_args[:args])
132
+ if sync_params.key?('instance')
133
+ raise StandardError, 'instance key must be Hash' unless sync_params['instance'].is_a?(Hash)
134
+ instance_builder = Aspera::CommandLineBuilder.new(sync_params['instance'], PARAMS_VX_INSTANCE)
135
+ instance_builder.process_params
136
+ instance_builder.add_env_args(@env_args[:env], @env_args[:args])
137
+ end
138
+
139
+ sync_params['sessions'].each do |session_params|
140
+ raise StandardError, 'sessions must contain hashes' unless session_params.is_a?(Hash)
141
+ raise StandardError, 'session must contain at leat name' unless session_params.key?('name')
142
+ session_builder = Aspera::CommandLineBuilder.new(session_params, PARAMS_VX_SESSION)
143
+ session_builder.process_params
144
+ session_builder.add_env_args(@env_args[:env], @env_args[:args])
145
+ end
146
+ else
147
+ raise 'At least one of `local` or `sessions` must be present in async parameters'
77
148
  end
149
+ end
78
150
 
79
- @sync_params['sessions'].each do |session_params|
80
- raise StandardError,'sessions must contain hashes' unless session_params.is_a?(Hash)
81
- raise StandardError,'session must contain at leat name' unless session_params.has_key?('name')
82
- session_builder = CommandLineBuilder.new(session_params,SESSION_PARAMS)
83
- session_builder.process_params
84
- session_builder.add_env_args(env_args[:env],env_args[:args])
151
+ def start
152
+ Log.log.debug{"execute: #{@env_args[:env].map{|k, v| "#{k}=\"#{v}\""}.join(' ')} \"#{ASYNC_EXECUTABLE}\" \"#{@env_args[:args].join('" "')}\""}
153
+ res = system(@env_args[:env], [ASYNC_EXECUTABLE, ASYNC_EXECUTABLE], *@env_args[:args])
154
+ Log.log.debug{"result=#{res}"}
155
+ case res
156
+ when true then return nil
157
+ when false then raise "failed: #{$CHILD_STATUS}"
158
+ when nil then raise "not started: #{$CHILD_STATUS}"
159
+ else raise 'internal error: unspecified case'
85
160
  end
161
+ end
162
+ end
163
+
164
+ class SyncAdmin
165
+ ASYNC_ADMIN_EXECUTABLE = 'asyncadmin'
166
+ private_constant :ASYNC_ADMIN_EXECUTABLE
167
+ def initialize(sync_params, session_name)
168
+ @cmdline = [ASYNC_ADMIN_EXECUTABLE, '--quiet']
169
+ if sync_params.key?('local')
170
+ raise 'Missing session name' if sync_params['name'].nil?
171
+ raise 'Session not found' unless session_name.nil? || session_name.eql?(sync_params['name'])
172
+ @cmdline.push("--name=#{sync_params['name']}")
173
+ if sync_params.key?('local_db_dir')
174
+ @cmdline.push("--local-db-dir=#{sync_params['local_db_dir']}")
175
+ elsif sync_params.dig('local', 'path')
176
+ @cmdline.push("--local-dir=#{sync_params.dig('local', 'path')}")
177
+ else
178
+ raise 'Missing either local_db_dir or local.path'
179
+ end
180
+ elsif sync_params.key?('sessions')
181
+ session = session_name.nil? ? sync_params['sessions'].first : sync_params['sessions'].find{|s|s['name'].eql?(session_name)}
182
+ raise 'Session not found' if session.nil?
183
+ raise 'Missing session name' if session['name'].nil?
184
+ @cmdline.push("--name=#{session['name']}")
185
+ if session.key?('local_db_dir')
186
+ @cmdline.push("--local-db-dir=#{session['local_db_dir']}")
187
+ elsif session.key?('local_dir')
188
+ @cmdline.push("--local-dir=#{session['local_dir']}")
189
+ else
190
+ raise 'Missing either local_db_dir or local_dir'
191
+ end
192
+ else
193
+ raise 'At least one of `local` or `sessions` must be present in async parameters'
194
+ end
195
+ end
86
196
 
87
- return env_args
197
+ def status
198
+ stdout, stderr, status = Open3.capture3(*@cmdline)
199
+ Log.log.debug{"status=#{status}, stderr=#{stderr}"}
200
+ raise "Sync failed: #{status.exitstatus} : #{stderr}" unless status.success?
201
+ return stdout.split("\n").each_with_object({}){|l, m|i = l.split(/: */); m[i.first.lstrip] = i.last.lstrip} # rubocop:disable Style/Semicolon
88
202
  end
89
203
  end
90
204
  end
@@ -11,7 +11,7 @@ module Aspera
11
11
  SEC_IN_DAY = 86_400
12
12
  # assume no transfer last longer than this
13
13
  # (garbage collect file list which were not deleted after transfer)
14
- FILE_LIST_AGE_MAX_SEC = 5 * SEC_IN_DAY
14
+ FILE_LIST_AGE_MAX_SEC = SEC_IN_DAY * 5
15
15
  private_constant :SEC_IN_DAY, :FILE_LIST_AGE_MAX_SEC
16
16
  include Singleton
17
17
  def initialize
@@ -53,7 +53,7 @@ module Aspera
53
53
  age_sec = (Time.now - File.stat(file_path).mtime).to_i
54
54
  # check age of file, delete too old
55
55
  if File.file?(file_path) && (age_sec > FILE_LIST_AGE_MAX_SEC)
56
- Log.log.debug("garbage collecting #{name}")
56
+ Log.log.debug{"garbage collecting #{name}"}
57
57
  File.delete(file_path)
58
58
  end
59
59
  end
@@ -10,12 +10,12 @@ module Aspera
10
10
  def read(uri_to_read)
11
11
  proxy_uri = URI.parse(uri_to_read)
12
12
  case proxy_uri.scheme
13
- when 'http','https'
14
- return Rest.new(base_url: uri_to_read,redirect_max: 5).call(operation: 'GET', subpath: '', headers: {'Accept' => 'text/plain'})[:data]
15
- when 'file',NilClass
13
+ when 'http', 'https'
14
+ return Rest.new(base_url: uri_to_read, redirect_max: 5).call(operation: 'GET', subpath: '', headers: {'Accept' => 'text/plain'})[:data]
15
+ when 'file', NilClass
16
16
  local_file_path = proxy_uri.path
17
17
  raise 'URL shall have a path, check syntax' if local_file_path.nil?
18
- local_file_path = File.expand_path(local_file_path.gsub(/^\//,'')) if /^\/(~|.|..)\//.match?(local_file_path)
18
+ local_file_path = File.expand_path(local_file_path.gsub(%r{^/}, '')) if %r{^/(~|.|..)/}.match?(local_file_path)
19
19
  return File.read(local_file_path)
20
20
  else
21
21
  raise "unknown scheme: [#{proxy_uri.scheme}] for [#{uri_to_read}]"
@@ -7,16 +7,16 @@ require 'stringio'
7
7
  module Aspera
8
8
  # servlet called on callback: it records the callback request
9
9
  class WebAuthServlet < WEBrick::HTTPServlet::AbstractServlet
10
- def initialize(server,application) # additional args get here
10
+ def initialize(server, application) # additional args get here
11
11
  Log.log.debug('WebAuthServlet initialize')
12
12
  super(server)
13
13
  @app = application
14
14
  end
15
15
 
16
16
  def service(request, response)
17
- Log.log.debug("received request from browser #{request.request_method} #{request.path}")
18
- raise WEBrick::HTTPStatus::MethodNotAllowed,"unexpected method: #{request.request_method}" unless request.request_method.eql?('GET')
19
- raise WEBrick::HTTPStatus::NotFound,"unexpected path: #{request.path}" unless request.path.eql?(@app.expected_path)
17
+ Log.log.debug{"received request from browser #{request.request_method} #{request.path}"}
18
+ raise WEBrick::HTTPStatus::MethodNotAllowed, "unexpected method: #{request.request_method}" unless request.request_method.eql?('GET')
19
+ raise WEBrick::HTTPStatus::NotFound, "unexpected path: #{request.path}" unless request.path.eql?(@app.expected_path)
20
20
  # acquire lock and signal change
21
21
  @app.mutex.synchronize do
22
22
  @app.query = request.query
@@ -30,7 +30,7 @@ module Aspera
30
30
  end # WebAuthServlet
31
31
 
32
32
  # generates and adds self signed cert to provided webrick options
33
- #def fill_self_signed_cert(cert,key)
33
+ # def fill_self_signed_cert(cert,key)
34
34
  # cert.subject = cert.issuer = OpenSSL::X509::Name.parse('/C=FR/O=Test/OU=Test/CN=Test')
35
35
  # cert.not_before = Time.now
36
36
  # cert.not_after = Time.now + 365 * 24 * 60 * 60
@@ -47,12 +47,13 @@ module Aspera
47
47
  # ]
48
48
  # cert.add_extension(ef.create_extension('authorityKeyIdentifier','keyid:always,issuer:always'))
49
49
  # cert.sign(key, OpenSSL::Digest::SHA256.new)
50
- #end
50
+ # end
51
51
 
52
52
  # start a local web server, then start a browser that will callback the local server upon authentication
53
53
  class WebAuth
54
- attr_reader :expected_path,:mutex,:cond
54
+ attr_reader :expected_path, :mutex, :cond
55
55
  attr_writer :query
56
+
56
57
  # @param endpoint_url [String] e.g. 'https://127.0.0.1:12345'
57
58
  def initialize(endpoint_url)
58
59
  uri = URI.parse(endpoint_url)
@@ -74,14 +75,14 @@ module Aspera
74
75
  when 'https'
75
76
  webrick_options[:SSLEnable] = true
76
77
  # a- automatic certificate generation
77
- webrick_options[:SSLCertName] = [['CN',WEBrick::Utils.getservername]]
78
+ webrick_options[:SSLCertName] = [['CN', WEBrick::Utils.getservername]]
78
79
  # b- generate self signed cert
79
- #webrick_options[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(4096)
80
- #webrick_options[:SSLCertificate] = OpenSSL::X509::Certificate.new
81
- #self.class.fill_self_signed_cert(webrick_options[:SSLCertificate],webrick_options[:SSLPrivateKey])
80
+ # webrick_options[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(4096)
81
+ # webrick_options[:SSLCertificate] = OpenSSL::X509::Certificate.new
82
+ # self.class.fill_self_signed_cert(webrick_options[:SSLCertificate],webrick_options[:SSLPrivateKey])
82
83
  ## c- good cert
83
- #webrick_options[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(File.read('.../myserver.key'))
84
- #webrick_options[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read('.../myserver.crt'))
84
+ # webrick_options[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(File.read('.../myserver.key'))
85
+ # webrick_options[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read('.../myserver.crt'))
85
86
  end
86
87
  # self signed certificate generates characters on STDERR, see create_self_signed_cert in webrick/ssl.rb
87
88
  Log.capture_stderr { @server = WEBrick::HTTPServer.new(webrick_options) }
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspera-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ZjkOWbUc1aLIsfaQFHWyNfisY9X2RgkFHjX0p5493wnoA7aWh52MUhc145npFh8z
36
36
  v4P9xwkT02Shkert4B4iwNvVjoAUGk+J4090svZCroAyXBjon5LV7MJ4fyw=
37
37
  -----END CERTIFICATE-----
38
- date: 2022-09-14 00:00:00.000000000 Z
38
+ date: 2023-01-26 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: execjs
@@ -89,14 +89,14 @@ dependencies:
89
89
  name: net-ssh
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '6.0'
95
95
  type: :runtime
96
96
  prerelease: false
97
97
  version_requirements: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '6.0'
102
102
  - !ruby/object:Gem::Dependency
@@ -128,19 +128,19 @@ dependencies:
128
128
  - !ruby/object:Gem::Version
129
129
  version: '2.0'
130
130
  - !ruby/object:Gem::Dependency
131
- name: security
131
+ name: symmetric-encryption
132
132
  requirement: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: '0.0'
136
+ version: '4.6'
137
137
  type: :runtime
138
138
  prerelease: false
139
139
  version_requirements: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '0.0'
143
+ version: '4.6'
144
144
  - !ruby/object:Gem::Dependency
145
145
  name: terminal-table
146
146
  requirement: !ruby/object:Gem::Requirement
@@ -197,20 +197,6 @@ dependencies:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
199
  version: '1.2'
200
- - !ruby/object:Gem::Dependency
201
- name: websocket-client-simple
202
- requirement: !ruby/object:Gem::Requirement
203
- requirements:
204
- - - "~>"
205
- - !ruby/object:Gem::Version
206
- version: '0.3'
207
- type: :runtime
208
- prerelease: false
209
- version_requirements: !ruby/object:Gem::Requirement
210
- requirements:
211
- - - "~>"
212
- - !ruby/object:Gem::Version
213
- version: '0.3'
214
200
  - !ruby/object:Gem::Dependency
215
201
  name: xml-simple
216
202
  requirement: !ruby/object:Gem::Requirement
@@ -225,20 +211,6 @@ dependencies:
225
211
  - - "~>"
226
212
  - !ruby/object:Gem::Version
227
213
  version: '1.0'
228
- - !ruby/object:Gem::Dependency
229
- name: grpc
230
- requirement: !ruby/object:Gem::Requirement
231
- requirements:
232
- - - "~>"
233
- - !ruby/object:Gem::Version
234
- version: '1.0'
235
- type: :development
236
- prerelease: false
237
- version_requirements: !ruby/object:Gem::Requirement
238
- requirements:
239
- - - "~>"
240
- - !ruby/object:Gem::Version
241
- version: '1.0'
242
214
  - !ruby/object:Gem::Dependency
243
215
  name: mimemagic
244
216
  requirement: !ruby/object:Gem::Requirement
@@ -388,6 +360,9 @@ executables:
388
360
  extensions: []
389
361
  extra_rdoc_files: []
390
362
  files:
363
+ - BUGS.md
364
+ - CHANGELOG.md
365
+ - CONTRIBUTING.md
391
366
  - README.md
392
367
  - bin/ascli
393
368
  - bin/asession
@@ -513,7 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
488
  version: '0'
514
489
  requirements:
515
490
  - Read the manual for any requirement
516
- rubygems_version: 3.1.6
491
+ rubygems_version: 3.4.1
517
492
  signing_key:
518
493
  specification_version: 4
519
494
  summary: 'Execute actions using command line on IBM Aspera Server products: Aspera
metadata.gz.sig CHANGED
Binary file