aspera-cli 4.29.1 → 4.30.0
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 +4 -4
- data/CHANGELOG.md +119 -0
- data/CONTRIBUTING.md +8 -1
- data/README.md +2 -0
- data/TODO.md +4 -5
- data/bin/asession +2 -2
- data/docs/README.md +616 -86
- data/docs/test-mcp-with-ai.md +4 -0
- data/lib/aspera/agent/base.rb +62 -6
- data/lib/aspera/agent/factory.rb +127 -20
- data/lib/aspera/ascp/data_repository.rb +71 -0
- data/lib/aspera/ascp/installation.rb +16 -11
- data/lib/aspera/ascp/log_analyzer/lines.rb +4 -4
- data/lib/aspera/ascp/log_analyzer/log_file.rb +5 -3
- data/lib/aspera/ascp/log_analyzer/records.rb +11 -6
- data/lib/aspera/ascp/log_analyzer.rb +43 -18
- data/lib/aspera/ascp/log_locations.rb +2 -2
- data/lib/aspera/assert.rb +8 -0
- data/lib/aspera/bundle_registry.rb +528 -0
- data/lib/aspera/cli/argument.rb +110 -0
- data/lib/aspera/cli/bool_value.rb +41 -0
- data/lib/aspera/cli/bootstrapper.rb +31 -24
- data/lib/aspera/cli/command/mount.rb +53 -0
- data/lib/aspera/cli/command/registry.rb +434 -0
- data/lib/aspera/cli/command.rb +95 -0
- data/lib/aspera/cli/command_line.rb +91 -91
- data/lib/aspera/cli/complete.rb +22 -0
- data/lib/aspera/cli/completion_actions.rb +28 -26
- data/lib/aspera/cli/context.rb +29 -6
- data/lib/aspera/cli/error.rb +39 -0
- data/lib/aspera/cli/extended_value.rb +25 -4
- data/lib/aspera/cli/formatter.rb +8 -8
- data/lib/aspera/cli/hints.rb +17 -52
- data/lib/aspera/cli/http.rb +17 -12
- data/lib/aspera/cli/mailer.rb +7 -24
- data/lib/aspera/cli/mcp/tool.rb +10 -2
- data/lib/aspera/cli/option/declarator.rb +80 -0
- data/lib/aspera/cli/option/registry.rb +74 -0
- data/lib/aspera/cli/option/source.rb +38 -0
- data/lib/aspera/cli/option/type.rb +37 -0
- data/lib/aspera/cli/option/value.rb +376 -0
- data/lib/aspera/cli/option.rb +78 -0
- data/lib/aspera/cli/options.schema.yaml +28 -783
- data/lib/aspera/cli/parser.rb +73 -41
- data/lib/aspera/cli/plugins/base.rb +122 -42
- data/lib/aspera/cli/plugins/basic_auth.rb +13 -2
- data/lib/aspera/cli/plugins/config.rb +101 -167
- data/lib/aspera/cli/plugins/factory.rb +139 -43
- data/lib/aspera/cli/plugins/mcp.rb +61 -54
- data/lib/aspera/cli/plugins/oauth.rb +19 -6
- data/lib/aspera/cli/poll.rb +14 -20
- data/lib/aspera/cli/preset_actions.rb +11 -3
- data/lib/aspera/cli/preset_manager.rb +16 -6
- data/lib/aspera/cli/result.rb +2 -2
- data/lib/aspera/cli/runner.rb +71 -99
- data/lib/aspera/cli/secret_finder.rb +1 -1
- data/lib/aspera/cli/security.rb +102 -4
- data/lib/aspera/{preview/terminal.rb → cli/terminal_image.rb} +93 -94
- data/lib/aspera/cli/vault_manager.rb +3 -3
- data/lib/aspera/cli/version.rb +1 -1
- data/lib/aspera/cli/wizard.rb +9 -3
- data/lib/aspera/coverage.rb +1 -2
- data/lib/aspera/line_logger.rb +35 -6
- data/lib/aspera/log.rb +3 -2
- data/lib/aspera/oauth/client/base.rb +19 -1
- data/lib/aspera/oauth/client/factory.rb +1 -7
- data/lib/aspera/plugin.schema.yaml +178 -0
- data/lib/aspera/plugins/alee/api.rb +25 -0
- data/lib/aspera/{cli/plugins/alee.rb → plugins/alee/commands.rb} +10 -8
- data/lib/aspera/plugins/alee/plugin.yaml +3 -0
- data/lib/aspera/plugins/aoc/admin_resources.rb +148 -0
- data/lib/aspera/plugins/aoc/api.rb +783 -0
- data/lib/aspera/{cli/plugins/aoc.rb → plugins/aoc/commands.rb} +404 -330
- data/lib/aspera/plugins/aoc/graphql.rb +45 -0
- data/lib/aspera/plugins/aoc/plugin.yaml +31 -0
- data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +15042 -7076
- data/lib/aspera/plugins/aoc/schemas/options.yaml +47 -0
- data/lib/aspera/plugins/ats/api.rb +51 -0
- data/lib/aspera/{cli/plugins/ats.rb → plugins/ats/commands.rb} +33 -33
- data/lib/aspera/plugins/ats/plugin.yaml +6 -0
- data/lib/aspera/plugins/connect/agent.rb +199 -0
- data/lib/aspera/plugins/connect/plugin.yaml +11 -0
- data/lib/aspera/plugins/connect/schemas/agent_options.yaml +6 -0
- data/lib/aspera/{cli/plugins/console.rb → plugins/console/commands.rb} +41 -33
- data/lib/aspera/plugins/console/plugin.yaml +8 -0
- data/lib/aspera/plugins/cos/api.rb +114 -0
- data/lib/aspera/{cli/plugins/cos.rb → plugins/cos/commands.rb} +19 -16
- data/lib/aspera/plugins/cos/plugin.yaml +9 -0
- data/lib/aspera/plugins/cos/schemas/options.yaml +30 -0
- data/lib/aspera/plugins/desktop/agent.rb +165 -0
- data/lib/aspera/plugins/desktop/plugin.yaml +11 -0
- data/lib/aspera/plugins/desktop/schemas/agent_options.yaml +6 -0
- data/lib/aspera/plugins/direct/agent.rb +518 -0
- data/lib/aspera/plugins/direct/plugin.yaml +11 -0
- data/lib/aspera/plugins/direct/schemas/agent_options.yaml +86 -0
- data/lib/aspera/plugins/faspex4/gateway_options.rb +18 -0
- data/lib/aspera/plugins/faspex4/gw_servlet.rb +122 -0
- data/lib/aspera/plugins/faspex4/plugin.yaml +7 -0
- data/lib/aspera/plugins/faspex4/schemas/options.yaml +57 -0
- data/lib/aspera/plugins/faspex5/api.rb +269 -0
- data/lib/aspera/{cli/plugins/faspex5.rb → plugins/faspex5/commands.rb} +152 -114
- data/lib/aspera/plugins/faspex5/faspex4_post_proc_servlet.rb +241 -0
- data/lib/aspera/plugins/faspex5/plugin.yaml +14 -0
- data/lib/aspera/{schema → plugins/faspex5/schemas}/IBM Aspera Faspex API-5.0-enhanced.yaml +279 -76
- data/lib/aspera/plugins/faspex5/schemas/options.yaml +87 -0
- data/lib/aspera/{cli/plugins/faspio.rb → plugins/faspio/commands.rb} +11 -7
- data/lib/aspera/plugins/faspio/plugin.yaml +8 -0
- data/lib/aspera/{schema → plugins/faspio/schemas}/IBM Aspera faspio Gateway API-1.0.0-enhanced.yaml +4 -2
- data/lib/aspera/plugins/httpgw/agent.rb +126 -0
- data/lib/aspera/plugins/httpgw/api.rb +411 -0
- data/lib/aspera/{cli/plugins/httpgw.rb → plugins/httpgw/commands.rb} +9 -9
- data/lib/aspera/plugins/httpgw/plugin.yaml +12 -0
- data/lib/aspera/plugins/httpgw/schemas/agent_options.yaml +24 -0
- data/lib/aspera/plugins/node/agent.rb +184 -0
- data/lib/aspera/plugins/node/api.rb +699 -0
- data/lib/aspera/{cli/plugins/node.rb → plugins/node/commands.rb} +166 -141
- data/lib/aspera/plugins/node/emulator.rb +774 -0
- data/lib/aspera/plugins/node/plugin.yaml +20 -0
- data/lib/aspera/plugins/node/schemas/agent_options.yaml +20 -0
- data/lib/aspera/plugins/node/schemas/options.yaml +190 -0
- data/lib/aspera/{cli/plugins/orchestrator.rb → plugins/orchestrator/commands.rb} +139 -110
- data/lib/aspera/plugins/orchestrator/plugin.yaml +34 -0
- data/lib/aspera/{schema → plugins/orchestrator/schemas}/IBM Aspera Orchestrator API-v1-enhanced.yaml +486 -16
- data/lib/aspera/plugins/orchestrator/schemas/options.yaml +143 -0
- data/lib/aspera/plugins/orchestrator/workflow_checker.rb +692 -0
- data/lib/aspera/{cli/plugins/preview.rb → plugins/preview/commands.rb} +53 -51
- data/lib/aspera/plugins/preview/file_types.rb +121 -0
- data/lib/aspera/plugins/preview/generator.rb +350 -0
- data/lib/aspera/plugins/preview/plugin.yaml +12 -0
- data/lib/aspera/{preview/options.schema.yaml → plugins/preview/schemas/options.yaml} +1 -1
- data/lib/aspera/plugins/preview/utils.rb +213 -0
- data/lib/aspera/plugins/server/ascmd.rb +374 -0
- data/lib/aspera/{cli/plugins/server.rb → plugins/server/commands.rb} +48 -32
- data/lib/aspera/plugins/server/plugin.yaml +9 -0
- data/lib/aspera/plugins/server/schemas/options.yaml +30 -0
- data/lib/aspera/{cli/plugins/shares.rb → plugins/shares/commands.rb} +29 -21
- data/lib/aspera/plugins/shares/plugin.yaml +10 -0
- data/lib/aspera/plugins/shares/shares_web.rb +97 -0
- data/lib/aspera/plugins/transferd/agent.rb +258 -0
- data/lib/aspera/plugins/transferd/api.rb +180 -0
- data/lib/aspera/plugins/transferd/client.rb +67 -0
- data/lib/aspera/{cli/plugins/transferd.rb → plugins/transferd/commands.rb} +43 -42
- data/lib/aspera/plugins/transferd/config_commands.rb +38 -0
- data/lib/aspera/plugins/transferd/plugin.yaml +27 -0
- data/lib/aspera/plugins/transferd/product.rb +146 -0
- data/lib/aspera/plugins/transferd/schemas/agent_options.yaml +31 -0
- data/lib/aspera/plugins/transferd/schemas/options.yaml +80 -0
- data/lib/aspera/plugins/transferd/service.rb +617 -0
- data/lib/aspera/plugins/xfer/ascp_actions.rb +131 -0
- data/lib/aspera/plugins/xfer/ascp_logs_actions.rb +198 -0
- data/lib/aspera/plugins/xfer/async_transfer_store.rb +131 -0
- data/lib/aspera/plugins/xfer/config_commands.rb +119 -0
- data/lib/aspera/plugins/xfer/helper.rb +19 -0
- data/lib/aspera/plugins/xfer/plugin.yaml +42 -0
- data/lib/aspera/plugins/xfer/schemas/agent_extension.schema.yaml +26 -0
- data/lib/aspera/plugins/xfer/schemas/options.yaml +125 -0
- data/lib/aspera/plugins/xfer/sync_actions.rb +253 -0
- data/lib/aspera/plugins/xfer/transfer_actions.rb +176 -0
- data/lib/aspera/plugins/xfer/transfer_agent.rb +505 -0
- data/lib/aspera/products/cli_v3.rb +34 -0
- data/lib/aspera/products/connect.rb +1 -1
- data/lib/aspera/products/drive.rb +29 -0
- data/lib/aspera/products/hsts.rb +34 -0
- data/lib/aspera/products/transferd.rb +25 -3
- data/lib/aspera/products.rb +54 -0
- data/lib/aspera/prompt.rb +184 -0
- data/lib/aspera/proxy_auto_config.rb +3 -3
- data/lib/aspera/rest/aspera_errors.rb +4 -38
- data/lib/aspera/rest/error_analyzer.rb +6 -2
- data/lib/aspera/rest/list.rb +4 -5
- data/lib/aspera/schema/reader.rb +15 -0
- data/lib/aspera/schema/registry.rb +239 -45
- data/lib/aspera/schema/validator.rb +63 -17
- data/lib/aspera/sealed_hash.rb +4 -0
- data/lib/aspera/secret/hider.rb +159 -24
- data/lib/aspera/secret/reference.rb +8 -0
- data/lib/aspera/secret/resolver.rb +8 -4
- data/lib/aspera/secret/store/base.rb +10 -9
- data/lib/aspera/secret/store/encrypted_hash.rb +6 -6
- data/lib/aspera/secret/store/hashicorp_vault.rb +3 -3
- data/lib/aspera/secret/store/keeper.rb +2 -2
- data/lib/aspera/secret/store/macos_security.rb +2 -3
- data/lib/aspera/secret/store/one_password_api.rb +2 -2
- data/lib/aspera/secret/store/one_password_cli.rb +3 -3
- data/lib/aspera/secret/store/secret_service.rb +2 -2
- data/lib/aspera/ssl.rb +3 -3
- data/lib/aspera/standard_input.rb +20 -0
- data/lib/aspera/{schema → sync}/async_tables.yaml +1 -1
- data/lib/aspera/sync/database.rb +7 -0
- data/lib/aspera/sync/log_parser.rb +138 -0
- data/lib/aspera/sync/operations.rb +59 -34
- data/lib/aspera/transfer/command_line_builder.rb +248 -0
- data/lib/aspera/transfer/command_line_converter.rb +37 -0
- data/lib/aspera/transfer/faux_file.rb +2 -2
- data/lib/aspera/transfer/parameters.rb +9 -10
- data/lib/aspera/transfer/spec.rb +28 -1
- data/lib/aspera/transfer/spec.schema.yaml +30 -5
- data/lib/aspera/units/decimal.rb +1 -1
- data/lib/aspera/units/timestamp.rb +84 -0
- data/lib/aspera/uri_reader.rb +2 -2
- data/lib/aspera/web_auth/paste.rb +2 -2
- data/lib/aspera/web_server_simple.rb +10 -4
- data.tar.gz.sig +0 -0
- metadata +137 -80
- metadata.gz.sig +0 -0
- data/lib/aspera/agent/connect.rb +0 -188
- data/lib/aspera/agent/desktop.rb +0 -154
- data/lib/aspera/agent/direct.rb +0 -496
- data/lib/aspera/agent/httpgw.rb +0 -100
- data/lib/aspera/agent/node.rb +0 -166
- data/lib/aspera/agent/transferd.rb +0 -341
- data/lib/aspera/api/alee.rb +0 -19
- data/lib/aspera/api/aoc.rb +0 -776
- data/lib/aspera/api/ats.rb +0 -49
- data/lib/aspera/api/cos_node.rb +0 -107
- data/lib/aspera/api/faspex.rb +0 -258
- data/lib/aspera/api/httpgw.rb +0 -409
- data/lib/aspera/api/node.rb +0 -684
- data/lib/aspera/ascmd.rb +0 -248
- data/lib/aspera/cli/ascp_actions.rb +0 -113
- data/lib/aspera/cli/ascp_logs_actions.rb +0 -188
- data/lib/aspera/cli/async_transfer_store.rb +0 -129
- data/lib/aspera/cli/command_registry.rb +0 -371
- data/lib/aspera/cli/command_spec.rb +0 -273
- data/lib/aspera/cli/option_declarator.rb +0 -74
- data/lib/aspera/cli/option_registry.rb +0 -72
- data/lib/aspera/cli/option_types.rb +0 -120
- data/lib/aspera/cli/option_value.rb +0 -345
- data/lib/aspera/cli/prompt.rb +0 -186
- data/lib/aspera/cli/sync_actions.rb +0 -181
- data/lib/aspera/cli/transfer_actions.rb +0 -98
- data/lib/aspera/cli/transfer_agent.rb +0 -348
- data/lib/aspera/command_line_builder.rb +0 -244
- data/lib/aspera/command_line_converter.rb +0 -35
- data/lib/aspera/data_repository.rb +0 -69
- data/lib/aspera/faspex_gw.rb +0 -172
- data/lib/aspera/faspex_postproc.rb +0 -237
- data/lib/aspera/graphql.rb +0 -41
- data/lib/aspera/node_emulator.rb +0 -758
- data/lib/aspera/oauth/client/shares_web.rb +0 -94
- data/lib/aspera/orchestrator_workflow_checker.rb +0 -688
- data/lib/aspera/preview/file_types.rb +0 -119
- data/lib/aspera/preview/generator.rb +0 -345
- data/lib/aspera/preview/utils.rb +0 -211
- data/lib/aspera/products/other.rb +0 -92
- data/lib/aspera/products/transferd_service.rb +0 -610
- /data/lib/aspera/{data → ascp/data}/1 +0 -0
- /data/lib/aspera/{data → ascp/data}/2 +0 -0
- /data/lib/aspera/{data → ascp/data}/3 +0 -0
- /data/lib/aspera/{data → ascp/data}/4 +0 -0
- /data/lib/aspera/{data → ascp/data}/5 +0 -0
- /data/lib/aspera/{data → ascp/data}/6 +0 -0
- /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_account.graphql +0 -0
- /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_usage.graphql +0 -0
- /data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +0 -0
- /data/lib/aspera/{schema → plugins/console/schemas}/IBM Aspera Console-enhanced.yaml +0 -0
- /data/lib/aspera/{schema → plugins/node/schemas}/IBM Aspera Node API-4.4.6.yaml +0 -0
- /data/lib/aspera/{preview → plugins/preview}/image_error.png +0 -0
- /data/lib/aspera/{preview → plugins/preview}/video_error.png +0 -0
- /data/lib/aspera/{schema → plugins/shares/schemas}/IBM_Aspera_Shares.yaml +0 -0
- /data/lib/{transferd_pb.rb → aspera/plugins/transferd/grpc/transferd_pb.rb} +0 -0
- /data/lib/{transferd_services_pb.rb → aspera/plugins/transferd/grpc/transferd_services_pb.rb} +0 -0
- /data/lib/aspera/{schema → plugins/transferd/schemas}/transferd-config.schema.json +0 -0
|
@@ -3,46 +3,37 @@
|
|
|
3
3
|
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
6
|
-
require_relative '../ascp_actions'
|
|
7
|
-
require_relative '../ascp_logs_actions'
|
|
8
6
|
require_relative '../completion_actions'
|
|
9
7
|
require_relative '../deprecation'
|
|
10
8
|
require_relative '../error'
|
|
11
9
|
require_relative '../gem_checker'
|
|
12
10
|
require_relative '../http'
|
|
13
11
|
require_relative '../info'
|
|
14
|
-
require_relative '../
|
|
12
|
+
require_relative '../option/type'
|
|
15
13
|
require_relative '../parser'
|
|
16
14
|
require_relative '../preset_actions'
|
|
17
15
|
require_relative '../preset_manager'
|
|
18
|
-
require_relative '../prompt'
|
|
19
16
|
require_relative '../result'
|
|
20
17
|
require_relative '../security'
|
|
21
18
|
require_relative '../special_values'
|
|
22
|
-
require_relative '../sync_actions'
|
|
23
19
|
require_relative '../terminal_formatter'
|
|
24
|
-
require_relative '../transfer_actions'
|
|
25
20
|
require_relative '../vault_actions'
|
|
26
21
|
require_relative '../version'
|
|
27
22
|
require_relative '../wizard'
|
|
28
23
|
require_relative 'base'
|
|
29
24
|
require_relative 'factory'
|
|
30
|
-
require_relative 'transferd'
|
|
31
|
-
require_relative '../../agent/factory'
|
|
32
|
-
require_relative '../../ascp/installation'
|
|
33
25
|
require_relative '../../assert'
|
|
34
|
-
require_relative '../../
|
|
26
|
+
require_relative '../../bundle_registry'
|
|
35
27
|
require_relative '../../environment'
|
|
36
28
|
require_relative '../../hash_ext'
|
|
37
29
|
require_relative '../../log'
|
|
30
|
+
require_relative '../../uri_reader'
|
|
38
31
|
require_relative '../../oauth/client/factory'
|
|
39
32
|
require_relative '../../oauth/client/jwt'
|
|
33
|
+
require_relative '../../prompt'
|
|
40
34
|
require_relative '../../rest'
|
|
41
|
-
require_relative '../../schema/documentation'
|
|
42
35
|
require_relative '../../schema/registry'
|
|
43
36
|
require_relative '../../string_ext'
|
|
44
|
-
require_relative '../../sync/operations'
|
|
45
|
-
require_relative '../../transfer/spec'
|
|
46
37
|
require_relative '../../sealed_hash'
|
|
47
38
|
require_relative '../../web_auth/relay'
|
|
48
39
|
require 'openssl'
|
|
@@ -52,13 +43,9 @@ module Aspera
|
|
|
52
43
|
module Plugins
|
|
53
44
|
# Manage the CLI config file
|
|
54
45
|
class Config < Base
|
|
55
|
-
include SyncActions
|
|
56
46
|
include VaultActions
|
|
57
47
|
include GemChecker
|
|
58
|
-
include AscpActions
|
|
59
|
-
include AscpLogsActions
|
|
60
48
|
include PresetActions
|
|
61
|
-
include TransferActions
|
|
62
49
|
include CompletionActions
|
|
63
50
|
|
|
64
51
|
class << self
|
|
@@ -92,22 +79,7 @@ module Aspera
|
|
|
92
79
|
DEFAULT_CHECK_NEW_VERSION_DAYS = 7
|
|
93
80
|
# Last released version with `config transferd`, `config ascp install` and `config transfer` not deprecated
|
|
94
81
|
DEPRECATED_LAST = '4.28.0'
|
|
95
|
-
private_constant :DEFAULT_CHECK_NEW_VERSION_DAYS
|
|
96
|
-
|
|
97
|
-
option :preset, description: 'Load the named option preset from current config file', short: 'P', on_set: :load_preset, complete: :preset
|
|
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
|
|
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
|
|
103
|
-
option :smtp, schema: Schema::Registry::SMTP_OPTIONS
|
|
104
|
-
option :notify_to, description: 'Email: Recipient for notification of transfers'
|
|
105
|
-
option :notify_template, description: 'Email: ERB template for notification of transfers', security: :low
|
|
106
|
-
option :cache_tokens, description: 'Save and reuse OAuth tokens', allowed: Type::BOOLEAN, default: true
|
|
107
|
-
option :expand_mounts, description: 'Commands: list commands of sub-trees provided by another plugin', allowed: Type::BOOLEAN, default: false
|
|
108
|
-
option :no_default, description: 'Do not load default configuration for plugin', allowed: Type::NONE, short: 'N', on_set: -> { presets.use_plugin_defaults = false }
|
|
109
|
-
# `on_set` callbacks of HTTP options are methods of `http_config`
|
|
110
|
-
use_options Http, target: -> { http_config }
|
|
82
|
+
private_constant :DEFAULT_CHECK_NEW_VERSION_DAYS
|
|
111
83
|
|
|
112
84
|
def initialize(**_)
|
|
113
85
|
super
|
|
@@ -115,7 +87,8 @@ module Aspera
|
|
|
115
87
|
@wizard = Wizard.new(self, context.main_folder)
|
|
116
88
|
# Values set through `on_set` callbacks are used below (sdk_folder)
|
|
117
89
|
options.parse_options!
|
|
118
|
-
|
|
90
|
+
# Method of the module `AscpActions` mounted by bundle `xfer`: config still works if this mount failed (see `include_mounts`)
|
|
91
|
+
set_sdk_dir if respond_to?(:set_sdk_dir)
|
|
119
92
|
end
|
|
120
93
|
|
|
121
94
|
command :preset, description: 'Manage configuration presets'
|
|
@@ -124,25 +97,25 @@ module Aspera
|
|
|
124
97
|
command :overview, description: 'Show all options from all presets'
|
|
125
98
|
command :lookup, description: 'Find preset matching URL and username',
|
|
126
99
|
arguments: [{name: :criteria, type: Hash, schema: Schema::Registry::PRESET_LOOKUP_CRITERIA}]
|
|
127
|
-
command :secure, description: 'Move secrets to vault',
|
|
100
|
+
command :secure, description: 'Move secrets to vault', security: :low,
|
|
128
101
|
arguments: [{name: :config_name, mandatory: false, complete: :preset}]
|
|
129
102
|
command :show, description: 'Show a preset',
|
|
130
103
|
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
131
|
-
command :delete, description: 'Delete a preset',
|
|
104
|
+
command :delete, description: 'Delete a preset', security: :low,
|
|
132
105
|
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
133
106
|
command :get, description: 'Show a single parameter of a preset',
|
|
134
107
|
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:')})",
|
|
108
|
+
command :unset, description: "Remove a parameter from a preset (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use set <name> <param> @none:')})", security: :low,
|
|
136
109
|
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)',
|
|
110
|
+
command :set, description: 'Merge into presets: <Hash> of presets, <name> <Hash>, or <name> <param> <value> (@none: removes)', security: :low,
|
|
138
111
|
arguments: [{name: :name, type: [String, Hash], complete: :preset},
|
|
139
112
|
{name: :param_name, type: [String, Hash], mandatory: false, omit_absent: true, complete: :preset_parameter},
|
|
140
113
|
{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>')})",
|
|
114
|
+
command :initialize, description: "Initialize a preset with a value (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use delete, then set <name> <Hash>')})", security: :low,
|
|
142
115
|
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>')})",
|
|
116
|
+
command :update, description: "Update a preset with option values (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use set <name> <Hash>')})", security: :low,
|
|
144
117
|
arguments: [{name: :name, type: :identifier, complete: :preset}]
|
|
145
|
-
command :ask, description: 'Ask for option values interactively',
|
|
118
|
+
command :ask, description: 'Ask for option values interactively', security: :low,
|
|
146
119
|
arguments: [{name: :name, type: :identifier, complete: :preset},
|
|
147
120
|
{name: :option_names, multiple: true, interactive: true}]
|
|
148
121
|
end
|
|
@@ -169,7 +142,7 @@ module Aspera
|
|
|
169
142
|
command(
|
|
170
143
|
:genkey, description: 'Generate a new RSA private key',
|
|
171
144
|
arguments: [
|
|
172
|
-
{name: :private_key_path, complete: :file},
|
|
145
|
+
{name: :private_key_path, complete: :file, access: :write},
|
|
173
146
|
{name: :private_key_length, type: Integer, mandatory: false, default: OAuth::Jwt::DEFAULT_PRIV_KEY_LENGTH}
|
|
174
147
|
],
|
|
175
148
|
action: lambda do |private_key_path:, private_key_length: OAuth::Jwt::DEFAULT_PRIV_KEY_LENGTH, **|
|
|
@@ -187,7 +160,7 @@ module Aspera
|
|
|
187
160
|
command :download, description: 'Download a file from a URL',
|
|
188
161
|
arguments: [
|
|
189
162
|
{name: :file_url},
|
|
190
|
-
{name: :file_dest, mandatory: false, complete: :file}
|
|
163
|
+
{name: :file_dest, mandatory: false, complete: :file, access: :write}
|
|
191
164
|
]
|
|
192
165
|
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
166
|
security: :low,
|
|
@@ -202,7 +175,7 @@ module Aspera
|
|
|
202
175
|
end
|
|
203
176
|
)
|
|
204
177
|
command(
|
|
205
|
-
:wizard, description: 'Run the setup wizard for an Aspera product (interactive)',
|
|
178
|
+
:wizard, description: 'Run the setup wizard for an Aspera product (interactive)', security: :low,
|
|
206
179
|
arguments: [{name: :params, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::WIZARD_OPTIONS}],
|
|
207
180
|
action: lambda do |params:, **|
|
|
208
181
|
apps = @wizard.identify_plugins_for_url(url: ask_url(params), plugin_name: params['plugin']).freeze
|
|
@@ -219,10 +192,15 @@ module Aspera
|
|
|
219
192
|
end
|
|
220
193
|
)
|
|
221
194
|
command :coffee, description: 'Show a coffee image', action: ->(**) { Result::Image.new(COFFEE_IMAGE_URL) }
|
|
222
|
-
command
|
|
195
|
+
command(
|
|
196
|
+
:image, description: 'Show an image',
|
|
223
197
|
arguments: [{name: :image_uri, type: nil}],
|
|
224
|
-
|
|
225
|
-
|
|
198
|
+
# A `file:` URL reads a local file chosen by the client: checked against the security level (refused at `high`), like `access: :read`.
|
|
199
|
+
action: lambda do |image_uri:, **|
|
|
200
|
+
image_uri = UriReader.file_url(Security.instance.readable_path(UriReader.file_path(image_uri))) if image_uri.is_a?(String) && UriReader.file?(image_uri)
|
|
201
|
+
Result::Image.new(image_uri)
|
|
202
|
+
end
|
|
203
|
+
)
|
|
226
204
|
command :gem, description: 'Show gem information'
|
|
227
205
|
command :folder, description: 'Show the configuration folder path', action: ->(**) { Result::Text.new(context.main_folder) }
|
|
228
206
|
command :file, description: 'Show the configuration file path', action: ->(**) { Result::Text.new(context.presets.config_file) }
|
|
@@ -243,7 +221,7 @@ module Aspera
|
|
|
243
221
|
end
|
|
244
222
|
)
|
|
245
223
|
command :check_update, description: 'Check if a newer version of the gem is available', action: ->(**) { Result::SingleObject.new(check_gem_version) }
|
|
246
|
-
command :initdemo, description: 'Initialize the demo server preset'
|
|
224
|
+
command :initdemo, description: 'Initialize the demo server preset', security: :low
|
|
247
225
|
command :vault, description: 'Manage secrets in the vault'
|
|
248
226
|
commands_under :vault do
|
|
249
227
|
command :info, description: 'Show vault information',
|
|
@@ -271,25 +249,25 @@ module Aspera
|
|
|
271
249
|
end
|
|
272
250
|
)
|
|
273
251
|
command(
|
|
274
|
-
:create, description: 'Add a new secret to the vault',
|
|
252
|
+
:create, description: 'Add a new secret to the vault', security: :low,
|
|
275
253
|
arguments: [{name: :secret, type: Hash, schema: Schema::Registry::VAULT_SECRET}],
|
|
276
254
|
action: lambda do |secret:, **|
|
|
277
255
|
vault_required.set(secret.symbolize_keys)
|
|
278
256
|
Result::Status.new('Secret added')
|
|
279
257
|
end
|
|
280
258
|
)
|
|
281
|
-
command :delete, description: 'Delete a secret by label (or id)',
|
|
259
|
+
command :delete, description: 'Delete a secret by label (or id)', security: :low,
|
|
282
260
|
arguments: [{name: :label}, {name: :id, mandatory: false, default: nil}]
|
|
283
261
|
command(
|
|
284
|
-
:password, description: 'Set a new password for the vault',
|
|
262
|
+
:password, description: 'Set a new password for the vault', security: :low,
|
|
285
263
|
arguments: [{name: :new_password}],
|
|
286
264
|
action: lambda do |new_password:, **|
|
|
287
|
-
Aspera.assert(vault_required.respond_to?(:change_password), 'Vault does not support password change')
|
|
265
|
+
Aspera.assert(vault_required.respond_to?(:change_password), 'Vault does not support password change', type: Cli::BadArgument)
|
|
288
266
|
vault_required.change_password(new_password)
|
|
289
267
|
Result::Status.new('Vault password updated')
|
|
290
268
|
end
|
|
291
269
|
)
|
|
292
|
-
command :import, description: 'Import secrets from a JSON array (supports --bulk)',
|
|
270
|
+
command :import, description: 'Import secrets from a JSON array (supports --bulk)', security: :low,
|
|
293
271
|
arguments: [{name: :secrets, type: Array, schema: {type: 'array', items: {'$ref' => Schema::Registry::VAULT_SECRET}}}]
|
|
294
272
|
command :check, description: 'Check that a reference to a store of option vault can be read, without its value',
|
|
295
273
|
arguments: [{name: :reference, evaluate: :none}]
|
|
@@ -310,7 +288,7 @@ module Aspera
|
|
|
310
288
|
arguments: [{name: :remote_url}],
|
|
311
289
|
action: lambda do |remote_url:, **|
|
|
312
290
|
remote_chain = Rest.remote_certificate_chain(remote_url, as_string: false)
|
|
313
|
-
Aspera.assert(remote_chain&.first) { "No certificate found for #{remote_url}" }
|
|
291
|
+
Aspera.assert(remote_chain&.first, type: Cli::Error) { "No certificate found for #{remote_url}" }
|
|
314
292
|
Result::Text.new(remote_chain.map(&:to_pem).join("\n"))
|
|
315
293
|
end
|
|
316
294
|
)
|
|
@@ -319,7 +297,7 @@ module Aspera
|
|
|
319
297
|
arguments: [{name: :remote_url}],
|
|
320
298
|
action: lambda do |remote_url:, **|
|
|
321
299
|
remote_chain = Rest.remote_certificate_chain(remote_url, as_string: false)
|
|
322
|
-
Aspera.assert(remote_chain&.first) { "No certificate found for #{remote_url}" }
|
|
300
|
+
Aspera.assert(remote_chain&.first, type: Cli::Error) { "No certificate found for #{remote_url}" }
|
|
323
301
|
Result::Text.new(remote_chain.first.to_pem)
|
|
324
302
|
end
|
|
325
303
|
)
|
|
@@ -328,7 +306,7 @@ module Aspera
|
|
|
328
306
|
arguments: [{name: :remote_url}],
|
|
329
307
|
action: lambda do |remote_url:, **|
|
|
330
308
|
remote_chain = Rest.remote_certificate_chain(remote_url, as_string: false)
|
|
331
|
-
Aspera.assert(remote_chain&.first) { "No certificate found for #{remote_url}" }
|
|
309
|
+
Aspera.assert(remote_chain&.first, type: Cli::Error) { "No certificate found for #{remote_url}" }
|
|
332
310
|
Result::Text.new(remote_chain.first.subject.to_a.find { |name, _, _| name == 'CN' }[1])
|
|
333
311
|
end
|
|
334
312
|
)
|
|
@@ -354,89 +332,33 @@ module Aspera
|
|
|
354
332
|
|
|
355
333
|
# plugins sub-commands
|
|
356
334
|
commands_under :plugins do
|
|
357
|
-
command :list, description: 'List all
|
|
335
|
+
command :list, description: 'List all plugins, with their status'
|
|
336
|
+
command :show, description: 'Show the details of a plugin: source, form, capabilities, dependencies, gems, security level',
|
|
337
|
+
arguments: [{name: :name}]
|
|
358
338
|
command :create, description: 'Create a new plugin skeleton file', security: :low,
|
|
359
339
|
arguments: [
|
|
360
340
|
{name: :name},
|
|
361
|
-
{name: :folder, mandatory: false, complete: :folder}
|
|
341
|
+
{name: :folder, mandatory: false, complete: :folder, access: :write}
|
|
362
342
|
]
|
|
363
343
|
end
|
|
364
344
|
|
|
365
|
-
# ascp
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
command :show, description: 'Show ascp binary path', action: ->(**) { Result::Text.new(Ascp::Installation.instance.path(:ascp)) }
|
|
369
|
-
command :info, description: 'Show ascp and transfer spec information'
|
|
370
|
-
command :install, description: "Install the transfer SDK (#{Deprecation.new(last: DEPRECATED_LAST, message: 'use transferd install')})",
|
|
371
|
-
arguments: [{name: :version, mandatory: false, default: nil}],
|
|
372
|
-
action: ->(version: nil, **) { transferd_plugin(command: 'config ascp install', replacement: 'transferd install').action_install(version: version) }
|
|
373
|
-
command(
|
|
374
|
-
:spec, description: 'Show the transfer spec schema',
|
|
375
|
-
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys + [Transfer::Spec::DOC_OVERVIEW], mandatory: false, default: nil}],
|
|
376
|
-
action: lambda do |agent_name: nil, **|
|
|
377
|
-
builder = Schema::Documentation.new(TerminalFormatter, Transfer::Spec::SCHEMA, **Transfer::Spec.doc_options(agent_name)).build
|
|
378
|
-
Result::ObjectList.new(builder.rows, fields: builder.columns)
|
|
379
|
-
end
|
|
380
|
-
)
|
|
381
|
-
command :schema, description: 'Show the transfer spec JSON schema',
|
|
382
|
-
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys, mandatory: false, default: nil}]
|
|
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
|
|
389
|
-
command :products, description: 'Manage installed Aspera products'
|
|
390
|
-
commands_under :products do
|
|
391
|
-
command :list, description: 'List installed Aspera products',
|
|
392
|
-
action: ->(**) { Result::ObjectList.new(Ascp::Installation.instance.installed_products, fields: %w[name app_root]) }
|
|
393
|
-
end
|
|
394
|
-
end
|
|
395
|
-
|
|
396
|
-
# agents sub-commands
|
|
397
|
-
command :agents, description: 'Manage transfer agents'
|
|
398
|
-
commands_under :agents do
|
|
399
|
-
command :list, description: 'List all transfer agents'
|
|
400
|
-
command :show, description: 'Show details for a transfer agent',
|
|
401
|
-
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys}]
|
|
402
|
-
command :parameters, description: 'Show configurable parameters for a transfer agent',
|
|
403
|
-
arguments: [{name: :agent_name, allowed: Agent::Factory::ALL.keys}]
|
|
404
|
-
end
|
|
345
|
+
# Commands of the modules that bundles mount on config (manifest `mounts`), here: bundle `xfer` adds `ascp`, `agents`, `transfer`, and `sync` (before `gem`),
|
|
346
|
+
# then bundle `transferd` adds the deprecated `transferd`
|
|
347
|
+
include_mounts
|
|
405
348
|
|
|
406
|
-
#
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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}
|
|
421
|
-
|
|
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]}
|
|
425
|
-
|
|
426
|
-
# sync sub-commands
|
|
427
|
-
commands_under :sync do
|
|
428
|
-
command(
|
|
429
|
-
:spec, description: 'Show the sync configuration schema',
|
|
430
|
-
action: lambda do |**|
|
|
431
|
-
builder = Schema::Documentation.new(TerminalFormatter, Sync::Operations::CONF_SCHEMA, annotate: CommandLineBuilder.method(:doc_lines)).build
|
|
432
|
-
Result::ObjectList.new(builder.rows, fields: builder.columns)
|
|
433
|
-
end
|
|
434
|
-
)
|
|
435
|
-
sync_admin_commands :admin
|
|
436
|
-
command :translate, description: 'Translate async-style arguments to sync config format',
|
|
437
|
-
arguments: [{name: :async_arguments, multiple: true}],
|
|
438
|
-
action: ->(async_arguments:, **) { Result::SingleObject.new(Sync::Operations.args_to_conf(async_arguments)) }
|
|
439
|
-
end
|
|
349
|
+
# Options of config come after the options of the mounted modules (`sql`, `ascp_logs`): same order as when config included them.
|
|
350
|
+
# Mounted modules may place theirs before an option of config (`option ..., before:`).
|
|
351
|
+
option :preset, description: 'Load the named option preset from current config file', short: 'P', on_set: :load_preset, complete: :preset
|
|
352
|
+
option :version_check_days, description: 'Period in days to check new version (zero to disable)', allowed: Option::Type::INTEGER, default: DEFAULT_CHECK_NEW_VERSION_DAYS
|
|
353
|
+
option :plugin_folder, description: "Folders where to find additional plugins (#{SpecialValues::DEF}: folder plugins of the configuration folder)", allowed: Option::Type::STRING_ARRAY, default: [SpecialValues::DEF], complete: :folder, security: :low
|
|
354
|
+
option :smtp, schema: Schema::Registry::SMTP_OPTIONS
|
|
355
|
+
option :notify_to, description: 'Email: Recipient for notification of transfers'
|
|
356
|
+
option :notify_template, description: 'Email: ERB template for notification of transfers', security: :low
|
|
357
|
+
option :cache_tokens, description: 'Save and reuse OAuth tokens', allowed: Option::Type::BOOLEAN, default: true
|
|
358
|
+
option :expand_mounts, description: 'Commands: list commands of sub-trees provided by another plugin', allowed: Option::Type::BOOLEAN, default: false
|
|
359
|
+
option :no_default, description: 'Do not load default configuration for plugin', allowed: Option::Type::NONE, short: 'N', on_set: -> { presets.use_plugin_defaults = false }
|
|
360
|
+
# `on_set` callbacks of HTTP options are methods of `http_config`
|
|
361
|
+
use_options Http, target: -> { http_config }
|
|
440
362
|
|
|
441
363
|
# gem sub-commands
|
|
442
364
|
commands_under :gem do
|
|
@@ -476,12 +398,17 @@ module Aspera
|
|
|
476
398
|
|
|
477
399
|
attr_reader :gem_url
|
|
478
400
|
|
|
479
|
-
#
|
|
480
|
-
#
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
401
|
+
# Add the folders of option `plugin_folder` to the plugin lookup: `DEF` is the folder `plugins` of the configuration folder.
|
|
402
|
+
# Called once options are final, before plugins are looked up: the last folder has priority.
|
|
403
|
+
# @return [nil]
|
|
404
|
+
def add_plugin_lookup_folders
|
|
405
|
+
home_plugins = File.join(context.main_folder, ASPERA_PLUGINS_FOLDERNAME)
|
|
406
|
+
folders = options.get_option(:plugin_folder)
|
|
407
|
+
# Before 4.30, this folder was always used: plugins there would silently stop working
|
|
408
|
+
unused_home = !folders.include?(SpecialValues::DEF) && Dir.glob(["*#{Environment::RB_EXT}", "*/#{BundleRegistry::MANIFEST}"], base: home_plugins).any?
|
|
409
|
+
Log.log.warn { "Plugins of #{home_plugins} are not used: add #{SpecialValues::DEF} to option plugin_folder" } if unused_home
|
|
410
|
+
folders.each { |f| Plugins::Factory.instance.add_lookup_folder(f.eql?(SpecialValues::DEF) ? home_plugins : f, security: :low) }
|
|
411
|
+
nil
|
|
485
412
|
end
|
|
486
413
|
|
|
487
414
|
# `on_set` callback of option `preset`
|
|
@@ -491,7 +418,7 @@ module Aspera
|
|
|
491
418
|
when Hash
|
|
492
419
|
options.add_option_preset(value, 'set')
|
|
493
420
|
when String
|
|
494
|
-
options.add_option_preset(presets.by_name(value), 'set_by_name')
|
|
421
|
+
options.add_option_preset(presets.by_name(value), 'set_by_name', configured: true)
|
|
495
422
|
else
|
|
496
423
|
raise BadArgument, 'Preset definition must be a String for preset name, or Hash for set of values'
|
|
497
424
|
end
|
|
@@ -506,21 +433,6 @@ module Aspera
|
|
|
506
433
|
params['url'] || options.with_interactive { options.get_interactive('url') }
|
|
507
434
|
end
|
|
508
435
|
|
|
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
|
-
|
|
524
436
|
def action_documentation(location: :github, section: nil, **)
|
|
525
437
|
case location
|
|
526
438
|
when :github
|
|
@@ -584,7 +496,8 @@ module Aspera
|
|
|
584
496
|
|
|
585
497
|
def action_download(file_url:, file_dest: nil, **)
|
|
586
498
|
file_url = file_url.chomp
|
|
587
|
-
|
|
499
|
+
# Default: destination folder of downloads of the service `transfer` (option `to_folder`)
|
|
500
|
+
file_dest = File.join(transfer.destination_folder(:receive), file_url.rpartition('/').last) if file_dest.nil?
|
|
588
501
|
file_dest = Security.instance.writable_path(file_dest)
|
|
589
502
|
Log.log.info("Downloading: #{file_url}")
|
|
590
503
|
Rest::Client.new(base_url: file_url).call(operation: 'GET', save_to: file_dest)
|
|
@@ -598,16 +511,32 @@ module Aspera
|
|
|
598
511
|
end
|
|
599
512
|
|
|
600
513
|
def action_plugins_list(**)
|
|
601
|
-
|
|
602
|
-
|
|
514
|
+
factory = Plugins::Factory.instance
|
|
515
|
+
result = factory.listed_plugins.map do |name|
|
|
516
|
+
status = factory.status(name)
|
|
517
|
+
loaded =
|
|
518
|
+
if status.eql?('available')
|
|
519
|
+
begin
|
|
520
|
+
factory.plugin_class(name)
|
|
521
|
+
rescue Cli::Error => e
|
|
522
|
+
# Broken code: the reason replaces the status
|
|
523
|
+
status = e.message
|
|
524
|
+
nil
|
|
525
|
+
end
|
|
526
|
+
end
|
|
603
527
|
{
|
|
604
528
|
plugin: name,
|
|
605
|
-
detect: TerminalFormatter.tick(
|
|
606
|
-
wizard: TerminalFormatter.tick(
|
|
607
|
-
|
|
529
|
+
detect: loaded.nil? ? nil : TerminalFormatter.tick(loaded.respond_to?(:detect)),
|
|
530
|
+
wizard: loaded.nil? ? nil : TerminalFormatter.tick(loaded.method_defined?(:wizard)),
|
|
531
|
+
status: status,
|
|
532
|
+
path: factory.registry[name].path
|
|
608
533
|
}
|
|
609
534
|
end
|
|
610
|
-
Result::ObjectList.new(result, fields: %w[plugin detect wizard path])
|
|
535
|
+
Result::ObjectList.new(result, fields: %w[plugin detect wizard status path])
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
def action_plugins_show(name:, **)
|
|
539
|
+
Result::SingleObject.new(Plugins::Factory.instance.describe(name.to_sym))
|
|
611
540
|
end
|
|
612
541
|
|
|
613
542
|
def action_plugins_create(name:, folder: nil, **)
|
|
@@ -668,7 +597,14 @@ module Aspera
|
|
|
668
597
|
Aspera.assert(words.empty? || plugin_names.length.eql?(1), type: Cli::BadArgument) { 'command path requires a plugin name' }
|
|
669
598
|
expand_mounts = options.get_option(:expand_mounts)
|
|
670
599
|
commands = plugin_names.flat_map do |name|
|
|
671
|
-
|
|
600
|
+
begin
|
|
601
|
+
reg = Plugins::Factory.instance.plugin_class(name).command_registry
|
|
602
|
+
rescue Cli::Error => e
|
|
603
|
+
# Named plugin: the error; else the plugin is left out
|
|
604
|
+
raise if plugin_name
|
|
605
|
+
Log.log.warn(e.message)
|
|
606
|
+
next []
|
|
607
|
+
end
|
|
672
608
|
prefix = listed_command_path(name, reg, words)
|
|
673
609
|
paths = prefix.empty? || reg.children_of(prefix).any? ? reg.leaf_paths(prefix, expand_mounts: expand_mounts) : [prefix]
|
|
674
610
|
# Commands refused by security level are not proposed
|
|
@@ -677,7 +613,7 @@ module Aspera
|
|
|
677
613
|
mount = expand_mounts ? nil : reg.mount_at(path)
|
|
678
614
|
description = reg[path]&.description.to_s
|
|
679
615
|
if mount
|
|
680
|
-
target = mount.plugin.
|
|
616
|
+
target = mount.plugin.plugin_name
|
|
681
617
|
description = "#{description} (see: #{command_syntax(target, mount.registry, mount.at)})"
|
|
682
618
|
end
|
|
683
619
|
{
|
|
@@ -692,7 +628,7 @@ module Aspera
|
|
|
692
628
|
# Command path to list, from words that may include positional arguments, as on a command line.
|
|
693
629
|
# e.g. `faspex5 packages receive ALL` lists `faspex5 packages receive`.
|
|
694
630
|
# @param name [Symbol] plugin name
|
|
695
|
-
# @param reg [
|
|
631
|
+
# @param reg [Command::Registry] registry of plugin
|
|
696
632
|
# @param words [Array<Symbol>] sub-commands (or aliases), possibly mixed with their arguments
|
|
697
633
|
# @return [Array<Symbol>] command path
|
|
698
634
|
# @raise [Cli::BadArgument] if a word is neither a sub-command nor an expected argument
|
|
@@ -704,7 +640,7 @@ module Aspera
|
|
|
704
640
|
|
|
705
641
|
# Build syntax by interleaving each path segment with the arguments declared on that node
|
|
706
642
|
# @param name [String, Symbol] plugin name
|
|
707
|
-
# @param reg [
|
|
643
|
+
# @param reg [Command::Registry] registry of plugin
|
|
708
644
|
# @param path [Array<Symbol>] command path
|
|
709
645
|
# @return [String] e.g. `node access_keys do <access_key_id> ls <path>`
|
|
710
646
|
def command_syntax(name, reg, path)
|
|
@@ -742,7 +678,6 @@ module Aspera
|
|
|
742
678
|
PERSISTENCY_FOLDER = 'persist_store'
|
|
743
679
|
# Persistency identifier of the hosts of login pages that the user accepted for `web_login`
|
|
744
680
|
WEB_LOGIN_HOSTS_ID = 'web_login_hosts'
|
|
745
|
-
FILE_LIST_FOLDER_NAME = 'filelists'
|
|
746
681
|
REST_EXCEPTIONS_LOG_FILENAME = 'rest_exceptions.log'
|
|
747
682
|
ASPERA = 'aspera'
|
|
748
683
|
SERVER_COMMAND = 'server'
|
|
@@ -767,7 +702,6 @@ module Aspera
|
|
|
767
702
|
:ASPERA_PLUGINS_FOLDERNAME,
|
|
768
703
|
:PERSISTENCY_FOLDER,
|
|
769
704
|
:WEB_LOGIN_HOSTS_ID,
|
|
770
|
-
:FILE_LIST_FOLDER_NAME,
|
|
771
705
|
:REST_EXCEPTIONS_LOG_FILENAME,
|
|
772
706
|
:ASPERA,
|
|
773
707
|
:SERVER_COMMAND,
|