asperalm 0.6.18 → 0.6.20

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
- SHA1:
3
- metadata.gz: 71a511326fe6b3db67a963ff48cdc2d29e5d9dd9
4
- data.tar.gz: 8f155625034576a97be79de18f44536ef001c4cc
2
+ SHA256:
3
+ metadata.gz: 56113b109f399e3ae58a2b2f3e923948e73b697698c447eee3af5ee77f0c2bd8
4
+ data.tar.gz: e1caa5077034deaba2a3be19221d151995dc51124072f8e31db7e56b75e5c011
5
5
  SHA512:
6
- metadata.gz: 1e5e61e005c6f09207f6e7247328545d93aa652119942bbf360301a773586b5f41d6de1351bcd569170d501daafcc1ae6d4c2d303f084cd88ca9ce4478f9f5c8
7
- data.tar.gz: 6c367bcce5df7b48c05876c522b956c9e574ffc034bb3ae6055cfe95873c3d83da40565987582a2b30008c48c484d285f9142ac9d52e2d55ec5cb023029c432b
6
+ metadata.gz: 49a0605315f53b01077cf5c3172023bf8eb5fc230579481e04f8cd3afc49ba58a4c2a73f1203d2087979b742ec96e52b932a098bd91cefb3cc50ba62c34e7018
7
+ data.tar.gz: 9f00b9521fa58767a53d3c52f77f00111022d5824c7542183c1f92afbcce663e29f0495ea5b97b5f80de39998a28e29539c3edf6e67ba4c78f278c75d397745f
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Asperalm - Laurent's Aspera Command Line Interface and Ruby Library
2
2
 
3
- Version : 0.6.18
3
+ Version : 0.6.20
4
4
 
5
5
 
6
6
  _Laurent/2016-2018_
@@ -163,32 +163,42 @@ The value of options and arguments is evaluated with the [Extended Value Syntax]
163
163
 
164
164
  ### Options
165
165
 
166
- Options are command line arguments starting with a `-`. Options can be optional or mandatory, with or without (hardcoded) default value. Most options take a value, but a limited number of them are without values (e.g. `-r`). Options can be placed anywhere on comand line and evaluated in order.
166
+ All options, e.g. `--log-level=debug`, are command line arguments that:
167
167
 
168
- The special option "--" is ignored but stops option processing, subsequent values are taken as arguments, including the ones starting with a `-`.
168
+ * start with `--`
169
+ * have a name, in lowercase, using `-` as word separator in name (e.g. `--log-level=debug`)
170
+ * have a value, separated from name with a `=`
171
+ * can be used by prefix, provided that it is unique. E.g. `--log-l=debug` is the same as `--log-level=debug`
169
172
 
170
- The value for _any_ options can come from the following locations:
173
+ Exceptions:
174
+
175
+ * some options accept a short form, e.g. `-Ptoto` is equivalent to `--preset=toto`, refer to the manual or `-h`.
176
+ * some options (flags) don't take a value, e.g. `-r`
177
+ * the special option `--` stops option processing and is ignored, following command line arguments are taken as arguments, including the ones starting with a `-`. Example:
178
+
179
+ ```
180
+ $ aslmcli config echo -- --sample
181
+ "--sample"
182
+ ```
183
+
184
+ Note that `--sample` is taken as an argument, and not option.
185
+
186
+ Options can be optional or mandatory, with or without (hardcoded) default value. Options can be placed anywhere on comand line and evaluated in order.
187
+
188
+ The value for _any_ options can come from the following locations (in this order, last value evaluated overrides previous value):
171
189
 
172
- * Command line
173
190
  * [Configuration file](#configfile).
174
191
  * Environment variable
192
+ * Command line
175
193
 
176
194
  Environment variable starting with prefix: ASLMCLI_ are taken as option values,
177
- i.e. `ASLMCLI_OPTION_NAME` is for `--option-name`.
195
+ e.g. `ASLMCLI_OPTION_NAME` is for `--option-name`.
178
196
 
179
197
  Options values can be displayed for a given command by providing the `--show-config` option: `aslmcli node --show-config`
180
198
 
181
- Evaluation of a parameter value follow this order:
182
-
183
- * configuration file
184
- * environment variable
185
- * command line
186
-
187
- The last value evaluated is the one taken.
188
-
189
199
  ### Commands and Arguments
190
200
 
191
- Command line arguments not starting with `-` are either commands or arguments (as well as command line arguments following `--`).
201
+ Command line arguments that are not options are either commands or arguments. If an argument must begin with `-`, then either use the `@val:` syntax (see [Extended Values](#extended)), or use the `--` separator (see above).
192
202
 
193
203
  ## Interactive Input
194
204
 
@@ -674,25 +684,26 @@ aslmcli aspera files upload sample_file.bin --to-folder=/
674
684
  aslmcli aspera packages list
675
685
  aslmcli aspera packages recv BJKyUFHhew
676
686
  aslmcli aspera packages send sample_file.bin --note="my note" --title="my title" --recipient="laurent.martin.aspera@fr.ibm.com"
687
+ aslmcli ats access_key --id=testkey2 cluster
688
+ aslmcli ats access_key --id=testkey2 delete
689
+ aslmcli ats access_key --id=testkey2 node browse /
690
+ aslmcli ats access_key --id=testkey3 delete
677
691
  aslmcli ats access_key create --cloud=aws --region=eu-west-1 --params=@json:'{"id":"testkey3","name":"laurent key AWS","storage":{"type":"aws_s3","bucket":"sedemo-ireland","credentials":{"access_key_id":"AKIAIDSWKOSIM7XUVCJA","secret_access_key":"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"},"path":"/laurent"}}'
678
692
  aslmcli ats access_key create --cloud=softlayer --region=ams --params=@json:'{"id":"testkey2","name":"laurent key","storage":{"type":"softlayer_swift","container":"laurent","credentials":{"api_key":"my_api_key_here","username":"my_username_here"},"path":"/"}}'
679
- aslmcli ats access_key id testkey2 delete
680
- aslmcli ats access_key id testkey2 node browse /
681
- aslmcli ats access_key id testkey2 server
682
- aslmcli ats access_key id testkey3 delete
683
693
  aslmcli ats access_key list --fields=name,id,secret
684
- aslmcli ats api_key list
685
- aslmcli ats api_key repository list
686
- aslmcli ats server id 1f412ae7-869a-445c-9c05-02ad16813be2
687
- aslmcli ats server list clouds
688
- aslmcli ats server list instance --cloud=aws --region=eu-west-1
689
- aslmcli ats server list provisioned
690
- aslmcli ats subscriptions
694
+ aslmcli ats cluster clouds
695
+ aslmcli ats cluster list
696
+ aslmcli ats cluster show --cloud=aws --region=eu-west-1
697
+ aslmcli ats cluster show --id=1f412ae7-869a-445c-9c05-02ad16813be2
698
+ aslmcli ats credential cache list
699
+ aslmcli ats credential list
700
+ aslmcli ats credential subscriptions
701
+ aslmcli client available
691
702
  aslmcli client connect id 'Aspera Connect for Windows' info
692
703
  aslmcli client connect id 'Aspera Connect for Windows' links id 'Windows Installer' download --to-folder=.
693
704
  aslmcli client connect id 'Aspera Connect for Windows' links list
694
705
  aslmcli client connect list
695
- aslmcli client location
706
+ aslmcli client current
696
707
  aslmcli config id conf_name delete
697
708
  aslmcli config id conf_name initialize @json:'{"p1":"v1","p2":"v2"}'
698
709
  aslmcli config id conf_name set param value
@@ -762,7 +773,7 @@ aslmcli shares2 userinfo
762
773
  ```bash
763
774
  $ aslmcli -h
764
775
  NAME
765
- aslmcli -- a command line tool for Aspera Applications (v0.6.18)
776
+ aslmcli -- a command line tool for Aspera Applications (v0.6.20)
766
777
 
767
778
  SYNOPSIS
768
779
  aslmcli COMMANDS [OPTIONS] [ARGS]
@@ -789,13 +800,14 @@ OPTIONS: global
789
800
  --interactive=ENUM use interactive input of missing params: yes, no
790
801
  --ask-options=ENUM ask even optional options: yes, no
791
802
  --config-file=VALUE read parameters from file in YAML format, current=/Users/laurent/.aspera/aslmcli/config.yaml
803
+ --table-style=VALUE table display style, current=:.:
792
804
  -h, --help Show this message.
793
805
  --show-config Display parameters used for the provided action.
794
806
  -r, --rest-debug more debug for HTTP calls
795
807
  -N, --no-default do not load default configuration
796
808
  -v, --version display version
797
809
  --ui=ENUM method to start browser: text, graphical
798
- --log-level=ENUM Log level: warn, debug, info, error, fatal, unknown
810
+ --log-level=ENUM Log level: debug, info, error, warn, fatal, unknown
799
811
  --logger=ENUM log method: stderr, stdout, syslog
800
812
  --format=ENUM output format: table, ruby, json, jsonpp, yaml, csv
801
813
  --transfer=ENUM type of transfer: direct, connect, node
@@ -844,7 +856,7 @@ SUBCOMMANDS: packages, files, faspexgw, admin, user
844
856
  OPTIONS:
845
857
  --download-mode=ENUM download mode: fasp, node_http
846
858
  --auth=ENUM type of Oauth authentication: basic, web, jwt, url_token
847
- --bulk=ENUM bulk operation: no, yes
859
+ --bulk=ENUM bulk operation: yes, no
848
860
  --url=VALUE URL of application, e.g. http://org.asperafiles.com
849
861
  --username=VALUE username to log in
850
862
  --password=VALUE user's password
@@ -872,15 +884,17 @@ OPTIONS:
872
884
  --persistency=VALUE persistency file (cleanup,forward)
873
885
 
874
886
  COMMAND: ats
875
- SUBCOMMANDS: server, api_key, subscriptions, access_key
887
+ SUBCOMMANDS: cluster, access_key, credential
876
888
  OPTIONS:
877
889
  --ats-id=VALUE ATS key identifier (ats_xxx)
878
- --params=VALUE Parameters hash for access key (@json:)
890
+ --id=VALUE Access key identifier, or server id, or api key id
891
+ --secret=VALUE Access key secret
892
+ --params=VALUE Parameters access key creation (@json:)
879
893
  --cloud=VALUE Cloud provider
880
894
  --region=VALUE Cloud region
881
895
 
882
896
  COMMAND: client
883
- SUBCOMMANDS: installation, monitor, location, connect
897
+ SUBCOMMANDS: current, available, connect
884
898
  OPTIONS:
885
899
 
886
900
  COMMAND: faspex
@@ -1046,7 +1060,7 @@ Define this preset as default configuration for the `aspera` plugin:
1046
1060
  $ aslmcli config id default set aspera my_aoc_org
1047
1061
  ```
1048
1062
 
1049
- Note: Default `auth` method is `web` and default `redirect_uri` is `htt^://localhost:12345`.
1063
+ Note: Default `auth` method is `web` and default `redirect_uri` is `http://localhost:12345`.
1050
1064
 
1051
1065
  ### <a name="aocfirst"></a>First Use
1052
1066
 
@@ -1339,14 +1353,14 @@ $ aslmcli node access_key create --value=@json:'{"id":"eudemo-sedemo","secret":"
1339
1353
 
1340
1354
  The `client` plugin refers to the use of a local FASP client. It provides the following commands:
1341
1355
 
1342
- * `connect list` : list connect client versions available on internet
1343
- * `installation list` : list Aspera transfer products found locally
1344
- * `client location` : list resources used for transfers
1356
+ * `current` : list current resources used for transfers
1357
+ * `available` : list Aspera transfer products available locally
1358
+ * `connect` : list,download connect client versions available on internet
1345
1359
 
1346
1360
  ### List installed clients
1347
1361
 
1348
1362
  ```bash
1349
- $ aslmcli client installation list
1363
+ $ aslmcli client available
1350
1364
  :..........................:................................................:
1351
1365
  : name : app_root :
1352
1366
  :..........................:................................................:
@@ -1355,10 +1369,10 @@ $ aslmcli client installation list
1355
1369
  :..........................:................................................:
1356
1370
  ```
1357
1371
 
1358
- ### List resources used
1372
+ ### List current resources used
1359
1373
 
1360
1374
  ```
1361
- $ aslmcli client location
1375
+ $ aslmcli current
1362
1376
  :........................:............................................................................................:
1363
1377
  : name : path :
1364
1378
  :........................:............................................................................................:
@@ -1760,10 +1774,25 @@ This means that you do not have ruby support for ED25519 SSH keys. You may eithe
1760
1774
  Gems, or remove your ed25519 key from your `.ssh` folder to solve the issue.
1761
1775
 
1762
1776
  # Release Notes
1763
- Version 0.6.18
1777
+ * Version 0.6.19
1778
+
1779
+ Breaking change:
1780
+
1781
+ * ats server list provisioned -> ats cluster list
1782
+ * ats server list clouds -> ats cluster clouds
1783
+ * ats server list instance --cloud=x --region=y -> ats cluster show --cloud=x --region=y
1784
+ * ats server id xxx -> aslmcli ats cluster show --id=xxx
1785
+ * ats subscriptions -> ats credential subscriptions
1786
+ * ats api_key repository list -> ats credential cache list
1787
+ * ats api_key list -> ats credential list
1788
+ * ats access_key id xxx -> ats access_key --id=xxx
1789
+
1790
+ * Version 0.6.18
1791
+
1764
1792
  some commands take now --id option instead of id command.
1765
1793
 
1766
- Version 0.6.15
1794
+ * Version 0.6.15
1795
+ *
1767
1796
  Breaking change: "files" application renamed to "aspera" (for "Aspera on Cloud"). "repository" renamed to "files". Default is automatically reset, e.g. in config files and change key "files" to "aspera" in preset "default".
1768
1797
 
1769
1798
  # TODO
@@ -24,7 +24,7 @@ module Asperalm
24
24
  singleton_class.send(:alias_method, :tool, :instance)
25
25
  def self.version;return @@TOOL_VERSION;end
26
26
  private
27
- @@TOOL_VERSION='0.6.18'
27
+ @@TOOL_VERSION='0.6.20'
28
28
  # first level command for the main tool
29
29
  @@MAIN_PLUGIN_NAME_SYM=:config
30
30
  # name of application, also foldername where config is stored
@@ -147,6 +147,7 @@ module Asperalm
147
147
  # TODO: option to choose progress format
148
148
  # here we disable native stdout progress
149
149
  @transfer_spec_default['EX_quiet']=true
150
+ Log.log.debug(">>>>#{@transfer_spec_default}".red)
150
151
  when :connect
151
152
  @transfer_agent_singleton=Fasp::Client::Connect.new
152
153
  when :node
@@ -178,14 +179,15 @@ module Asperalm
178
179
  @transfer_agent_singleton=Fasp::Client::Node.new(Rest.new(sym_config[:url],{:auth=>{:type=>:basic,:username=>sym_config[:username], :password=>sym_config[:password]}}))
179
180
  else raise "ERROR"
180
181
  end
181
- @transfer_agent_singleton.add_listener(Fasp::ListenerLogger.new)
182
- @transfer_agent_singleton.add_listener(Fasp::ListenerProgress.new)
182
+ @transfer_agent_singleton.add_listener(Fasp::ListenerLogger.new,:struct)
183
+ @transfer_agent_singleton.add_listener(Fasp::ListenerProgress.new,:struct)
183
184
  end
184
185
  return @transfer_agent_singleton
185
186
  end
186
187
 
187
188
  attr_accessor :option_flat_hash
188
189
  attr_accessor :option_config_file
190
+ attr_accessor :option_table_style
189
191
 
190
192
  # minimum initialization
191
193
  def initialize
@@ -201,6 +203,7 @@ module Asperalm
201
203
  @plugin_lookup_folders=[]
202
204
  @config_folder=File.join(Dir.home,@@ASPERA_HOME_FOLDER_NAME,@@PROGRAM_NAME)
203
205
  @option_config_file=File.join(@config_folder,@@DEFAULT_CONFIG_FILENAME)
206
+ @option_table_style=':.:'
204
207
  # set folders for temp files
205
208
  Fasp::Parameters.file_list_folder=File.join(@config_folder,'filelists')
206
209
  Oauth.file_list_folder=@config_folder
@@ -240,7 +243,9 @@ module Asperalm
240
243
  @opt_mgr.parser.separator "OPTIONS: global"
241
244
  @opt_mgr.declare_options_scan_env
242
245
  @opt_mgr.set_obj_attr(:config_file,self,:option_config_file)
246
+ @opt_mgr.set_obj_attr(:table_style,self,:option_table_style)
243
247
  @opt_mgr.add_opt_simple(:config_file,"read parameters from file in YAML format, current=#{@option_config_file}")
248
+ @opt_mgr.add_opt_simple(:table_style,"table display style, current=#{@option_table_style}")
244
249
  @opt_mgr.add_opt_switch(:help,"Show this message.","-h") { @option_help=true }
245
250
  @opt_mgr.add_opt_switch(:show_config, "Display parameters used for the provided action.") { @option_show_config=true }
246
251
  @opt_mgr.add_opt_switch(:rest_debug,"-r","more debug for HTTP calls") { Rest.set_debug(true) }
@@ -311,18 +316,42 @@ module Asperalm
311
316
  return r
312
317
  end
313
318
 
314
- def self.flatten_one_config(source,prefix='',dest=nil)
315
- dest={} if dest.nil?
319
+ def self.keyval_list_flatten_sub_hash(source,keep_last)
320
+ newval=flatten_sub_hash_rec(source,keep_last,'',{})
321
+ source.clear
322
+ source.merge!(newval)
323
+ end
324
+
325
+ def self.flatten_sub_hash_rec(source,keep_last,prefix,dest)
326
+ #is_simple_hash=source.is_a?(Hash) and source.values.inject(true){|m,v| xxx=!v.respond_to?(:each) and m;puts("->#{xxx}>#{v.respond_to?(:each)} #{v}-");xxx}
327
+ is_simple_hash=false
328
+ Log.log.debug("(#{keep_last})[#{is_simple_hash}] -#{source.values}- \n-#{source}-")
329
+ return source if keep_last and is_simple_hash
316
330
  source.each do |k,v|
317
- unless v.is_a?(Hash)
318
- dest[prefix+k.to_s]=v
331
+ #Process.exit(1)
332
+ if v.is_a?(Hash) and ( !keep_last or !is_simple_hash )
333
+ flatten_sub_hash_rec(v,keep_last,prefix+k.to_s+'.',dest)
319
334
  else
320
- flatten_one_config(v,prefix+k.to_s+'.',dest)
335
+ dest[prefix+k.to_s]=v
321
336
  end
322
337
  end
323
338
  return dest
324
339
  end
325
340
 
341
+ # special for Aspera on Cloud dis play node
342
+ # "param" => [{"name"=>"foo","value"=>"bar"}] will be expanded to param.foo : bar
343
+ def self.keyval_list_flatten_name_value_list(hash)
344
+ hash.keys.each do |k|
345
+ v=hash[k]
346
+ if v.is_a?(Array) and v.map{|i|i.class}.uniq.eql?([Hash]) and v.map{|i|i.keys}.flatten.sort.uniq.eql?(["name", "value"])
347
+ v.each do |pair|
348
+ hash["#{k}.#{pair["name"]}"]=pair["value"]
349
+ end
350
+ hash.delete(k)
351
+ end
352
+ end
353
+ end
354
+
326
355
  # supported output formats
327
356
  def self.display_formats; [:table,:ruby,:json,:jsonpp,:yaml,:csv]; end
328
357
 
@@ -337,7 +366,8 @@ module Asperalm
337
366
 
338
367
  # comma separated list in string format
339
368
  user_asked_fields_list_str=@opt_mgr.get_option(:fields,:mandatory)
340
- case @opt_mgr.get_option(:format,:mandatory)
369
+ display_format=@opt_mgr.get_option(:format,:mandatory)
370
+ case display_format
341
371
  when :ruby
342
372
  puts PP.pp(results[:data],'')
343
373
  when :json
@@ -348,34 +378,33 @@ module Asperalm
348
378
  puts results[:data].to_yaml
349
379
  when :table,:csv
350
380
  case results[:type]
351
- when :hash_array
381
+ when :hash_array # goes to table display
352
382
  raise "internal error: unexpected type: #{results[:data].class}, expecting Array" unless results[:data].is_a?(Array)
353
383
  # :hash_array is an array of hash tables, where key=colum name
354
- table_data = results[:data]
355
- out_table_columns=nil
384
+ table_rows_hash_val = results[:data]
385
+ final_table_columns=nil
356
386
  case user_asked_fields_list_str
357
387
  when FIELDS_DEFAULT
358
388
  if results.has_key?(:fields) and !results[:fields].nil?
359
- out_table_columns=results[:fields]
389
+ final_table_columns=results[:fields]
360
390
  else
361
- if !table_data.empty?
362
- out_table_columns=table_data.first.keys
391
+ if !table_rows_hash_val.empty?
392
+ final_table_columns=table_rows_hash_val.first.keys
363
393
  else
364
- out_table_columns=['empty']
394
+ final_table_columns=['empty']
365
395
  end
366
396
  end
367
397
  when FIELDS_ALL
368
- raise "empty" if table_data.empty?
369
- out_table_columns=table_data.first.keys if table_data.is_a?(Array)
398
+ raise "empty" if table_rows_hash_val.empty?
399
+ final_table_columns=table_rows_hash_val.first.keys if table_rows_hash_val.is_a?(Array)
370
400
  else
371
- out_table_columns=user_asked_fields_list_str.split(',')
372
- out_table_columns=out_table_columns.map{|i|i.to_sym} if results[:symb_key]
401
+ final_table_columns=user_asked_fields_list_str.split(',')
402
+ final_table_columns=final_table_columns.map{|i|i.to_sym} if results[:symb_key]
373
403
  end
374
- when :key_val_list
375
- # :key_val_list is a simple hash table
404
+ when :key_val_list # goes to table display
405
+ # :key_val_list is a simple hash table (can be nested)
376
406
  raise "internal error: unexpected type: #{results[:data].class}, expecting Hash" unless results[:data].is_a?(Hash)
377
- out_table_columns = results[:columns]
378
- out_table_columns = ['key','value'] if out_table_columns.nil?
407
+ final_table_columns = results[:columns] || ['key','value']
379
408
  asked_fields=results[:data].keys
380
409
  case user_asked_fields_list_str
381
410
  when FIELDS_DEFAULT;asked_fields=results[:fields] if results.has_key?(:fields)
@@ -385,48 +414,53 @@ module Asperalm
385
414
  asked_fields=asked_fields.map{|i|i.to_sym} if results[:symb_key]
386
415
  end
387
416
  if @option_flat_hash
388
- results[:data]=self.class.flatten_one_config(results[:data])
417
+ self.class.keyval_list_flatten_sub_hash(results[:data],results[:option_expand_last])
418
+ self.class.keyval_list_flatten_name_value_list(results[:data])
419
+ # first level keys are potentially changed
389
420
  asked_fields=results[:data].keys
390
421
  end
391
- table_data=asked_fields.map { |i| { out_table_columns.first => i, out_table_columns.last => results[:data][i] } }
392
- when :value_list
422
+ table_rows_hash_val=asked_fields.map { |i| { final_table_columns.first => i, final_table_columns.last => results[:data][i] } }
423
+ when :value_list # goes to table display
393
424
  # :value_list is a simple array of values, name of column provided in the :name
394
- out_table_columns = [results[:name]]
395
- table_data=results[:data].map { |i| { results[:name] => i } }
396
- when :empty
425
+ final_table_columns = [results[:name]]
426
+ table_rows_hash_val=results[:data].map { |i| { results[:name] => i } }
427
+ when :empty # no table
397
428
  puts "empty"
398
429
  return
399
- when :status
430
+ when :status # no table
400
431
  # :status displays a simple message
401
432
  puts results[:data]
402
433
  return
403
- when :other_struct
434
+ when :other_struct # no table
404
435
  # :other_struct is any other type of structure
405
436
  puts PP.pp(results[:data],'')
406
437
  return
407
438
  else
408
439
  raise "unknown data type: #{results[:type]}"
409
440
  end
410
- raise "no field specified" if out_table_columns.nil?
411
- if table_data.empty?
412
- puts "empty".gray
441
+ raise "no field specified" if final_table_columns.nil?
442
+ if table_rows_hash_val.empty?
443
+ puts "empty".gray unless display_format.eql?(:csv)
413
444
  return
414
445
  end
415
- # convert to string with special function. here table_data is an array of hash
416
- table_data=results[:textify].call(table_data) if results.has_key?(:textify)
446
+ # convert to string with special function. here table_rows_hash_val is an array of hash
447
+ table_rows_hash_val=results[:textify].call(table_rows_hash_val) if results.has_key?(:textify)
417
448
  # convert data to string, and keep only display fields
418
- table_data=table_data.map { |r| out_table_columns.map { |c| r[c].to_s } }
419
- case @opt_mgr.get_option(:format,:mandatory)
449
+ final_table_rows=table_rows_hash_val.map { |r| final_table_columns.map { |c| r[c].to_s } }
450
+ # here : final_table_columns : list of column names
451
+ # here: final_table_rows : array of list of value
452
+ case display_format
420
453
  when :table
454
+ style=@option_table_style.split('')
421
455
  # display the table !
422
456
  puts Text::Table.new(
423
- :head => out_table_columns,
424
- :rows => table_data,
425
- :vertical_boundary => '.',
426
- :horizontal_boundary => ':',
427
- :boundary_intersection => ':')
457
+ :head => final_table_columns,
458
+ :rows => final_table_rows,
459
+ :horizontal_boundary => style[0],
460
+ :vertical_boundary => style[1],
461
+ :boundary_intersection => style[2])
428
462
  when :csv
429
- puts table_data.map{|t| t.join(FIELD_SEPARATOR)}.join(RECORD_SEPARATOR)
463
+ puts final_table_rows.map{|t| t.join(FIELD_SEPARATOR)}.join(RECORD_SEPARATOR)
430
464
  end
431
465
  end
432
466
  end
@@ -633,6 +667,8 @@ module Asperalm
633
667
  def early_debug_setup(argv)
634
668
  argv.each do |arg|
635
669
  case arg
670
+ when '--'
671
+ return
636
672
  when /^--log-level=(.*)/
637
673
  Log.level = $1.to_sym
638
674
  when /^--logger=(.*)/
@@ -669,15 +705,29 @@ module Asperalm
669
705
  end
670
706
 
671
707
  # plugins shall use this method to start a transfer
672
- # set_default_destination if destination_root shall be used from the provided transfer spec
708
+ # @param: ts_source specifies how destination_root is set
673
709
  # and not the default one
674
- def start_transfer(transfer_spec,set_default_destination=true)
675
- if set_default_destination
710
+ def start_transfer(transfer_spec,ts_source)
711
+ # initialize transfert agent, to set default transfer spec options before merge
712
+ transfer_agent
713
+ case transfer_spec['direction']
714
+ when 'receive'
715
+ # init default if required in any case
676
716
  destination_folder(transfer_spec['direction'])
677
- else
678
- # in that case, destination is set in return by application (API/upload_setup)
679
- # but to_folder was used in intial api call
680
- @transfer_spec_default.delete('destination_root')
717
+ when 'send'
718
+ case ts_source
719
+ when :direct
720
+ # init default if required
721
+ destination_folder(transfer_spec['direction'])
722
+ when :node_gen3
723
+ # in that case, destination is set in return by application (API/upload_setup)
724
+ # but to_folder was used in intial api call
725
+ @transfer_spec_default.delete('destination_root')
726
+ when :node_gen4
727
+ @transfer_spec_default['destination_root']='/'
728
+ else
729
+ raise StandardError,"InternalError: unsupported value: #{ts_source}"
730
+ end
681
731
  end
682
732
 
683
733
  transfer_spec.merge!(@transfer_spec_default)