Skip to content

Commit

Permalink
issue #20 : custom SDK URL
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent-martin committed Mar 16, 2021
1 parent 500db78 commit ad9bc20
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
17 changes: 13 additions & 4 deletions docs/README.erb.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,27 @@ To check manually:

## <a name="fasp_prot"></a>FASP Protocol

Most file transfers will be done using the FASP protocol. Only two additional files are required to perform
an Aspera Transfer:
Most file transfers will be done using the FASP protocol, using `ascp`.
Only two additional files are required to perform an Aspera Transfer, which are part of Aspera SDK:

* ascp
* aspera-license (in same folder, or ../etc)

This can be installed directly with
This can be installed either be installing an Aspera transfer sofware, or using an embedded command:

```
$ <%=cmd%> conf ascp install
```

Those can be found in one of IBM Aspera transfer server or client with its license file (some are free):
If a local SDK installation is prefered instead of fetching from internet: one can specify the location of the SDK file:

```
$ <%=cmd%> conf ascp install --sdk-url=file:///SDK.zip
```

The format is: `file:///<path>`, where `<path>` can be either a relative path (not starting with `/`), or an absolute path.

If the embedded method is not used, the following packages are also suitable:

* IBM Aspera Connect Client (Free)
* IBM Aspera Desktop Client (Free)
Expand Down Expand Up @@ -2729,6 +2737,7 @@ So, it evolved into <%=tool%>:

* renamed command `nagios_check` to `health`
* agent `http_gw` now supports upload
* added option `sdk_url`

* 4.0.0

Expand Down
4 changes: 3 additions & 1 deletion lib/aspera/cli/plugins/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ def initialize(env,tool_name,help_url,version)
self.options.add_opt_simple(:default,"set as default configuration for specified plugin")
self.options.add_opt_simple(:secret,"access key secret for node")
self.options.add_opt_simple(:secrets,"access key secret for node")
self.options.add_opt_simple(:sdk_url,"URL to get SDK")
self.options.add_opt_boolean(:test_mode,"skip user validation in wizard mode")
self.options.add_opt_simple(:version_check_days,Integer,"period to check neew version in days (zero to disable)")
self.options.set_option(:use_generic_client,true)
self.options.set_option(:test_mode,false)
self.options.set_option(:version_check_days,7)
self.options.set_option(:sdk_url,'https://eudemo.asperademo.com/aspera/faspex/sdk.zip')
self.options.parse_options!
raise CliBadArgument,"secrets shall be Hash" unless @option_secrets.is_a?(Hash)
end
Expand Down Expand Up @@ -524,7 +526,7 @@ def execute_action_ascp
return {:type=>:status, :data=>"saved to default global preset #{preset_name}"}
end
when :install
v=Fasp::Installation.instance.install_sdk
v=Fasp::Installation.instance.install_sdk(self.options.get_option(:sdk_url,:mandatory))
return {:type=>:status, :data=>"Installed version #{v}"}
end
raise "unexpected case: #{command}"
Expand Down
13 changes: 9 additions & 4 deletions lib/aspera/fasp/installation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,16 @@ def bypass_keys
return [:ssh_bypass_key_dsa,:ssh_bypass_key_rsa].map{|i|Installation.instance.path(i)}
end

def install_sdk
def install_sdk(sdk_url)
require 'zip'
sdk_zip_path=File.join(Dir.tmpdir,'sdk.zip')
Aspera::Rest.new(base_url: SDK_URL).call(operation: 'GET',save_to_file: sdk_zip_path)
if sdk_url.start_with?('file:')
# require specific file scheme: the path part is "relative", or absolute if there are 4 slash
raise 'use format: file:///<path>' unless sdk_url.start_with?('file:///')
sdk_zip_path=sdk_url.gsub(%r{^file:///},'')
else
Aspera::Rest.new(base_url: sdk_url).call(operation: 'GET',save_to_file: sdk_zip_path)
end
filter="/#{Environment.architecture}/"
ascp_path=nil
# first ensure license file is here so that ascp invokation for version works
Expand Down Expand Up @@ -220,9 +226,8 @@ def install_sdk
PRODUCT_INFO='product-info.mf'
# policy for product selection
FIRST_FOUND='FIRST'
SDK_URL='https://eudemo.asperademo.com/aspera/faspex/sdk.zip'

private_constant :BIN_SUBFOLDER,:ETC_SUBFOLDER,:VARRUN_SUBFOLDER,:PRODUCT_INFO,:SDK_URL
private_constant :BIN_SUBFOLDER,:ETC_SUBFOLDER,:VARRUN_SUBFOLDER,:PRODUCT_INFO

# get some specific folder from specific applications: Connect or CLI
def get_product_folders(name)
Expand Down

0 comments on commit ad9bc20

Please sign in to comment.