aspera-cli 4.28.0 → 4.29.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/BUGS.md +5 -10
- data/CHANGELOG.md +217 -2
- data/CODE_OF_CONDUCT.md +18 -0
- data/CONTRIBUTING.md +135 -56
- data/GOVERNANCE.md +30 -0
- data/LICENSE +201 -0
- data/README.md +122 -26
- data/SECURITY.md +84 -0
- data/bin/ascli +8 -5
- data/bin/asession +9 -6
- data/docs/README.md +1895 -632
- data/docs/test-mcp-with-ai.md +8 -8
- data/lib/aspera/agent/base.rb +23 -2
- data/lib/aspera/agent/connect.rb +16 -12
- data/lib/aspera/agent/desktop.rb +10 -7
- data/lib/aspera/agent/direct.rb +20 -19
- data/lib/aspera/agent/factory.rb +6 -3
- data/lib/aspera/agent/httpgw.rb +7 -5
- data/lib/aspera/agent/node.rb +15 -7
- data/lib/aspera/agent/transferd.rb +167 -43
- data/lib/aspera/api/alee.rb +4 -1
- data/lib/aspera/api/aoc.rb +14 -11
- data/lib/aspera/api/ats.rb +4 -2
- data/lib/aspera/api/cos_node.rb +7 -4
- data/lib/aspera/api/faspex.rb +16 -9
- data/lib/aspera/api/httpgw.rb +9 -6
- data/lib/aspera/api/node.rb +29 -22
- data/lib/aspera/ascmd.rb +8 -5
- data/lib/aspera/ascp/installation.rb +95 -67
- data/lib/aspera/ascp/log.schema.yaml +1084 -0
- data/lib/aspera/ascp/log_analyzer/advice.rb +97 -0
- data/lib/aspera/ascp/log_analyzer/diagnostics.rb +344 -0
- data/lib/aspera/ascp/log_analyzer/lines.rb +75 -0
- data/lib/aspera/ascp/log_analyzer/log_file.rb +593 -0
- data/lib/aspera/ascp/log_analyzer/records.rb +379 -0
- data/lib/aspera/ascp/log_analyzer/rules.rb +172 -0
- data/lib/aspera/ascp/log_analyzer/session.rb +782 -0
- data/lib/aspera/ascp/log_analyzer.rb +370 -0
- data/lib/aspera/ascp/log_locations.rb +163 -0
- data/lib/aspera/ascp/management.rb +16 -8
- data/lib/aspera/ascp/session_errors.rb +217 -0
- data/lib/aspera/assert.rb +4 -0
- data/lib/aspera/cli/ascp_actions.rb +12 -19
- data/lib/aspera/cli/ascp_logs_actions.rb +188 -0
- data/lib/aspera/cli/async_transfer_store.rb +7 -4
- data/lib/aspera/cli/bootstrapper.rb +38 -33
- data/lib/aspera/cli/command_line.rb +63 -8
- data/lib/aspera/cli/command_registry.rb +9 -1
- data/lib/aspera/cli/command_spec.rb +47 -7
- data/lib/aspera/cli/completion/ascli.bash +19 -5
- data/lib/aspera/cli/completion/ascli.fish +13 -2
- data/lib/aspera/cli/completion/ascli.ps1 +31 -9
- data/lib/aspera/cli/completion/ascli.zsh +22 -6
- data/lib/aspera/cli/completion_actions.rb +303 -69
- data/lib/aspera/cli/context.rb +9 -4
- data/lib/aspera/cli/deprecation.rb +5 -2
- data/lib/aspera/cli/error.rb +6 -0
- data/lib/aspera/cli/extended_value.rb +66 -31
- data/lib/aspera/cli/formatter.rb +43 -30
- data/lib/aspera/cli/gem_checker.rb +9 -6
- data/lib/aspera/cli/hints.rb +22 -10
- data/lib/aspera/cli/http.rb +38 -10
- data/lib/aspera/cli/info.rb +12 -7
- data/lib/aspera/cli/mailer.rb +6 -3
- data/lib/aspera/cli/mcp/http_servlet.rb +7 -8
- data/lib/aspera/cli/mcp/secrets.rb +8 -5
- data/lib/aspera/cli/mcp/tool.rb +20 -17
- data/lib/aspera/cli/option_declarator.rb +10 -4
- data/lib/aspera/cli/option_registry.rb +6 -3
- data/lib/aspera/cli/option_types.rb +17 -2
- data/lib/aspera/cli/option_value.rb +77 -18
- data/lib/aspera/cli/options.schema.yaml +641 -80
- data/lib/aspera/cli/parser.rb +71 -35
- data/lib/aspera/cli/plugins/alee.rb +7 -4
- data/lib/aspera/cli/plugins/aoc.rb +248 -37
- data/lib/aspera/cli/plugins/ats.rb +10 -9
- data/lib/aspera/cli/plugins/base.rb +50 -18
- data/lib/aspera/cli/plugins/basic_auth.rb +5 -2
- data/lib/aspera/cli/plugins/config.rb +210 -104
- data/lib/aspera/cli/plugins/console.rb +6 -3
- data/lib/aspera/cli/plugins/cos.rb +8 -4
- data/lib/aspera/cli/plugins/factory.rb +21 -7
- data/lib/aspera/cli/plugins/faspex5.rb +31 -26
- data/lib/aspera/cli/plugins/faspio.rb +7 -5
- data/lib/aspera/cli/plugins/httpgw.rb +7 -4
- data/lib/aspera/cli/plugins/mcp.rb +42 -22
- data/lib/aspera/cli/plugins/node.rb +39 -38
- data/lib/aspera/cli/plugins/oauth.rb +23 -6
- data/lib/aspera/cli/plugins/orchestrator.rb +287 -83
- data/lib/aspera/cli/plugins/preview.rb +72 -45
- data/lib/aspera/cli/plugins/server.rb +66 -14
- data/lib/aspera/cli/plugins/shares.rb +87 -18
- data/lib/aspera/cli/plugins/transferd.rb +228 -0
- data/lib/aspera/cli/poll.rb +236 -0
- data/lib/aspera/cli/preset_actions.rb +144 -30
- data/lib/aspera/cli/preset_manager.rb +113 -35
- data/lib/aspera/cli/prompt.rb +157 -9
- data/lib/aspera/cli/result.rb +12 -8
- data/lib/aspera/cli/runner.rb +89 -48
- data/lib/aspera/cli/secret_finder.rb +4 -1
- data/lib/aspera/cli/security.rb +89 -9
- data/lib/aspera/cli/special_values.rb +4 -1
- data/lib/aspera/cli/sync_actions.rb +15 -10
- data/lib/aspera/cli/table_fitter.rb +3 -0
- data/lib/aspera/cli/terminal_formatter.rb +9 -6
- data/lib/aspera/cli/transfer_actions.rb +11 -8
- data/lib/aspera/cli/transfer_agent.rb +43 -20
- data/lib/aspera/cli/transfer_progress.rb +14 -45
- data/lib/aspera/cli/vault_actions.rb +45 -0
- data/lib/aspera/cli/vault_manager.rb +188 -42
- data/lib/aspera/cli/version.rb +4 -1
- data/lib/aspera/cli/web_secret.rb +12 -10
- data/lib/aspera/cli/wizard.rb +42 -39
- data/lib/aspera/command_line_builder.rb +9 -5
- data/lib/aspera/command_line_converter.rb +4 -1
- data/lib/aspera/coverage.rb +103 -33
- data/lib/aspera/data_repository.rb +4 -1
- data/lib/aspera/dot_container.rb +4 -1
- data/lib/aspera/environment.rb +23 -12
- data/lib/aspera/exec_spec.rb +3 -0
- data/lib/aspera/faspex_gw.rb +13 -9
- data/lib/aspera/faspex_postproc.rb +15 -12
- data/lib/aspera/formatter_interface.rb +4 -1
- data/lib/aspera/graphql.rb +5 -1
- data/lib/aspera/hash_ext.rb +3 -0
- data/lib/aspera/id_generator.rb +20 -5
- data/lib/aspera/inflate.rb +43 -0
- data/lib/aspera/json_rpc/client.rb +6 -5
- data/lib/aspera/json_rpc/version.rb +3 -0
- data/lib/aspera/line_logger.rb +4 -1
- data/lib/aspera/link_header.rb +4 -1
- data/lib/aspera/log.rb +18 -5
- data/lib/aspera/markdown.rb +5 -2
- data/lib/aspera/mime.rb +3 -0
- data/lib/aspera/nagios.rb +6 -4
- data/lib/aspera/node_emulator.rb +15 -13
- data/lib/aspera/oauth/client/base.rb +124 -73
- data/lib/aspera/oauth/client/boot.rb +7 -4
- data/lib/aspera/oauth/client/factory.rb +41 -18
- data/lib/aspera/oauth/client/generic.rb +5 -1
- data/lib/aspera/oauth/client/json_credentials.rb +7 -3
- data/lib/aspera/oauth/client/jwt.rb +6 -3
- data/lib/aspera/oauth/client/shares_web.rb +94 -0
- data/lib/aspera/oauth/client/url_json.rb +7 -3
- data/lib/aspera/oauth/client/web.rb +40 -13
- data/lib/aspera/oauth/server/pkce.rb +6 -5
- data/lib/aspera/orchestrator_workflow_checker.rb +129 -2
- data/lib/aspera/persistency_action_once.rb +5 -3
- data/lib/aspera/persistency_folder.rb +6 -3
- data/lib/aspera/preview/file_types.rb +6 -3
- data/lib/aspera/preview/generator.rb +9 -5
- data/lib/aspera/preview/options.schema.yaml +3 -3
- data/lib/aspera/preview/terminal.rb +16 -6
- data/lib/aspera/preview/utils.rb +6 -4
- data/lib/aspera/products/connect.rb +5 -2
- data/lib/aspera/products/desktop.rb +17 -2
- data/lib/aspera/products/other.rb +4 -2
- data/lib/aspera/products/transferd.rb +6 -2
- data/lib/aspera/products/transferd_service.rb +610 -0
- data/lib/aspera/proxy_auto_config.js +2 -2
- data/lib/aspera/proxy_auto_config.rb +5 -2
- data/lib/aspera/rainbow.rb +3 -0
- data/lib/aspera/rest/aspera_errors.rb +4 -1
- data/lib/aspera/rest/call_error.rb +3 -0
- data/lib/aspera/rest/client.rb +45 -34
- data/lib/aspera/rest/error_analyzer.rb +5 -2
- data/lib/aspera/rest/list.rb +8 -4
- data/lib/aspera/rest/parameters.rb +3 -0
- data/lib/aspera/rest/util.rb +8 -5
- data/lib/aspera/rest.rb +9 -6
- data/lib/aspera/schema/IBM Aspera Faspex API-5.0-enhanced.yaml +9 -9
- data/lib/aspera/schema/IBM Aspera Orchestrator API-v1-enhanced.yaml +118 -30
- data/lib/aspera/schema/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +11 -11
- data/lib/aspera/schema/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +2437 -1437
- data/lib/aspera/schema/async_tables.yaml +11 -10
- data/lib/aspera/schema/documentation.rb +8 -2
- data/lib/aspera/schema/reader.rb +7 -0
- data/lib/aspera/schema/registry.rb +44 -28
- data/lib/aspera/schema/transferd-config.schema.json +333 -0
- data/lib/aspera/schema/validator.rb +4 -1
- data/lib/aspera/sealed_hash.rb +150 -0
- data/lib/aspera/secret/hider.rb +213 -0
- data/lib/aspera/secret/reference.rb +150 -0
- data/lib/aspera/secret/resolver.rb +212 -0
- data/lib/aspera/secret/store/base.rb +153 -0
- data/lib/aspera/secret/store/encrypted_hash.rb +329 -0
- data/lib/aspera/secret/store/factory.rb +103 -0
- data/lib/aspera/secret/store/hashicorp_vault.rb +390 -0
- data/lib/aspera/secret/store/keeper.rb +141 -0
- data/lib/aspera/secret/store/macos_security.rb +284 -0
- data/lib/aspera/secret/store/one_password_api.rb +99 -0
- data/lib/aspera/secret/store/one_password_base.rb +42 -0
- data/lib/aspera/secret/store/one_password_cli.rb +112 -0
- data/lib/aspera/secret/store/secret_service.rb +125 -0
- data/lib/aspera/secret/strength.rb +119 -0
- data/lib/aspera/servlet_helpers.rb +5 -2
- data/lib/aspera/ssh.rb +10 -7
- data/lib/aspera/ssl.rb +5 -2
- data/lib/aspera/string_ext.rb +3 -0
- data/lib/aspera/sync/args.schema.yaml +3 -0
- data/lib/aspera/sync/conf.schema.yaml +9 -4
- data/lib/aspera/sync/database.rb +3 -0
- data/lib/aspera/sync/operations.rb +17 -15
- data/lib/aspera/temp_file_manager.rb +8 -4
- data/lib/aspera/timer_limiter.rb +3 -0
- data/lib/aspera/transfer/error.rb +4 -1
- data/lib/aspera/transfer/faux_file.rb +4 -1
- data/lib/aspera/transfer/parameters.rb +17 -14
- data/lib/aspera/transfer/result.rb +23 -0
- data/lib/aspera/transfer/resumer.rb +6 -4
- data/lib/aspera/transfer/spec.rb +9 -22
- data/lib/aspera/units/decimal.rb +67 -0
- data/lib/aspera/units/duration.rb +109 -0
- data/lib/aspera/uri_reader.rb +64 -9
- data/lib/aspera/web_auth/index.html.erb +6 -2
- data/lib/aspera/web_auth/paste.rb +109 -0
- data/lib/aspera/web_auth/receiver.rb +50 -0
- data/lib/aspera/web_auth/relay.rb +76 -0
- data/lib/aspera/web_auth/reply.html.erb +150 -0
- data/lib/aspera/web_auth/server.rb +47 -10
- data/lib/aspera/web_page.rb +7 -2
- data/lib/aspera/web_server_simple.rb +6 -3
- data/lib/aspera/yaml.rb +5 -1
- data/llms-install.md +88 -0
- data/llms.txt +87 -0
- data/skills/ascli/SKILL.md +94 -0
- data.tar.gz.sig +0 -0
- metadata +77 -20
- metadata.gz.sig +0 -0
- data/lib/aspera/duration.rb +0 -42
- data/lib/aspera/keychain/base.rb +0 -30
- data/lib/aspera/keychain/encrypted_hash.rb +0 -192
- data/lib/aspera/keychain/factory.rb +0 -58
- data/lib/aspera/keychain/hashicorp_vault.rb +0 -77
- data/lib/aspera/keychain/macos_security.rb +0 -277
- data/lib/aspera/keychain/one_password_api.rb +0 -91
- data/lib/aspera/keychain/one_password_base.rb +0 -39
- data/lib/aspera/keychain/one_password_cli.rb +0 -100
- data/lib/aspera/secret_hider.rb +0 -196
- data/lib/aspera/secret_strength.rb +0 -114
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative '../ascp_actions'
|
|
7
|
+
require_relative '../ascp_logs_actions'
|
|
8
|
+
require_relative '../completion_actions'
|
|
9
|
+
require_relative '../deprecation'
|
|
10
|
+
require_relative '../error'
|
|
11
|
+
require_relative '../gem_checker'
|
|
12
|
+
require_relative '../http'
|
|
13
|
+
require_relative '../info'
|
|
14
|
+
require_relative '../option_types'
|
|
15
|
+
require_relative '../parser'
|
|
16
|
+
require_relative '../preset_actions'
|
|
17
|
+
require_relative '../preset_manager'
|
|
18
|
+
require_relative '../prompt'
|
|
19
|
+
require_relative '../result'
|
|
20
|
+
require_relative '../security'
|
|
21
|
+
require_relative '../special_values'
|
|
22
|
+
require_relative '../sync_actions'
|
|
23
|
+
require_relative '../terminal_formatter'
|
|
24
|
+
require_relative '../transfer_actions'
|
|
25
|
+
require_relative '../vault_actions'
|
|
26
|
+
require_relative '../version'
|
|
27
|
+
require_relative '../wizard'
|
|
28
|
+
require_relative 'base'
|
|
29
|
+
require_relative 'factory'
|
|
30
|
+
require_relative 'transferd'
|
|
31
|
+
require_relative '../../agent/factory'
|
|
32
|
+
require_relative '../../ascp/installation'
|
|
33
|
+
require_relative '../../assert'
|
|
34
|
+
require_relative '../../command_line_builder'
|
|
35
|
+
require_relative '../../environment'
|
|
36
|
+
require_relative '../../hash_ext'
|
|
37
|
+
require_relative '../../log'
|
|
38
|
+
require_relative '../../oauth/client/factory'
|
|
39
|
+
require_relative '../../oauth/client/jwt'
|
|
40
|
+
require_relative '../../rest'
|
|
41
|
+
require_relative '../../schema/documentation'
|
|
42
|
+
require_relative '../../schema/registry'
|
|
43
|
+
require_relative '../../string_ext'
|
|
44
|
+
require_relative '../../sync/operations'
|
|
45
|
+
require_relative '../../transfer/spec'
|
|
46
|
+
require_relative '../../sealed_hash'
|
|
47
|
+
require_relative '../../web_auth/relay'
|
|
36
48
|
require 'openssl'
|
|
37
|
-
require 'digest'
|
|
38
|
-
require 'open3'
|
|
39
|
-
require 'net/http'
|
|
40
49
|
|
|
41
50
|
module Aspera
|
|
42
51
|
module Cli
|
|
@@ -44,9 +53,10 @@ module Aspera
|
|
|
44
53
|
# Manage the CLI config file
|
|
45
54
|
class Config < Base
|
|
46
55
|
include SyncActions
|
|
47
|
-
include
|
|
56
|
+
include VaultActions
|
|
48
57
|
include GemChecker
|
|
49
58
|
include AscpActions
|
|
59
|
+
include AscpLogsActions
|
|
50
60
|
include PresetActions
|
|
51
61
|
include TransferActions
|
|
52
62
|
include CompletionActions
|
|
@@ -80,27 +90,27 @@ module Aspera
|
|
|
80
90
|
end
|
|
81
91
|
|
|
82
92
|
DEFAULT_CHECK_NEW_VERSION_DAYS = 7
|
|
83
|
-
|
|
93
|
+
# Last released version with `config transferd`, `config ascp install` and `config transfer` not deprecated
|
|
94
|
+
DEPRECATED_LAST = '4.28.0'
|
|
95
|
+
private_constant :DEFAULT_CHECK_NEW_VERSION_DAYS, :DEPRECATED_LAST
|
|
84
96
|
|
|
85
|
-
option :preset, description: 'Load the named option preset from current config file', short: 'P', on_set: :load_preset
|
|
97
|
+
option :preset, description: 'Load the named option preset from current config file', short: 'P', on_set: :load_preset, complete: :preset
|
|
86
98
|
option :version_check_days, description: 'Period in days to check new version (zero to disable)', allowed: Type::INTEGER, default: DEFAULT_CHECK_NEW_VERSION_DAYS
|
|
87
|
-
option :plugin_folder, description: 'Folder where to find additional plugins', on_set: :add_plugin_folders
|
|
88
|
-
option :sdk_url, description: 'Ascp: URL to get Aspera Transfer Executables', default: SpecialValues::DEF
|
|
89
|
-
option :locations_url, description: 'Ascp: URLs to get download locations of Aspera Transfer Daemon', allowed: Type::STRING_ARRAY, default: Ascp::Installation.instance.transferd_urls, on_set: Ascp::Installation.instance.method(:transferd_urls=)
|
|
90
|
-
option :sdk_folder, description: 'Ascp: Path to folder with ascp (or product with "product:")', on_set: Ascp::Installation.instance.method(:sdk_folder=)
|
|
99
|
+
option :plugin_folder, description: 'Folder where to find additional plugins', on_set: :add_plugin_folders, complete: :folder, security: :low
|
|
100
|
+
option :sdk_url, description: 'Ascp: URL to get Aspera Transfer Executables', default: SpecialValues::DEF, security: :low
|
|
101
|
+
option :locations_url, description: 'Ascp: URLs to get download locations of Aspera Transfer Daemon', allowed: Type::STRING_ARRAY, default: Ascp::Installation.instance.transferd_urls, on_set: Ascp::Installation.instance.method(:transferd_urls=), security: :low
|
|
102
|
+
option :sdk_folder, description: 'Ascp: Path to folder with ascp (or product with "product:")', on_set: Ascp::Installation.instance.method(:sdk_folder=), complete: :folder
|
|
91
103
|
option :smtp, schema: Schema::Registry::SMTP_OPTIONS
|
|
92
104
|
option :notify_to, description: 'Email: Recipient for notification of transfers'
|
|
93
|
-
option :notify_template, description: 'Email: ERB template for notification of transfers'
|
|
105
|
+
option :notify_template, description: 'Email: ERB template for notification of transfers', security: :low
|
|
94
106
|
option :cache_tokens, description: 'Save and reuse OAuth tokens', allowed: Type::BOOLEAN, default: true
|
|
95
107
|
option :expand_mounts, description: 'Commands: list commands of sub-trees provided by another plugin', allowed: Type::BOOLEAN, default: false
|
|
96
108
|
option :no_default, description: 'Do not load default configuration for plugin', allowed: Type::NONE, short: 'N', on_set: -> { presets.use_plugin_defaults = false }
|
|
97
|
-
use_options Wizard
|
|
98
109
|
# `on_set` callbacks of HTTP options are methods of `http_config`
|
|
99
110
|
use_options Http, target: -> { http_config }
|
|
100
111
|
|
|
101
112
|
def initialize(**_)
|
|
102
113
|
super
|
|
103
|
-
@vault_instance = nil
|
|
104
114
|
@sdk_default_location = false
|
|
105
115
|
@wizard = Wizard.new(self, context.main_folder)
|
|
106
116
|
# Values set through `on_set` callbacks are used below (sdk_folder)
|
|
@@ -112,26 +122,28 @@ module Aspera
|
|
|
112
122
|
commands_under :preset do
|
|
113
123
|
command :list, description: 'List all presets', action: ->(**) { Result::ValueList.new(presets.config_presets.keys, name: 'name') }
|
|
114
124
|
command :overview, description: 'Show all options from all presets'
|
|
115
|
-
command :lookup, description: 'Find preset matching URL and username'
|
|
125
|
+
command :lookup, description: 'Find preset matching URL and username',
|
|
126
|
+
arguments: [{name: :criteria, type: Hash, schema: Schema::Registry::PRESET_LOOKUP_CRITERIA}]
|
|
116
127
|
command :secure, description: 'Move secrets to vault',
|
|
117
|
-
arguments: [{name: :config_name, mandatory: false}]
|
|
128
|
+
arguments: [{name: :config_name, mandatory: false, complete: :preset}]
|
|
118
129
|
command :show, description: 'Show a preset',
|
|
119
|
-
arguments: [{name: :name, type: :identifier}]
|
|
130
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
120
131
|
command :delete, description: 'Delete a preset',
|
|
121
|
-
arguments: [{name: :name, type: :identifier}]
|
|
132
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
122
133
|
command :get, description: 'Show a single parameter of a preset',
|
|
123
|
-
arguments: [{name: :name, type: :identifier}, {name: :param_name}]
|
|
124
|
-
command :unset, description:
|
|
125
|
-
arguments: [{name: :name, type: :identifier}, {name: :param_name}]
|
|
126
|
-
command :set, description: '
|
|
127
|
-
arguments: [{name: :name, type:
|
|
128
|
-
{name: :
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}, {name: :param_name, complete: :preset_parameter}]
|
|
135
|
+
command :unset, description: "Remove a parameter from a preset (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use set <name> <param> @none:')})",
|
|
136
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}, {name: :param_name, complete: :preset_parameter}]
|
|
137
|
+
command :set, description: 'Merge into presets: <Hash> of presets, <name> <Hash>, or <name> <param> <value> (@none: removes)',
|
|
138
|
+
arguments: [{name: :name, type: [String, Hash], complete: :preset},
|
|
139
|
+
{name: :param_name, type: [String, Hash], mandatory: false, omit_absent: true, complete: :preset_parameter},
|
|
140
|
+
{name: :param_value, type: nil, mandatory: false, omit_absent: true, evaluate: :smart}]
|
|
141
|
+
command :initialize, description: "Initialize a preset with a value (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use delete, then set <name> <Hash>')})",
|
|
142
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}, {name: :preset, type: Hash}]
|
|
143
|
+
command :update, description: "Update a preset with option values (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use set <name> <Hash>')})",
|
|
144
|
+
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
133
145
|
command :ask, description: 'Ask for option values interactively',
|
|
134
|
-
arguments: [{name: :name, type: :identifier},
|
|
146
|
+
arguments: [{name: :name, type: :identifier, complete: :preset},
|
|
135
147
|
{name: :option_names, multiple: true, interactive: true}]
|
|
136
148
|
end
|
|
137
149
|
command(
|
|
@@ -146,10 +158,18 @@ module Aspera
|
|
|
146
158
|
{name: :location, type: Symbol, mandatory: false, default: :github, allowed: %i[github local toc]},
|
|
147
159
|
{name: :section, mandatory: false}
|
|
148
160
|
]
|
|
161
|
+
command(
|
|
162
|
+
:skill, description: 'Display the agent skill: how an AI drives IBM Aspera products with ascli (same as llms.txt)',
|
|
163
|
+
action: lambda do |**|
|
|
164
|
+
skill_file = File.join(self.class.gem_src_root, '..', 'skills', 'ascli', 'SKILL.md')
|
|
165
|
+
Aspera.assert(File.exist?(skill_file), type: Cli::Error) { "Agent skill not found: #{skill_file}" }
|
|
166
|
+
Result::Text.new(File.read(skill_file))
|
|
167
|
+
end
|
|
168
|
+
)
|
|
149
169
|
command(
|
|
150
170
|
:genkey, description: 'Generate a new RSA private key',
|
|
151
171
|
arguments: [
|
|
152
|
-
{name: :private_key_path},
|
|
172
|
+
{name: :private_key_path, complete: :file},
|
|
153
173
|
{name: :private_key_length, type: Integer, mandatory: false, default: OAuth::Jwt::DEFAULT_PRIV_KEY_LENGTH}
|
|
154
174
|
],
|
|
155
175
|
action: lambda do |private_key_path:, private_key_length: OAuth::Jwt::DEFAULT_PRIV_KEY_LENGTH, **|
|
|
@@ -161,27 +181,41 @@ module Aspera
|
|
|
161
181
|
arguments: [{name: :private_key_pem}],
|
|
162
182
|
action: ->(private_key_pem:, **) { Result::Text.new(OpenSSL::PKey::RSA.new(private_key_pem).public_key.to_s) }
|
|
163
183
|
command :remote_certificate, description: 'Retrieve the certificate chain of a remote HTTPS server'
|
|
164
|
-
command :echo, description: 'Show the value of a given argument',
|
|
184
|
+
command :echo, read_only: true, description: 'Show the value of a given argument',
|
|
165
185
|
arguments: [{name: :value, type: nil}],
|
|
166
186
|
action: ->(value:, **) { Result.auto(value) }
|
|
167
187
|
command :download, description: 'Download a file from a URL',
|
|
168
188
|
arguments: [
|
|
169
189
|
{name: :file_url},
|
|
170
|
-
{name: :file_dest, mandatory: false}
|
|
190
|
+
{name: :file_dest, mandatory: false, complete: :file}
|
|
171
191
|
]
|
|
192
|
+
command :web_login, description: 'Web login for ascli on another host (option ui.web_auth=paste): open the login page, show a code to paste there',
|
|
193
|
+
security: :low,
|
|
194
|
+
arguments: [{name: :code}]
|
|
172
195
|
command :tokens, description: 'Manage OAuth tokens'
|
|
173
196
|
command :plugins, description: 'Manage CLI plugins'
|
|
174
|
-
command
|
|
175
|
-
|
|
176
|
-
|
|
197
|
+
command(
|
|
198
|
+
:detect, description: 'Detect the Aspera product from a URL (interactive)',
|
|
199
|
+
arguments: [{name: :params, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::DETECT_OPTIONS}],
|
|
200
|
+
action: lambda do |params:, **|
|
|
201
|
+
Result::ObjectList.new(@wizard.identify_plugins_for_url(url: ask_url(params), plugin_name: params['plugin']).freeze)
|
|
202
|
+
end
|
|
203
|
+
)
|
|
177
204
|
command(
|
|
178
205
|
:wizard, description: 'Run the setup wizard for an Aspera product (interactive)',
|
|
179
|
-
arguments: [{name: :
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
206
|
+
arguments: [{name: :params, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::WIZARD_OPTIONS}],
|
|
207
|
+
action: lambda do |params:, **|
|
|
208
|
+
apps = @wizard.identify_plugins_for_url(url: ask_url(params), plugin_name: params['plugin']).freeze
|
|
209
|
+
# Options of the plugin (`--username`, `--password`, `--private-key`, ...) are read from the command line.
|
|
183
210
|
# The product wizard prompts for missing mandatory options (username, password, ...)
|
|
184
|
-
options.with_interactive
|
|
211
|
+
options.with_interactive do
|
|
212
|
+
@wizard.find(
|
|
213
|
+
apps,
|
|
214
|
+
preset_name: params['preset'] || '',
|
|
215
|
+
override: params.fetch('override', false),
|
|
216
|
+
default: params.fetch('default', true)
|
|
217
|
+
)
|
|
218
|
+
end
|
|
185
219
|
end
|
|
186
220
|
)
|
|
187
221
|
command :coffee, description: 'Show a coffee image', action: ->(**) { Result::Image.new(COFFEE_IMAGE_URL) }
|
|
@@ -214,10 +248,19 @@ module Aspera
|
|
|
214
248
|
commands_under :vault do
|
|
215
249
|
command :info, description: 'Show vault information',
|
|
216
250
|
action: ->(**) { Result::SingleObject.new(vault_required.info) }
|
|
251
|
+
command :stores, description: 'List stores of option vault, with their type and whether it is the default one, without parameters',
|
|
252
|
+
action: ->(**) { Result::ObjectList.new(context.vault.stores) }
|
|
217
253
|
command :ids, description: 'List secret labels in the vault',
|
|
218
254
|
action: ->(**) { Result::ObjectList.new(vault_required.ids) }
|
|
219
255
|
command :list, description: 'List all secrets with full details',
|
|
220
256
|
action: ->(**) { Result::ObjectList.new(vault_required.all) }
|
|
257
|
+
command :overview, description: 'List labels of all secrets with their field names, without values',
|
|
258
|
+
action: ->(**) { Result::ObjectList.new(vault_required.ids.map { |i| {'label' => i[:label], 'fields' => context.vault.fields(i[:label])} }) }
|
|
259
|
+
command(
|
|
260
|
+
:field, description: 'List field names of a secret by label, without values',
|
|
261
|
+
arguments: [{name: :label}],
|
|
262
|
+
action: ->(label:, **) { Result::ValueList.new(context.vault.fields(label), name: 'field') }
|
|
263
|
+
)
|
|
221
264
|
command(
|
|
222
265
|
:show, description: 'Show a secret by label (or id)',
|
|
223
266
|
arguments: [{name: :label}, {name: :id, mandatory: false, default: nil}],
|
|
@@ -248,6 +291,8 @@ module Aspera
|
|
|
248
291
|
)
|
|
249
292
|
command :import, description: 'Import secrets from a JSON array (supports --bulk)',
|
|
250
293
|
arguments: [{name: :secrets, type: Array, schema: {type: 'array', items: {'$ref' => Schema::Registry::VAULT_SECRET}}}]
|
|
294
|
+
command :check, description: 'Check that a reference to a store of option vault can be read, without its value',
|
|
295
|
+
arguments: [{name: :reference, evaluate: :none}]
|
|
251
296
|
end
|
|
252
297
|
command :commands, description: 'List all available commands, of all plugins or only the given one, optionally under a command path',
|
|
253
298
|
arguments: [{name: :plugin_name, mandatory: false, default: nil},
|
|
@@ -294,14 +339,12 @@ module Aspera
|
|
|
294
339
|
command(
|
|
295
340
|
:flush, description: 'Delete all cached OAuth tokens',
|
|
296
341
|
action: lambda do |**|
|
|
297
|
-
require 'aspera/api/node'
|
|
298
342
|
Result::ValueList.new(OAuth::Factory.instance.flush_tokens, name: 'file')
|
|
299
343
|
end
|
|
300
344
|
)
|
|
301
345
|
command(
|
|
302
346
|
:list, description: 'List all cached OAuth tokens',
|
|
303
347
|
action: lambda do |**|
|
|
304
|
-
require 'aspera/api/node'
|
|
305
348
|
Result::ObjectList.new(OAuth::Factory.instance.persisted_tokens)
|
|
306
349
|
end
|
|
307
350
|
)
|
|
@@ -312,10 +355,10 @@ module Aspera
|
|
|
312
355
|
# plugins sub-commands
|
|
313
356
|
commands_under :plugins do
|
|
314
357
|
command :list, description: 'List all available plugins'
|
|
315
|
-
command :create, description: 'Create a new plugin skeleton file',
|
|
358
|
+
command :create, description: 'Create a new plugin skeleton file', security: :low,
|
|
316
359
|
arguments: [
|
|
317
360
|
{name: :name},
|
|
318
|
-
{name: :folder, mandatory: false}
|
|
361
|
+
{name: :folder, mandatory: false, complete: :folder}
|
|
319
362
|
]
|
|
320
363
|
end
|
|
321
364
|
|
|
@@ -324,9 +367,9 @@ module Aspera
|
|
|
324
367
|
commands_under :ascp do
|
|
325
368
|
command :show, description: 'Show ascp binary path', action: ->(**) { Result::Text.new(Ascp::Installation.instance.path(:ascp)) }
|
|
326
369
|
command :info, description: 'Show ascp and transfer spec information'
|
|
327
|
-
command :install, description:
|
|
370
|
+
command :install, description: "Install the transfer SDK (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use transferd install')})",
|
|
328
371
|
arguments: [{name: :version, mandatory: false, default: nil}],
|
|
329
|
-
action: ->(version: nil, **) {
|
|
372
|
+
action: ->(version: nil, **) { transferd_plugin(command: 'config ascp install', replacement: 'transferd install').action_install(version: version) }
|
|
330
373
|
command(
|
|
331
374
|
:spec, description: 'Show the transfer spec schema',
|
|
332
375
|
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys + [Transfer::Spec::DOC_OVERVIEW], mandatory: false, default: nil}],
|
|
@@ -337,7 +380,12 @@ module Aspera
|
|
|
337
380
|
)
|
|
338
381
|
command :schema, description: 'Show the transfer spec JSON schema',
|
|
339
382
|
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys, mandatory: false, default: nil}]
|
|
340
|
-
command :errors, description: 'Show FASP error codes'
|
|
383
|
+
command :errors, description: 'Show FASP error codes: of the management port (default), or of sessions (errcode in logs)',
|
|
384
|
+
arguments: [{name: :kind, allowed: %i[management session], mandatory: false, default: :management}]
|
|
385
|
+
ascp_logs_commands :logs
|
|
386
|
+
commands_under :logs do
|
|
387
|
+
command :find, description: 'Find the ascp log files of this system: of installed products, and default locations', action: :action_ascp_logs_find
|
|
388
|
+
end
|
|
341
389
|
command :products, description: 'Manage installed Aspera products'
|
|
342
390
|
commands_under :products do
|
|
343
391
|
command :list, description: 'List installed Aspera products',
|
|
@@ -355,9 +403,8 @@ module Aspera
|
|
|
355
403
|
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys}]
|
|
356
404
|
end
|
|
357
405
|
|
|
358
|
-
# transfer
|
|
359
|
-
|
|
360
|
-
commands_under :transfer do
|
|
406
|
+
# async transfer jobs: moved to `agents jobs`, `transfer` is kept as deprecated alias
|
|
407
|
+
commands_under %i[agents jobs], description: 'Manage asynchronous transfer jobs' do
|
|
361
408
|
command(
|
|
362
409
|
:list, description: 'List all async transfer jobs',
|
|
363
410
|
action: lambda do |**|
|
|
@@ -366,22 +413,15 @@ module Aspera
|
|
|
366
413
|
end
|
|
367
414
|
)
|
|
368
415
|
command :status, description: 'Show status of an async transfer job',
|
|
369
|
-
arguments: [{name: :job_id}]
|
|
416
|
+
arguments: [{name: :job_id, complete: :transfer_job}]
|
|
370
417
|
command :cleanup, description: 'Remove completed/failed/cancelled transfer entries'
|
|
371
418
|
end
|
|
419
|
+
command :transfer, description: "Manage asynchronous transfers (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use agents jobs')})",
|
|
420
|
+
setup: :deprecated_transfer_setup, mount: {plugin: self, at: %i[agents jobs], instance: :itself}
|
|
372
421
|
|
|
373
|
-
# transferd sub-commands
|
|
374
|
-
command :transferd, description:
|
|
375
|
-
|
|
376
|
-
command :install, description: 'Install the transfer daemon', action: ->(**) { install_transfer_sdk }
|
|
377
|
-
command(
|
|
378
|
-
:list, description: 'List available SDK locations',
|
|
379
|
-
action: lambda do |**|
|
|
380
|
-
sdk_list = Ascp::Installation.instance.sdk_locations
|
|
381
|
-
Result::ObjectList.new(sdk_list, fields: sdk_list.first.keys - ['url'])
|
|
382
|
-
end
|
|
383
|
-
)
|
|
384
|
-
end
|
|
422
|
+
# transferd sub-commands: moved to plugin `transferd`, kept as deprecated alias
|
|
423
|
+
command :transferd, description: "Manage the transfer daemon (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use plugin transferd')})",
|
|
424
|
+
mount: {plugin: Transferd, instance: :transferd_plugin, only: %i[install list service]}
|
|
385
425
|
|
|
386
426
|
# sync sub-commands
|
|
387
427
|
commands_under :sync do
|
|
@@ -425,9 +465,9 @@ module Aspera
|
|
|
425
465
|
# completion sub-commands
|
|
426
466
|
commands_under :completion do
|
|
427
467
|
command :words, description: 'List words that can follow the given words',
|
|
428
|
-
arguments: [{name: :words, multiple: true, mandatory: false,
|
|
468
|
+
arguments: [{name: :words, multiple: true, mandatory: false, evaluate: :none}]
|
|
429
469
|
command :candidates, description: 'Complete the last word, with descriptions and a directive for the shell (used by completion scripts)',
|
|
430
|
-
arguments: [{name: :words, multiple: true, mandatory: false,
|
|
470
|
+
arguments: [{name: :words, multiple: true, mandatory: false, evaluate: :none}]
|
|
431
471
|
COMPLETION_SHELLS.each_key do |shell|
|
|
432
472
|
command shell, description: "Generate #{shell} completion script, to evaluate in shell",
|
|
433
473
|
action: ->(**) { completion_script(shell) }
|
|
@@ -439,9 +479,9 @@ module Aspera
|
|
|
439
479
|
# `on_set` callback of option `plugin_folder`
|
|
440
480
|
# @param value [String, Array<String>] folder(s) where to find plugins
|
|
441
481
|
def add_plugin_folders(value)
|
|
442
|
-
value =
|
|
482
|
+
value = Array(value)
|
|
443
483
|
Aspera.assert_array_all(value, String) { 'plugin folder(s)' }
|
|
444
|
-
value.each { |f| Plugins::Factory.instance.add_lookup_folder(f) }
|
|
484
|
+
value.each { |f| Plugins::Factory.instance.add_lookup_folder(f, security: :low) }
|
|
445
485
|
end
|
|
446
486
|
|
|
447
487
|
# `on_set` callback of option `preset`
|
|
@@ -459,6 +499,28 @@ module Aspera
|
|
|
459
499
|
|
|
460
500
|
# DSL handlers - one method per leaf command
|
|
461
501
|
|
|
502
|
+
# URL of the application to detect or configure: from `params`, else asked to the user
|
|
503
|
+
# @param params [Hash] parameters of `detect` or `wizard`
|
|
504
|
+
# @return [String] URL
|
|
505
|
+
def ask_url(params)
|
|
506
|
+
params['url'] || options.with_interactive { options.get_interactive('url') }
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
# Instance of plugin `transferd`, for the deprecated commands `config transferd` and `config ascp install`
|
|
510
|
+
# @param command [String] Deprecated command
|
|
511
|
+
# @param replacement [String] Command to use instead
|
|
512
|
+
# @return [Transferd] Plugin instance
|
|
513
|
+
def transferd_plugin(command: 'config transferd', replacement: 'transferd', **)
|
|
514
|
+
Log.log.warn { "Command #{command} is #{Deprecation.new(last: DEPRECATED_LAST, message: "use #{replacement}")}" }
|
|
515
|
+
Transferd.new(context: context)
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# Setup of the deprecated `config transfer` (alias of `config agents jobs`, same plugin)
|
|
519
|
+
def deprecated_transfer_setup(**)
|
|
520
|
+
Log.log.warn { "Command config transfer is #{Deprecation.new(last: DEPRECATED_LAST, message: 'use config agents jobs')}" }
|
|
521
|
+
{}
|
|
522
|
+
end
|
|
523
|
+
|
|
462
524
|
def action_documentation(location: :github, section: nil, **)
|
|
463
525
|
case location
|
|
464
526
|
when :github
|
|
@@ -466,7 +528,7 @@ module Aspera
|
|
|
466
528
|
Environment.instance.open_uri("#{Info::DOC_URL}#{section}")
|
|
467
529
|
return Result::Nothing.new
|
|
468
530
|
when :toc, :local
|
|
469
|
-
|
|
531
|
+
require_relative '../../markdown'
|
|
470
532
|
local_doc = File.join(self.class.gem_src_root, '..', 'docs', 'README.md')
|
|
471
533
|
Aspera.assert(File.exist?(local_doc), type: Cli::Error) { "Local documentation not found: #{local_doc}" }
|
|
472
534
|
content = File.read(local_doc)
|
|
@@ -488,16 +550,48 @@ module Aspera
|
|
|
488
550
|
end
|
|
489
551
|
end
|
|
490
552
|
|
|
553
|
+
# Web login for `ascli` that runs on another host, started with `--ui.web_auth=paste`.
|
|
554
|
+
# The code comes from another host, or from a message: the host of the login page is confirmed by the user the first time.
|
|
555
|
+
# @param code [String] Code of type login, given by the remote `ascli`
|
|
556
|
+
def action_web_login(code:, **)
|
|
557
|
+
data = SealedHash.unseal(code, base_key: Cli::Info::CMD_NAME)
|
|
558
|
+
raise BadArgument, 'This code is for ascli that waits for the login: run this command with the code that ascli gives' unless data.is_a?(Hash) && data.key?('login_url')
|
|
559
|
+
login = WebAuth::Relay.parse(data)
|
|
560
|
+
confirm_web_login_host(login.host)
|
|
561
|
+
Log.log.debug { "Redirection to #{login.redirect_uri}" }
|
|
562
|
+
WebAuth::Relay.run(login)
|
|
563
|
+
Result::Status.new('Login done: paste the code shown by the browser in the terminal of ascli that waits for it')
|
|
564
|
+
rescue ParameterError => e
|
|
565
|
+
raise BadArgument, e.message
|
|
566
|
+
rescue Errno::EADDRINUSE
|
|
567
|
+
raise Cli::Error, "Cannot listen on #{login.redirect_uri}: the port is used. The URL is registered for the login, it cannot be changed: free the port, and retry."
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
# The login page opened by `web_login` comes from a code given by another host (or in a message): ask the user to accept its host the first time.
|
|
571
|
+
# Accepted hosts are kept in persistency. Without a terminal, an unknown host is refused.
|
|
572
|
+
# @param host [String] Host of the login page
|
|
573
|
+
# @raise [BadArgument] if the host is not accepted
|
|
574
|
+
def confirm_web_login_host(host)
|
|
575
|
+
persist = context.persistency
|
|
576
|
+
hosts = persist.get(WEB_LOGIN_HOSTS_ID).to_s.split("\n")
|
|
577
|
+
return if hosts.include?(host)
|
|
578
|
+
raise BadArgument, "Host of the login page is not known: #{host}. Run this command in a terminal to accept it." unless $stdin.tty?
|
|
579
|
+
Log.log.warn { "This code opens the login page of: #{host}" }
|
|
580
|
+
answer = Prompt.prompt_user_input("Open it, and trust this host for next logins? (yes/no)")
|
|
581
|
+
raise BadArgument, "Host of the login page refused: #{host}" unless %w[y yes].include?(answer.strip.downcase)
|
|
582
|
+
persist.put(WEB_LOGIN_HOSTS_ID, (hosts + [host]).join("\n"))
|
|
583
|
+
end
|
|
584
|
+
|
|
491
585
|
def action_download(file_url:, file_dest: nil, **)
|
|
492
586
|
file_url = file_url.chomp
|
|
493
587
|
file_dest = File.join(transfer.destination_folder(Transfer::Spec::DIRECTION_RECEIVE), file_url.rpartition('/').last) if file_dest.nil?
|
|
588
|
+
file_dest = Security.instance.writable_path(file_dest)
|
|
494
589
|
Log.log.info("Downloading: #{file_url}")
|
|
495
590
|
Rest::Client.new(base_url: file_url).call(operation: 'GET', save_to: file_dest)
|
|
496
591
|
Result::Status.new("Saved to: #{file_dest}")
|
|
497
592
|
end
|
|
498
593
|
|
|
499
594
|
def action_tokens_show(token_id:, **)
|
|
500
|
-
require 'aspera/api/node'
|
|
501
595
|
data = OAuth::Factory.instance.get_token_info(token_id)
|
|
502
596
|
Aspera.assert(!data.nil?, type: Cli::Error) { 'Unknown identifier' }
|
|
503
597
|
Result::SingleObject.new(data)
|
|
@@ -518,6 +612,8 @@ module Aspera
|
|
|
518
612
|
|
|
519
613
|
def action_plugins_create(name:, folder: nil, **)
|
|
520
614
|
plugin_name = name.downcase
|
|
615
|
+
# The name is inserted in Ruby code and in a file name
|
|
616
|
+
Aspera.assert(plugin_name.match?(/\A[a-z][a-z0-9_]*\z/), type: BadArgument) { "plugin name must be lowercase letters, digits and underscores: #{name}" }
|
|
521
617
|
destination_folder = folder || File.join(context.main_folder, ASPERA_PLUGINS_FOLDERNAME)
|
|
522
618
|
plugin_file = File.join(destination_folder, "#{plugin_name}.rb")
|
|
523
619
|
content = <<~END_OF_PLUGIN_CODE
|
|
@@ -545,7 +641,9 @@ module Aspera
|
|
|
545
641
|
cp[DEMO_PRESET] = {
|
|
546
642
|
'url' => "ssh://#{DEMO_SERVER}.asperasoft.com:33001",
|
|
547
643
|
'username' => ASPERA,
|
|
548
|
-
'ssAP'.downcase.reverse + 'drow'.reverse => DEMO_SERVER + ASPERA
|
|
644
|
+
'ssAP'.downcase.reverse + 'drow'.reverse => DEMO_SERVER + ASPERA,
|
|
645
|
+
# The demo server offers only host key `ssh-rsa` (SHA-1), not enabled by default in `Net::SSH` (browse, delete...)
|
|
646
|
+
'ssh_options' => {'host_key' => DEMO_SERVER_HOST_KEYS}
|
|
549
647
|
}
|
|
550
648
|
end
|
|
551
649
|
cp[PresetManager::Key::DEFAULTS] ||= {}
|
|
@@ -573,6 +671,8 @@ module Aspera
|
|
|
573
671
|
reg = Plugins::Factory.instance.plugin_class(name).command_registry
|
|
574
672
|
prefix = listed_command_path(name, reg, words)
|
|
575
673
|
paths = prefix.empty? || reg.children_of(prefix).any? ? reg.leaf_paths(prefix, expand_mounts: expand_mounts) : [prefix]
|
|
674
|
+
# Commands refused by security level are not proposed
|
|
675
|
+
paths = paths.select { |path| path.each_index.all? { |i| Security.instance.allowed?(reg[path[0, i + 1]]&.security) } }
|
|
576
676
|
paths.map do |path|
|
|
577
677
|
mount = expand_mounts ? nil : reg.mount_at(path)
|
|
578
678
|
description = reg[path]&.description.to_s
|
|
@@ -640,13 +740,17 @@ module Aspera
|
|
|
640
740
|
# Folder containing custom plugins in user's config folder
|
|
641
741
|
ASPERA_PLUGINS_FOLDERNAME = 'plugins'
|
|
642
742
|
PERSISTENCY_FOLDER = 'persist_store'
|
|
743
|
+
# Persistency identifier of the hosts of login pages that the user accepted for `web_login`
|
|
744
|
+
WEB_LOGIN_HOSTS_ID = 'web_login_hosts'
|
|
643
745
|
FILE_LIST_FOLDER_NAME = 'filelists'
|
|
644
746
|
REST_EXCEPTIONS_LOG_FILENAME = 'rest_exceptions.log'
|
|
645
747
|
ASPERA = 'aspera'
|
|
646
748
|
SERVER_COMMAND = 'server'
|
|
647
749
|
DEMO_SERVER = 'demo'
|
|
648
|
-
DEMO_PRESET = 'demoserver'
|
|
649
|
-
|
|
750
|
+
DEMO_PRESET = 'demoserver'
|
|
751
|
+
# SSH host key algorithms for the demo server: `ssh-rsa` last, used only if the server offers nothing better
|
|
752
|
+
DEMO_SERVER_HOST_KEYS = %w[rsa-sha2-512 rsa-sha2-256 ssh-rsa].freeze
|
|
753
|
+
EMAIL_TEST_TEMPLATE = <<~END_OF_TEMPLATE.freeze
|
|
650
754
|
From: <%=from_name%> <<%=from_email%>>
|
|
651
755
|
To: <<%=to%>>
|
|
652
756
|
Subject: #{Info::GEM_NAME} email test
|
|
@@ -662,12 +766,14 @@ module Aspera
|
|
|
662
766
|
:CONF_GLOBAL_SYM,
|
|
663
767
|
:ASPERA_PLUGINS_FOLDERNAME,
|
|
664
768
|
:PERSISTENCY_FOLDER,
|
|
769
|
+
:WEB_LOGIN_HOSTS_ID,
|
|
665
770
|
:FILE_LIST_FOLDER_NAME,
|
|
666
771
|
:REST_EXCEPTIONS_LOG_FILENAME,
|
|
667
772
|
:ASPERA,
|
|
668
773
|
:SERVER_COMMAND,
|
|
669
774
|
:DEMO_SERVER,
|
|
670
775
|
:DEMO_PRESET,
|
|
776
|
+
:DEMO_SERVER_HOST_KEYS,
|
|
671
777
|
:EMAIL_TEST_TEMPLATE,
|
|
672
778
|
:EXTEND_PRESET,
|
|
673
779
|
:EXTEND_VAULT,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative '../../assert'
|
|
7
|
+
require_relative 'basic_auth'
|
|
8
|
+
require_relative '../../nagios'
|
|
6
9
|
|
|
7
10
|
module Aspera
|
|
8
11
|
module Cli
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative 'base'
|
|
7
|
+
require_relative 'node'
|
|
8
|
+
require_relative '../error'
|
|
9
|
+
require_relative '../../api/cos_node'
|
|
10
|
+
require_relative '../../assert'
|
|
7
11
|
|
|
8
12
|
module Aspera
|
|
9
13
|
module Cli
|