asperalm 0.9.25 → 0.9.26

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: 8afcea9cc622d5476770c52d004651d7a41f954ee15fe4887601dfa95cad1a71
4
- data.tar.gz: ed2d08c76ed1cd4c7b256ec2d37fed12f8581e561fdd4a0e35998ed65aeff462
3
+ metadata.gz: b72fd05a8120312aa381b94521eb3b67df168bff087634b9a158bfbaeb0eabe2
4
+ data.tar.gz: 49573bed78dcdda8a0a555e82bb3dd07710d20f19fd09d7edbfc6e3d2308df32
5
5
  SHA512:
6
- metadata.gz: 6a610b087542245c167378c34571077d7624e4776922179b59a3b51e29a01eeddf97bea08d0f2880c65480f401f4c8ef13cc3f54d25c0223fde957fd9c3c06e7
7
- data.tar.gz: 0ee1a55a78c071fa9e720f988afa8044cfec76a8445372673489499e36cd8f0972700fc4d4b0844d1b5dce87d94c25452ba18421e2d085d2e77da85a51949181
6
+ metadata.gz: 2e3b84f53203fab586f97d50719a616f905010ea2c4dcc10ca5242cab6634aef0fff13f5825f5c90f9f58f097665c07a5637647670ec31d9e82123453e89ddfd
7
+ data.tar.gz: f50419e3e7a8ce66622d6b262e45b5f5a912b1ef2e5c5d3645b06b62f9a41d52168e40a901d6737eea6e83b708464241fb265b8fdc60621a4466947e0e7424d7
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.25
3
+ Version : 0.9.26
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.25
40
+ 0.9.26
41
41
  ```
42
42
 
43
43
  ## First use
@@ -929,7 +929,7 @@ A non complete list of commands used in unit tests:
929
929
  ```bash
930
930
  $ mlia -h
931
931
  NAME
932
- mlia -- a command line tool for Aspera Applications (v0.9.25)
932
+ mlia -- a command line tool for Aspera Applications (v0.9.26)
933
933
 
934
934
  COMMAND: config
935
935
  SUBCOMMANDS: gem_path, genkey, plugins, flush_tokens, list, overview, open, echo, id, documentation, wizard, export_to_cli, detect, coffee, ascp
@@ -2258,6 +2258,11 @@ Gems, or remove your ed25519 key from your `.ssh` folder to solve the issue. Not
2258
2258
 
2259
2259
  # Release Notes
2260
2260
 
2261
+ * version 0.9.26
2262
+
2263
+ * table display with --fields=ALL now includes all column names from all lines, not only first one
2264
+ * unprocessed argument shows error even if there is an error beforehand
2265
+
2261
2266
  * version 0.9.25
2262
2267
 
2263
2268
  * the option `value` of command `find`, to filter on name, is not optional
data/lib/asperalm/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.25
1
+ 0.9.26
@@ -8,7 +8,9 @@ module Asperalm
8
8
  class Logger < Fasp::Listener
9
9
  def event_struct(data)
10
10
  Log.log.debug(data.to_s)
11
+ Log.log.error(">>>>#{data['Description']}") if data['Type'].eql?('FILEERROR')
11
12
  end
13
+
12
14
  def event_enhanced(data)
13
15
  Log.log.debug(JSON.generate(data))
14
16
  end
@@ -292,7 +292,10 @@ module Asperalm
292
292
  end
293
293
  when FIELDS_ALL
294
294
  raise "empty" if table_rows_hash_val.empty?
295
- final_table_columns=table_rows_hash_val.first.keys if table_rows_hash_val.is_a?(Array)
295
+ if table_rows_hash_val.is_a?(Array)
296
+ # get the list of all column names used in all lines, not just frst one, as all lines may have different columns
297
+ final_table_columns=table_rows_hash_val.inject({}){|m,v|v.keys.each{|c|m[c]=true};m}.keys
298
+ end
296
299
  else
297
300
  final_table_columns=user_asked_fields_list_str.split(',')
298
301
  end
@@ -491,7 +494,6 @@ module Asperalm
491
494
  display_results(command_plugin.execute_action)
492
495
  # finish
493
496
  @plugin_env[:transfer].shutdown
494
- @opt_mgr.fail_if_unprocessed
495
497
  rescue CliBadArgument => e; exception_info=[e,'Argument',:usage]
496
498
  rescue CliNoSuchId => e; exception_info=[e,'Identifier']
497
499
  rescue CliError => e; exception_info=[e,'Tool',:usage]
@@ -503,6 +505,9 @@ module Asperalm
503
505
  end
504
506
  # cleanup file list files
505
507
  TempFileManager.instance.cleanup
508
+ @opt_mgr.final_errors.each do |msg|
509
+ @plugin_env[:formater].display_message(:error,"ERROR:".bg_red.gray.blink+" Argument: "+msg)
510
+ end
506
511
  # processing of error condition
507
512
  unless exception_info.nil?
508
513
  @plugin_env[:formater].display_message(:error,"ERROR:".bg_red.gray.blink+" "+exception_info[1]+": "+exception_info[0].message)
@@ -351,10 +351,12 @@ module Asperalm
351
351
  return @unprocessed_cmd_line_arguments.empty?
352
352
  end
353
353
 
354
- def fail_if_unprocessed
355
- # unprocessed options or arguments ?
356
- raise CliBadArgument,"unprocessed options: #{@unprocessed_cmd_line_options}" unless @unprocessed_cmd_line_options.empty?
357
- raise CliBadArgument,"unprocessed values: #{@unprocessed_cmd_line_arguments}" unless @unprocessed_cmd_line_arguments.empty?
354
+ # unprocessed options or arguments ?
355
+ def final_errors
356
+ result=[]
357
+ result.push("unprocessed options: #{@unprocessed_cmd_line_options}") unless @unprocessed_cmd_line_options.empty?
358
+ result.push("unprocessed values: #{@unprocessed_cmd_line_arguments}") unless @unprocessed_cmd_line_arguments.empty?
359
+ return result
358
360
  end
359
361
 
360
362
  # get all original options on command line used to generate a config in config file
@@ -56,11 +56,10 @@ module Asperalm
56
56
  update_aoc_api
57
57
  end
58
58
 
59
- # add some tags and then starts transfer using agent
59
+ # starts transfer using agent
60
+ # adds workspace info for activity tracking
60
61
  def transfer_start(api_aoc,app,direction,node_file,ts_add)
61
- # activity tracking
62
- ts_add.deep_merge!({'tags'=>{'aspera'=>{'files'=>{'workspace_name'=>@workspace_name}}}})
63
- return self.transfer.start(*api_aoc.tr_spec(app,direction,node_file,@workspace_id,ts_add))
62
+ return self.transfer.start(*api_aoc.tr_spec(app,direction,node_file,@workspace_id,@workspace_name,ts_add))
64
63
  end
65
64
 
66
65
  def execute_node_gen4_action(top_node_file)
@@ -241,16 +241,15 @@ module Asperalm
241
241
  when 'DONE'
242
242
  return
243
243
  when 'ERROR'
244
- e=Fasp::Error.new(last_status_event['Description'],last_status_event['Code'].to_i)
245
- Log.log.error("code: #{e.err_code}") if e.respond_to?(:err_code)
246
- if e.message =~ /bearer token/i
244
+ Log.log.error("code: #{last_status_event['Code']}")
245
+ if last_status_event['Description'] =~ /bearer token/i
247
246
  Log.log.error("need to regenrate token".red)
248
247
  if !session.nil? and session[:options].is_a?(Hash) and session[:options].has_key?(:regenerate_token)
249
248
  # regenerate token here, expired, or error on it
250
249
  env_args[:env]['ASPERA_SCP_TOKEN']=session[:options][:regenerate_token].call(true)
251
250
  end
252
251
  end
253
- raise e
252
+ raise Fasp::Error.new(last_status_event['Description'],last_status_event['Code'].to_i)
254
253
  else
255
254
  raise "INTERNAL ERROR: unexpected last event"
256
255
  end
@@ -332,7 +331,7 @@ module Asperalm
332
331
  rescue => e
333
332
  session[:state]=:failed
334
333
  session[:error]=e
335
- Log.log.error("#{e.message}:\n#{e..backtrace}".red)
334
+ Log.log.error("#{e.class}:\n#{e.message}:\n#{e.backtrace.join("\n")}".red) if Log.instance.level.eql?(:debug)
336
335
  ensure
337
336
  @mutex.synchronize do
338
337
  # ensure id is set to unblock start procedure
@@ -89,7 +89,7 @@ module Asperalm
89
89
  # build "transfer info", 2 elements array with:
90
90
  # - transfer spec for aspera on cloud, based on node information and file id
91
91
  # - source and token regeneration method
92
- def tr_spec(app,direction,node_file,ws_id,ts_add)
92
+ def tr_spec(app,direction,node_file,ws_id,ws_name,ts_add)
93
93
  # the rest end point is used to generate the bearer token
94
94
  token_generation_method=lambda {|do_refresh|self.oauth_token(scope: self.class.node_scope(node_file[:node_info]['access_key'],SCOPE_NODE_USER), refresh: do_refresh)}
95
95
  # note xfer_id and xfer_retry are set by the transfer agent itself
@@ -103,22 +103,25 @@ module Asperalm
103
103
  'tags' => {
104
104
  'aspera' => {
105
105
  'app' => app,
106
- 'usage_id' => "aspera.files.workspace.#{ws_id}",
106
+ 'usage_id' => "aspera.files.workspace.#{ws_id}", # activity tracking
107
107
  'files' => {
108
108
  'node_id' => node_file[:node_info]['id'],
109
109
  'files_transfer_action' => "#{direction_to_operation(direction)}_#{app.gsub(/s$/,'')}",
110
110
  'workspace_id' => ws_id,
111
- },
111
+ 'workspace_name' => ws_name # activity tracking
112
+ }, # files
112
113
  'node' => {
113
114
  'access_key' => node_file[:node_info]['access_key'],
114
- 'file_id' => node_file[:file_id] }
115
- }
116
- }}.deep_merge!(ts_add),{
115
+ 'file_id' => node_file[:file_id]
116
+ } # node
117
+ } # aspera
118
+ } # tags
119
+ }.deep_merge!(ts_add),{
117
120
  :src => :node_gen4,
118
121
  :regenerate_token => token_generation_method
119
122
  }
120
123
  end
121
-
124
+
122
125
  # returns a node API for access key
123
126
  # no scope: requires secret
124
127
  # if secret present: use it
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.25
4
+ version: 0.9.26
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-03-11 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-simple