asperalm 0.9.29 → 0.9.30

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
  SHA256:
3
- metadata.gz: f713640fca529449d4a6d3b3dc830464e88fec962ca005ef4cbd12f064031e9a
4
- data.tar.gz: c6e5534e9460fcbd016c12b576e5fba78a67184176d780d052730020a43f0c2a
3
+ metadata.gz: 215d521013760c765b9c6a58121898a4c88e4d5323a6b68eaf3530798be956fe
4
+ data.tar.gz: 73c05b162709493bd3bc95c4ba2be81fa381e9e795ea1d3849ddb8a7b78b88fb
5
5
  SHA512:
6
- metadata.gz: ec71f16fbf3453c281c5b83e2aead98346b2e09311dbf616ad94aa71e1b19443b462c8111007b3298327ed36293c3844e20e33bd973f84097cca3c703e7ad1e4
7
- data.tar.gz: ac270c1e06764717b17dbc3ab5ec4c1fc7cf11e81cca22e3b665262656325dd15028b90b82734aebaebf8e175896b9d56b82016091b755f1e702e70e8c369756
6
+ metadata.gz: 5c508a681866937109b5ef46589b606d197d4330a7d0c565c23d3ca4976d2466db4c4b59e278f94f7cb685e40baf67769fe3de2dd70210229c6e94e4ad08704d
7
+ data.tar.gz: dc6c6523977005ce8f81bf7821ec8fe9a1f5a4cb04e5117942b957c89c1b08dc7132d1d6bbf568e780d0e63f9eaed5766198f775112900482487f90484a7c005
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Asperalm - A Ruby library for Aspera transfers and "Amelia", the _Multi Layer IBM Aspera_ Command Line Tool
2
2
 
3
- Version : 0.9.29
3
+ Version : 0.9.30
4
4
 
5
5
 
6
6
  _Laurent/2016-2018_
@@ -37,7 +37,7 @@ Once the gem is installed, `mlia` shall be accessible:
37
37
 
38
38
  ```bash
39
39
  $ mlia --version
40
- 0.9.29
40
+ 0.9.30
41
41
  ```
42
42
 
43
43
  ## First use
@@ -1049,9 +1049,12 @@ mlia faspex package recv --to-folder=sample_dest_folder --id=ALL --once-only=yes
1049
1049
  mlia faspex package send --delivery-info=@json:'{"title":"'"$(PACKAGE_TITLE)"'","recipients":["laurent.martin.aspera@fr.ibm.com"]}' --sources=@args sample_file.bin
1050
1050
  mlia faspex recv_publink 'https://faspex.mycompany.com/aspera/faspex/external_deliveries/78780?passcode=a003aaf2f53e3869126b908525084db6bebc7031' --insecure=yes
1051
1051
  mlia faspex source name "Server Files" node br /
1052
+ mlia node async --id=1 bandwidth
1052
1053
  mlia node async --id=1 counters
1053
- mlia node async --id=1 summary
1054
+ mlia node async --id=1 files
1054
1055
  mlia node async list
1056
+ mlia node async show --id=1
1057
+ mlia node async show --id=ALL
1055
1058
  mlia node browse / -r
1056
1059
  mlia node delete sample_dest_folder200KB.1
1057
1060
  mlia node download --to-folder=sample_dest_folder --sources=@args sample_dest_folder200KB.1
@@ -1112,7 +1115,7 @@ mlia sync start --parameters=@json:'{"sessions":[{"name":"test","reset":true,"re
1112
1115
  ```bash
1113
1116
  $ mlia -h
1114
1117
  NAME
1115
- mlia -- a command line tool for Aspera Applications (v0.9.29)
1118
+ mlia -- a command line tool for Aspera Applications (v0.9.30)
1116
1119
 
1117
1120
  SYNOPSIS
1118
1121
  mlia COMMANDS [OPTIONS] [ARGS]
@@ -1199,6 +1202,7 @@ OPTIONS:
1199
1202
  --password=VALUE user's password
1200
1203
  --validator=VALUE identifier of validator (optional for central)
1201
1204
  --asperabrowserurl=VALUE URL for simple aspera web ui
1205
+ --name=VALUE sync name
1202
1206
 
1203
1207
 
1204
1208
  COMMAND: orchestrator
@@ -1 +1 @@
1
- 0.9.29
1
+ 0.9.30
@@ -15,7 +15,7 @@ module Asperalm
15
15
  unless env[:skip_basic_auth_options]
16
16
  self.options.add_opt_simple(:validator,"identifier of validator (optional for central)")
17
17
  self.options.add_opt_simple(:asperabrowserurl,"URL for simple aspera web ui")
18
- #self.options.set_option(:value,'@json:{"active_only":false}')
18
+ self.options.add_opt_simple(:name,"sync name")
19
19
  self.options.set_option(:asperabrowserurl,'https://asperabrowser.mybluemix.net')
20
20
  self.options.parse_options!
21
21
  end
@@ -69,11 +69,6 @@ module Asperalm
69
69
  return c_result_remove_prefix_path(resres,type,path_prefix)
70
70
  end
71
71
 
72
- def c_delete_files(paths_to_delete,prefix_path)
73
- resp=@api_node.create('files/delete',{:paths=>paths_to_delete.map{|i| {'path'=>i.start_with?('/') ? i : '/'+i} }})
74
- return c_result_translate_rem_prefix(resp,'file','deleted',prefix_path)
75
- end
76
-
77
72
  # get path arguments from command line, and add prefix
78
73
  def get_next_arg_add_prefix(path_prefix,name,number=:single)
79
74
  thepath=self.options.get_next_argument(name,number)
@@ -116,7 +111,8 @@ module Asperalm
116
111
  return { :type=>:single_object, :data => node_info, :textify => lambda { |table_data| c_textify_bool_list_result(table_data,['capabilities','settings'])}}
117
112
  when :delete
118
113
  paths_to_delete = get_next_arg_add_prefix(prefix_path,"file list",:multiple)
119
- return c_delete_files(paths_to_delete,prefix_path)
114
+ resp=@api_node.create('files/delete',{:paths=>paths_to_delete.map{|i| {'path'=>i.start_with?('/') ? i : '/'+i} }})
115
+ return c_result_translate_rem_prefix(resp,'file','deleted',prefix_path)
120
116
  when :space
121
117
  # TODO: could be a list of path
122
118
  path_list=get_next_arg_add_prefix(prefix_path,"folder path or ext.val. list")
@@ -178,30 +174,88 @@ module Asperalm
178
174
  end
179
175
  end
180
176
 
177
+ def execute_async
178
+ command=self.options.get_next_command([:list,:delete,:files,:show,:counters,:bandwidth])
179
+ unless command.eql?(:list)
180
+ asyncname=self.options.get_option(:name,:optional)
181
+ if asyncname.nil?
182
+ asyncid=self.options.get_option(:id,:mandatory)
183
+ if asyncid.eql?('ALL') and [:show,:delete].include?(command)
184
+ asyncids=@api_node.read('async/list')[:data]['sync_ids']
185
+ else
186
+ Integer(asyncid) # must be integer
187
+ asyncids=[asyncid]
188
+ end
189
+ else
190
+ asyncids=@api_node.read('async/list')[:data]['sync_ids']
191
+ summaries=@api_node.create('async/summary',{'syncs' => asyncids})[:data]['sync_summaries']
192
+ selected=summaries.select{|s|s['name'].eql?(asyncname)}.first
193
+ raise "no such sync: #{asyncname}" if selected.nil?
194
+ asyncid=selected['snid']
195
+ asyncids=[asyncid]
196
+ end
197
+ pdata={'syncs' => asyncids}
198
+ end
199
+ case command
200
+ when :list
201
+ resp=@api_node.read('async/list')[:data]['sync_ids']
202
+ return { :type => :value_list, :data => resp, :name=>'id' }
203
+ when :show
204
+ resp=@api_node.create('async/summary',pdata)[:data]['sync_summaries']
205
+ return Main.result_empty if resp.empty?
206
+ if asyncid.eql?('ALL')
207
+ return { :type => :object_list, :data => resp, :fields => ['snid','name','local_dir','remote_dir'] }
208
+ else
209
+ return { :type => :single_object, :data => resp.first }
210
+ end
211
+ when :delete
212
+ resp=@api_node.create('async/delete',pdata)[:data]
213
+ return { :type => :single_object, :data => resp, :name=>'id' }
214
+ when :bandwidth
215
+ pdata['seconds']=100 # TODO: as parameter with --value
216
+ resp=@api_node.create('async/bandwidth',pdata)[:data]
217
+ data=resp['bandwidth_data']
218
+ return Main.result_empty if data.empty?
219
+ data=data.first[asyncid]['data']
220
+ return { :type => :object_list, :data => data, :name=>'id' }
221
+ when :files
222
+ # count int
223
+ # filename str
224
+ # skip int
225
+ # status int
226
+ filter=self.options.get_option(:value,:optional)
227
+ pdata.merge!(filter) unless filter.nil?
228
+ resp=@api_node.create('async/files',pdata)[:data]
229
+ data=resp['sync_files']
230
+ data=data.first[asyncid] unless data.empty?
231
+ iteration_data=[]
232
+ skip_ids_persistency=nil
233
+ if self.options.get_option(:once_only,:mandatory)
234
+ skip_ids_persistency=PersistencyFile.new(
235
+ data: iteration_data,
236
+ ids: ['sync_files',self.options.get_option(:url,:mandatory),self.options.get_option(:username,:mandatory),asyncid])
237
+ unless iteration_data.first.nil?
238
+ data.select!{|l| l['fnid'].to_i>iteration_data.first}
239
+ end
240
+ iteration_data[0]=data.last['fnid'].to_i unless data.empty?
241
+ end
242
+ return Main.result_empty if data.empty?
243
+ skip_ids_persistency.save unless skip_ids_persistency.nil?
244
+ return { :type => :object_list, :data => data, :name=>'id' }
245
+ when :counters
246
+ resp=@api_node.create('async/counters',pdata)[:data]["sync_counters"].first[asyncid].last
247
+ return Main.result_empty if resp.nil?
248
+ return { :type => :single_object, :data => resp }
249
+ end
250
+ end
251
+
181
252
  ACTIONS=[ :postprocess,:stream, :transfer, :cleanup, :forward, :access_key, :watch_folder, :service, :async, :central, :asperabrowser ].concat(COMMON_ACTIONS)
182
253
 
183
254
  def execute_action(command=nil,prefix_path=nil)
184
255
  command||=self.options.get_next_command(ACTIONS)
185
256
  case command
186
257
  when *COMMON_ACTIONS; return execute_simple_common(command,prefix_path)
187
- when :async
188
- command=self.options.get_next_command([:list,:summary,:counters])
189
- if [:summary,:counters].include?(command)
190
- asyncid=self.options.get_option(:id,:mandatory)
191
- end
192
- case command
193
- when :list
194
- resp=@api_node.read('async/list')[:data]['sync_ids']
195
- return { :type => :value_list, :data => resp, :name=>'id' }
196
- when :summary
197
- resp=@api_node.create('async/summary',{"syncs"=>[asyncid]})[:data]["sync_summaries"].first
198
- return Main.result_empty if resp.nil?
199
- return { :type => :single_object, :data => resp }
200
- when :counters
201
- resp=@api_node.create('async/counters',{"syncs"=>[asyncid]})[:data]["sync_counters"].first[asyncid].last
202
- return Main.result_empty if resp.nil?
203
- return { :type => :single_object, :data => resp }
204
- end
258
+ when :async; return execute_async()
205
259
  when :stream
206
260
  command=self.options.get_next_command([ :list, :create, :show, :modify, :cancel ])
207
261
  case command
@@ -94,7 +94,9 @@ module Asperalm
94
94
  else
95
95
  1.upto(multi_session) do |i|
96
96
  # do deep copy (each thread has its own copy because it is modified here below and in thread)
97
- this_session=Marshal.load(Marshal.dump(session))
97
+ this_session=session.clone()
98
+ this_session[:env_args]=this_session[:env_args].clone()
99
+ this_session[:env_args][:args]=this_session[:env_args][:args].clone()
98
100
  this_session[:env_args][:args].unshift("-C#{i}:#{multi_session}")
99
101
  # check if this is necessary ? should be handled by server, this is in man page
100
102
  this_session[:env_args][:args].unshift("-O","#{multi_session_udp_port_base+i-1}")
@@ -47,7 +47,8 @@ module Asperalm
47
47
  started=false
48
48
  # lets emulate management events to display progress bar
49
49
  loop do
50
- trdata=node_api_.read("ops/transfers/#{@transfer_id}")[:data]
50
+ # status is empty sometimes with status 200...
51
+ trdata=node_api_.read("ops/transfers/#{@transfer_id}")[:data] rescue {"status"=>"waiting"}
51
52
  case trdata['status']
52
53
  when 'completed'
53
54
  notify_listeners('emulated',{'Type'=>'DONE'})
@@ -102,9 +102,10 @@ module Asperalm
102
102
  Log.log.info "new saved token is #{@token_cache[api_scope]['access_token']}"
103
103
  end
104
104
 
105
- # get location of cache for token
105
+ # get location of cache for token, using some unique filename
106
106
  def token_filepath(api_scope)
107
- parts=[@params[:client_id],URI.parse(@params[:base_url]).host.downcase.gsub(/[^a-z]+/,'_'),@params[:grant],api_scope]
107
+ oauth_uri=URI.parse(@params[:base_url])
108
+ parts=[oauth_uri.host.downcase.gsub(/[^a-z]+/,'_'),oauth_uri.path.downcase.gsub(/[^a-z]+/,'_'),@params[:grant],api_scope]
108
109
  parts.push(@params[:user_name]) if @params.has_key?(:user_name)
109
110
  basename=parts.dup.unshift(TOKEN_FILE_PREFIX).join(TOKEN_FILE_SEPARATOR)
110
111
  # remove windows forbidden chars
@@ -81,8 +81,8 @@ module Asperalm
81
81
 
82
82
  attr_reader :secrets
83
83
 
84
- # @param send or receive
85
- # @return upload or download
84
+ # @param send or receive (FASP transfer direction)
85
+ # @return upload or download (tag for AoC)
86
86
  def direction_to_operation(direction)
87
87
  case direction
88
88
  when 'send'; return 'upload'
@@ -7,6 +7,7 @@ module Asperalm
7
7
  'alt_logdir' => { :type => :opt_with_arg, :accepted_types=>String},
8
8
  'watchd' => { :type => :opt_with_arg, :accepted_types=>String},
9
9
  'apply_local_docroot' => { :type => :opt_without_arg},
10
+ 'quiet' => { :type => :opt_without_arg},
10
11
  }
11
12
  SESSION_PARAMS=
12
13
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asperalm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.29
4
+ version: 0.9.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-simple
@@ -154,9 +154,6 @@ dependencies:
154
154
  name: bundler
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '1.0'
160
157
  - - ">"
161
158
  - !ruby/object:Gem::Version
162
159
  version: '1.14'
@@ -164,9 +161,6 @@ dependencies:
164
161
  prerelease: false
165
162
  version_requirements: !ruby/object:Gem::Requirement
166
163
  requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '1.0'
170
164
  - - ">"
171
165
  - !ruby/object:Gem::Version
172
166
  version: '1.14'
@@ -177,9 +171,6 @@ dependencies:
177
171
  - - ">"
178
172
  - !ruby/object:Gem::Version
179
173
  version: '10.0'
180
- - - "~>"
181
- - !ruby/object:Gem::Version
182
- version: '10.0'
183
174
  type: :development
184
175
  prerelease: false
185
176
  version_requirements: !ruby/object:Gem::Requirement
@@ -187,9 +178,6 @@ dependencies:
187
178
  - - ">"
188
179
  - !ruby/object:Gem::Version
189
180
  version: '10.0'
190
- - - "~>"
191
- - !ruby/object:Gem::Version
192
- version: '10.0'
193
181
  - !ruby/object:Gem::Dependency
194
182
  name: rspec
195
183
  requirement: !ruby/object:Gem::Requirement
@@ -317,6 +305,6 @@ requirements:
317
305
  rubygems_version: 3.0.3
318
306
  signing_key:
319
307
  specification_version: 4
320
- summary: 'gem and command line tool for Aspera Server products: Aspera Files, Faspex,
321
- Shares, Node, Console, Orchestrator, Server, ATS'
308
+ summary: 'gem and command line tool for Aspera Server products: Aspera on Cloud, Faspex,
309
+ Shares, Node, Console, Orchestrator, Transfer Server'
322
310
  test_files: []