dtk-client 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile +1 -3
- data/README.md +2 -121
- data/Rakefile +44 -0
- data/bin/dtk +10 -88
- data/dtk-client.gemspec +21 -44
- data/examples/simple/dtk.module.yaml +32 -0
- data/{lib/git-logs/git.log → examples/simple/test/README.md} +0 -0
- data/examples/spark/dtk.module.yaml +120 -0
- data/examples/with_repo_content/deploy/puppet/manifests/hostname.pp +54 -0
- data/examples/with_repo_content/dtk.module.yaml +49 -0
- data/examples/with_repo_content/test/README.txt +0 -0
- data/features/dtk.feature +8 -0
- data/features/step_definitions/dtk_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/cli/command/mixin.rb +101 -0
- data/lib/cli/command/module/clone.rb +42 -0
- data/lib/cli/command/module/install.rb +52 -0
- data/lib/cli/command/module/list.rb +31 -0
- data/lib/cli/command/module/list_assemblies.rb +39 -0
- data/lib/cli/command/module/push.rb +34 -0
- data/lib/cli/command/module/uninstall.rb +46 -0
- data/lib/cli/command/module.rb +33 -0
- data/lib/cli/command/options.rb +33 -0
- data/lib/cli/command/service/cancel_task.rb +33 -0
- data/lib/cli/command/service/converge.rb +37 -0
- data/lib/{parser/adapters/thor/common_option_defs.rb → cli/command/service/create_workspace.rb} +13 -17
- data/lib/cli/command/service/destroy.rb +47 -0
- data/lib/cli/command/service/edit.rb +47 -0
- data/lib/cli/command/service/exec.rb +42 -0
- data/lib/cli/command/service/exec_sync.rb +53 -0
- data/lib/cli/command/service/list.rb +30 -0
- data/lib/cli/command/service/list_actions.rb +39 -0
- data/lib/cli/command/service/list_attributes.rb +44 -0
- data/lib/cli/command/service/list_component_links.rb +33 -0
- data/lib/cli/command/service/list_components.rb +39 -0
- data/lib/cli/command/service/list_dependent_modules.rb +33 -0
- data/lib/cli/command/service/list_nodes.rb +33 -0
- data/lib/cli/command/service/list_violations.rb +33 -0
- data/lib/cli/command/service/pull.rb +32 -0
- data/lib/cli/command/service/push.rb +37 -0
- data/lib/{shell/parse_monkey_patch.rb → cli/command/service/set_default_target.rb} +9 -17
- data/lib/cli/command/service/set_required_attributes.rb +32 -0
- data/lib/cli/command/service/ssh.rb +42 -0
- data/lib/cli/command/service/stage.rb +55 -0
- data/lib/cli/command/service/start.rb +33 -0
- data/lib/{shell/context_aux.rb → cli/command/service/stop.rb} +10 -23
- data/lib/cli/command/service/task_status.rb +39 -0
- data/lib/cli/command/service.rb +55 -0
- data/lib/{commands.rb → cli/command/subcommand.rb} +22 -25
- data/lib/{bundler_monkey_patch.rb → cli/command/token/arg.rb} +6 -6
- data/lib/cli/command/token/class_mixin.rb +96 -0
- data/lib/cli/command/token/flag.rb +42 -0
- data/lib/{execute/command/rest_call.rb → cli/command/token/mixin.rb} +23 -14
- data/lib/cli/command/token/switch.rb +35 -0
- data/lib/cli/command/token.rb +76 -0
- data/lib/cli/command.rb +46 -0
- data/lib/cli/context/attributes.rb +50 -0
- data/lib/cli/context/type/module.rb +34 -0
- data/lib/{commands/thor/state_change.rb → cli/context/type/service.rb} +11 -5
- data/lib/cli/context/type/top.rb +32 -0
- data/lib/cli/context/type.rb +42 -0
- data/lib/cli/context.rb +174 -0
- data/lib/cli/directory_parser/file_system.rb +105 -0
- data/lib/{execute/command.rb → cli/directory_parser.rb} +14 -17
- data/lib/{execute.rb → cli/file_obj.rb} +13 -9
- data/lib/cli/processor/plugin/gli.rb +70 -0
- data/lib/cli/processor.rb +60 -0
- data/lib/cli/runner/dtkn_access.rb +75 -0
- data/lib/cli/runner.rb +58 -0
- data/lib/cli/version.rb +8 -0
- data/lib/{config → client/config}/cacert.pem +0 -0
- data/lib/client/config/default.conf +20 -0
- data/lib/client/config.rb +106 -0
- data/lib/client/configurator.rb +182 -0
- data/lib/client/conn.rb +197 -0
- data/lib/client/content_generator.rb +127 -0
- data/lib/client/error/subclasses.rb +105 -0
- data/lib/client/error.rb +98 -0
- data/lib/client/git_repo/adapter/git_gem/error_handler.rb +70 -0
- data/lib/client/git_repo/adapter/git_gem.rb +179 -0
- data/lib/client/git_repo.rb +122 -0
- data/lib/client/logger.rb +136 -0
- data/lib/client/operation/account.rb +66 -0
- data/lib/client/operation/client_module_dir/git_repo.rb +286 -0
- data/lib/client/operation/client_module_dir.rb +138 -0
- data/lib/client/operation/module/clone_module.rb +52 -0
- data/lib/client/operation/module/install/common_module.rb +58 -0
- data/lib/client/operation/module/install/external_module.rb +122 -0
- data/lib/client/operation/module/install.rb +91 -0
- data/lib/client/operation/module/install_from_catalog.rb +76 -0
- data/lib/client/operation/module/list.rb +34 -0
- data/lib/client/operation/module/list_assemblies.rb +35 -0
- data/lib/client/operation/module/push.rb +62 -0
- data/lib/client/operation/module/uninstall.rb +44 -0
- data/lib/client/operation/module.rb +58 -0
- data/lib/{commands/common/thor/reparse.rb → client/operation/module_service_common.rb} +27 -16
- data/lib/client/operation/service/cancel_task.rb +29 -0
- data/lib/client/operation/service/commit_and_push.rb +128 -0
- data/lib/client/operation/service/converge.rb +50 -0
- data/lib/{util/common_util.rb → client/operation/service/create_workspace.rb} +13 -13
- data/lib/client/operation/service/destroy.rb +42 -0
- data/lib/client/operation/service/edit.rb +54 -0
- data/lib/client/operation/service/exec.rb +73 -0
- data/lib/client/operation/service/list.rb +32 -0
- data/lib/client/operation/service/list_actions.rb +34 -0
- data/lib/{commands/thor/dependency.rb → client/operation/service/list_attributes.rb} +16 -12
- data/lib/client/operation/service/list_component_links.rb +29 -0
- data/lib/{commands/common/thor/pull_clone_changes.rb → client/operation/service/list_components.rb} +13 -7
- data/lib/client/operation/service/list_dependent_modules.rb +29 -0
- data/lib/client/operation/service/list_nodes.rb +29 -0
- data/lib/{commands/thor/project.rb → client/operation/service/list_violations.rb} +8 -13
- data/lib/client/operation/service/pull.rb +37 -0
- data/lib/client/operation/service/set_default_target.rb +31 -0
- data/lib/client/operation/service/set_required_attributes.rb +41 -0
- data/lib/client/operation/service/ssh.rb +118 -0
- data/lib/client/operation/service/stage.rb +54 -0
- data/lib/client/operation/service/start.rb +29 -0
- data/lib/client/operation/service/stop.rb +30 -0
- data/lib/{task_status → client/operation/service/task_status}/refresh_mode.rb +15 -25
- data/lib/{task_status → client/operation/service/task_status}/snapshot_mode.rb +4 -5
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/format.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/action.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/components.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/node_level.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result.rb +4 -4
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/action.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/components.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/node_level.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps.rb +4 -4
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task.rb +3 -3
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/no_results.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/render.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage/render.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage.rb +3 -3
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_end.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_start.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element.rb +13 -13
- data/lib/{task_status → client/operation/service/task_status}/stream_mode.rb +5 -9
- data/lib/client/operation/service/task_status.rb +77 -0
- data/lib/client/operation/service.rb +54 -0
- data/lib/client/operation.rb +67 -0
- data/lib/client/operation_args.rb +40 -0
- data/lib/{execute/execute_context/result_store.rb → client/render/view/simple.rb} +15 -14
- data/lib/client/render/view/table/processor.rb +248 -0
- data/lib/client/render/view/table.rb +75 -0
- data/lib/client/render.rb +113 -0
- data/lib/client/response/error_handler.rb +97 -0
- data/lib/client/response/render_helper.rb +78 -0
- data/lib/client/response/subclasses.rb +62 -0
- data/lib/client/response.rb +83 -0
- data/lib/client/session.rb +62 -0
- data/lib/client/util/auxiliary.rb +34 -0
- data/lib/client/util/console.rb +81 -0
- data/lib/client/util/disk_cacher.rb +66 -0
- data/lib/client/util/dtk_path.rb +28 -0
- data/lib/{search_hash.rb → client/util/hash_with_optional_keys.rb} +29 -21
- data/lib/client/util/interactive_wizard.rb +84 -0
- data/lib/client/util/module_ref.rb +92 -0
- data/lib/client/util/os_util/print.rb +121 -0
- data/lib/client/util/os_util.rb +122 -0
- data/lib/{commands/thor/utils.rb → client/util/post_body.rb} +1 -1
- data/lib/{execute/error_usage.rb → client/util/query_string_hash.rb} +2 -2
- data/lib/client/util/remote_dependency.rb +67 -0
- data/lib/client/util/ssh_util.rb +89 -0
- data/lib/client/util/validation.rb +28 -0
- data/lib/client/util.rb +18 -0
- data/lib/{util/permission_util.rb → dtk_cli.rb} +10 -9
- data/lib/dtk_client.rb +18 -14
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +196 -307
- data/Gemfile_dev +0 -13
- data/bin/dtk-execute +0 -32
- data/bin/dtk-shell +0 -31
- data/lib/auxiliary.rb +0 -61
- data/lib/client.rb +0 -58
- data/lib/command_helper.rb +0 -33
- data/lib/command_helpers/git_repo/merge.rb +0 -153
- data/lib/command_helpers/git_repo.rb +0 -589
- data/lib/command_helpers/jenkins_client/config_xml.rb +0 -288
- data/lib/command_helpers/jenkins_client.rb +0 -106
- data/lib/command_helpers/service_importer.rb +0 -251
- data/lib/command_helpers/service_link.rb +0 -33
- data/lib/command_helpers/test_module_creator.rb +0 -69
- data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +0 -10
- data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +0 -10
- data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +0 -5
- data/lib/commands/common/thor/access_control.rb +0 -133
- data/lib/commands/common/thor/action_result_handler.rb +0 -74
- data/lib/commands/common/thor/assembly_template.rb +0 -92
- data/lib/commands/common/thor/assembly_workspace.rb +0 -1638
- data/lib/commands/common/thor/base_command_helper.rb +0 -59
- data/lib/commands/common/thor/clone.rb +0 -82
- data/lib/commands/common/thor/common.rb +0 -88
- data/lib/commands/common/thor/common_base.rb +0 -49
- data/lib/commands/common/thor/create_target.rb +0 -70
- data/lib/commands/common/thor/edit.rb +0 -255
- data/lib/commands/common/thor/inventory_parser.rb +0 -98
- data/lib/commands/common/thor/list_diffs.rb +0 -128
- data/lib/commands/common/thor/module/import.rb +0 -215
- data/lib/commands/common/thor/module.rb +0 -1011
- data/lib/commands/common/thor/node.rb +0 -53
- data/lib/commands/common/thor/poller.rb +0 -65
- data/lib/commands/common/thor/pull_from_remote.rb +0 -152
- data/lib/commands/common/thor/puppet_forge.rb +0 -72
- data/lib/commands/common/thor/purge_clone.rb +0 -101
- data/lib/commands/common/thor/push_clone_changes.rb +0 -162
- data/lib/commands/common/thor/push_to_remote.rb +0 -94
- data/lib/commands/common/thor/remotes.rb +0 -71
- data/lib/commands/common/thor/set_required_attributes.rb +0 -46
- data/lib/commands/thor/account.rb +0 -239
- data/lib/commands/thor/assembly.rb +0 -361
- data/lib/commands/thor/attribute.rb +0 -79
- data/lib/commands/thor/component.rb +0 -70
- data/lib/commands/thor/component_module.rb +0 -501
- data/lib/commands/thor/component_template.rb +0 -174
- data/lib/commands/thor/developer.rb +0 -144
- data/lib/commands/thor/dtk.rb +0 -152
- data/lib/commands/thor/library.rb +0 -125
- data/lib/commands/thor/node.rb +0 -504
- data/lib/commands/thor/node_group.rb +0 -203
- data/lib/commands/thor/node_template.rb +0 -94
- data/lib/commands/thor/provider.rb +0 -233
- data/lib/commands/thor/remotes.rb +0 -49
- data/lib/commands/thor/service.rb +0 -932
- data/lib/commands/thor/service_module.rb +0 -900
- data/lib/commands/thor/target.rb +0 -250
- data/lib/commands/thor/task.rb +0 -116
- data/lib/commands/thor/test_module.rb +0 -310
- data/lib/commands/thor/workspace.rb +0 -698
- data/lib/config/client.conf.header +0 -20
- data/lib/config/configuration.rb +0 -99
- data/lib/config/default.conf +0 -16
- data/lib/config/disk_cacher.rb +0 -80
- data/lib/configurator.rb +0 -176
- data/lib/context_router.rb +0 -44
- data/lib/core.rb +0 -489
- data/lib/domain/git_adapter.rb +0 -412
- data/lib/domain/git_error_handler.rb +0 -64
- data/lib/domain/response/error_handler.rb +0 -86
- data/lib/domain/response.rb +0 -285
- data/lib/dtk-client/version.rb +0 -20
- data/lib/dtk_constants.rb +0 -40
- data/lib/dtk_error.rb +0 -114
- data/lib/dtk_logger.rb +0 -113
- data/lib/error.rb +0 -85
- data/lib/execute/cli_pure/cli_rerouter.rb +0 -102
- data/lib/execute/command/api_call/map.rb +0 -60
- data/lib/execute/command/api_call/service.rb +0 -91
- data/lib/execute/command/api_call/translation_term.rb +0 -119
- data/lib/execute/command/api_call.rb +0 -60
- data/lib/execute/command_processor/rest_call.rb +0 -59
- data/lib/execute/command_processor.rb +0 -30
- data/lib/execute/execute_context.rb +0 -86
- data/lib/execute/script/add_tenant.rb +0 -121
- data/lib/execute/script.rb +0 -64
- data/lib/parser/adapters/option_parser.rb +0 -70
- data/lib/parser/adapters/thor.rb +0 -555
- data/lib/require_first.rb +0 -104
- data/lib/shell/context.rb +0 -1064
- data/lib/shell/domain/active_context.rb +0 -186
- data/lib/shell/domain/context_entity.rb +0 -89
- data/lib/shell/domain/context_params.rb +0 -223
- data/lib/shell/domain/override_tasks.rb +0 -88
- data/lib/shell/domain/shadow_entity.rb +0 -76
- data/lib/shell/header_shell.rb +0 -44
- data/lib/shell/help_monkey_patch.rb +0 -283
- data/lib/shell/interactive_wizard.rb +0 -256
- data/lib/shell/message_queue.rb +0 -63
- data/lib/shell/status_monitor.rb +0 -124
- data/lib/shell.rb +0 -261
- data/lib/task_status.rb +0 -83
- data/lib/util/console.rb +0 -235
- data/lib/util/dtk_puppet.rb +0 -65
- data/lib/util/module_util.rb +0 -66
- data/lib/util/os_util.rb +0 -385
- data/lib/util/remote_dependency_util.rb +0 -84
- data/lib/util/ssh_util.rb +0 -94
- data/lib/view_processor/augmented_simple_list.rb +0 -44
- data/lib/view_processor/hash_pretty_print.rb +0 -123
- data/lib/view_processor/simple_list.rb +0 -156
- data/lib/view_processor/table_print.rb +0 -309
- data/lib/view_processor.rb +0 -129
- data/puppet/manifests/init.pp +0 -72
- data/puppet/manifests/params.pp +0 -16
- data/puppet/r8meta.puppet.yml +0 -35
- data/puppet/templates/bash_profile.erb +0 -2
- data/puppet/templates/client.conf.erb +0 -1
- data/puppet/templates/dtkclient.erb +0 -2
- data/spec/component_module_spec.rb +0 -34
- data/spec/dependency_spec.rb +0 -6
- data/spec/dtk_shell_spec.rb +0 -13
- data/spec/dtk_spec.rb +0 -33
- data/spec/lib/spec_helper.rb +0 -10
- data/spec/lib/spec_thor.rb +0 -108
- data/spec/node_template_spec.rb +0 -24
- data/spec/project_spec.rb +0 -6
- data/spec/repo_spec.rb +0 -7
- data/spec/response_spec.rb +0 -52
- data/spec/service_module_spec.rb +0 -38
- data/spec/service_spec.rb +0 -50
- data/spec/state_change_spec.rb +0 -7
- data/spec/table_print_spec.rb +0 -48
- data/spec/target_spec.rb +0 -57
- data/spec/task_spec.rb +0 -28
- data/views/assembly/augmented_simple_list.rb +0 -12
- data/views/assembly_template/augmented_simple_list.rb +0 -12
- data/views/list_task/augmented_simple_list.rb +0 -12
@@ -1,1011 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
dtk_require_common_commands('thor/clone')
|
19
|
-
dtk_require_common_commands('thor/list_diffs')
|
20
|
-
dtk_require_common_commands('thor/puppet_forge')
|
21
|
-
dtk_require_common_commands('thor/push_to_remote')
|
22
|
-
dtk_require_common_commands('thor/pull_from_remote')
|
23
|
-
dtk_require_common_commands('thor/push_clone_changes')
|
24
|
-
dtk_require_common_commands('thor/access_control')
|
25
|
-
dtk_require_common_commands('thor/edit')
|
26
|
-
dtk_require_common_commands('thor/reparse')
|
27
|
-
dtk_require_common_commands('thor/purge_clone')
|
28
|
-
dtk_require_common_commands('thor/common')
|
29
|
-
dtk_require_common_commands('thor/remotes')
|
30
|
-
|
31
|
-
dtk_require_from_base('configurator')
|
32
|
-
dtk_require_from_base('command_helpers/service_importer')
|
33
|
-
dtk_require_from_base('command_helpers/test_module_creator')
|
34
|
-
|
35
|
-
require 'fileutils'
|
36
|
-
|
37
|
-
DEFAULT_COMMIT_MSG = "Initial commit."
|
38
|
-
PULL_CATALOGS = ["dtkn"]
|
39
|
-
|
40
|
-
module DTK::Client
|
41
|
-
dtk_require_common_commands('thor/base_command_helper')
|
42
|
-
class CommonModule
|
43
|
-
dtk_require_common_commands('thor/module/import')
|
44
|
-
end
|
45
|
-
|
46
|
-
module ModuleMixin
|
47
|
-
|
48
|
-
REQ_MODULE_ID = [:service_module_id!, :component_module_id!, :test_module_id!]
|
49
|
-
REQ_MODULE_NAME = [:service_module_name!, :component_module_name!, :test_module_name!]
|
50
|
-
|
51
|
-
include PuppetForgeMixin
|
52
|
-
include CloneMixin
|
53
|
-
include PushToRemoteMixin
|
54
|
-
include PullFromRemoteMixin
|
55
|
-
include PushCloneChangesMixin
|
56
|
-
include EditMixin
|
57
|
-
include ReparseMixin
|
58
|
-
include PurgeCloneMixin
|
59
|
-
include ListDiffsMixin
|
60
|
-
include ServiceImporter
|
61
|
-
include AccessControlMixin
|
62
|
-
include RemotesMixin
|
63
|
-
|
64
|
-
def get_module_type(context_params)
|
65
|
-
forwarded_type = context_params.get_forwarded_options() ? context_params.get_forwarded_options()[:module_type] : nil
|
66
|
-
|
67
|
-
if context_params.root_command_name || forwarded_type
|
68
|
-
module_type = (context_params.root_command_name||forwarded_type).gsub(/\-/, "_")
|
69
|
-
else
|
70
|
-
module_type = resolve_module_type
|
71
|
-
end
|
72
|
-
|
73
|
-
module_type
|
74
|
-
end
|
75
|
-
|
76
|
-
def module_info_about(context_params, about, data_type)
|
77
|
-
module_id, component_template_id = context_params.retrieve_arguments([REQ_MODULE_ID, :component_id],method_argument_names)
|
78
|
-
module_type = get_module_type(context_params)
|
79
|
-
|
80
|
-
post_body = {
|
81
|
-
"#{module_type}_id".to_sym => module_id,
|
82
|
-
:component_template_id => component_template_id,
|
83
|
-
:about => about
|
84
|
-
}
|
85
|
-
response = post rest_url("#{module_type}/info_about"), post_body
|
86
|
-
data_type = data_type
|
87
|
-
|
88
|
-
response.render_table(data_type) unless options.list?
|
89
|
-
end
|
90
|
-
|
91
|
-
def module_info_aux(context_params)
|
92
|
-
module_type = get_module_type(context_params)
|
93
|
-
|
94
|
-
if context_params.is_there_identifier?(:assembly)
|
95
|
-
response = DTK::Client::ContextRouter.routeTask("assembly", "info", context_params, @conn)
|
96
|
-
else
|
97
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
98
|
-
|
99
|
-
post_body = {
|
100
|
-
"#{module_type}_id".to_sym => module_id
|
101
|
-
}
|
102
|
-
response = post rest_url("#{module_type}/info"), post_body
|
103
|
-
response.render_custom_info("module")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def delete_module_aux(context_params, method_opts = {})
|
108
|
-
module_location, modules_path = nil, nil
|
109
|
-
module_id = context_params.retrieve_arguments([:option_1!], method_argument_names)
|
110
|
-
|
111
|
-
delete_module_sub_aux(context_params, module_id, method_opts)
|
112
|
-
end
|
113
|
-
|
114
|
-
def delete_module_sub_aux(context_params, module_id, method_opts = {})
|
115
|
-
version = options.version
|
116
|
-
module_name = get_name_from_id_helper(module_id)
|
117
|
-
module_type = get_module_type(context_params)
|
118
|
-
|
119
|
-
# delete all versions
|
120
|
-
version = 'delete_all' if method_opts[:delete_all]
|
121
|
-
|
122
|
-
unless (options.force? || method_opts[:force_delete])
|
123
|
-
msg = "Are you sure you want to delete module '#{module_name}'"
|
124
|
-
msg += " version '#{version}'" if version
|
125
|
-
is_go = Console.confirmation_prompt("#{msg}"+"?")
|
126
|
-
return nil unless is_go
|
127
|
-
end
|
128
|
-
|
129
|
-
post_body = { "#{module_type}_id".to_sym => module_id }
|
130
|
-
opts = { :module_name => module_name }
|
131
|
-
|
132
|
-
unless version
|
133
|
-
# post_body.merge!(:include_base => true)
|
134
|
-
|
135
|
-
versions_response = post rest_url("#{module_type}/list_versions"), post_body
|
136
|
-
return versions_response unless versions_response.ok?
|
137
|
-
|
138
|
-
versions = versions_response.data.first['versions']
|
139
|
-
if versions.size > 0
|
140
|
-
versions << "all" unless versions.size == 1
|
141
|
-
ret_version = Console.confirmation_prompt_multiple_choice("\nSelect version to delete:", versions)
|
142
|
-
return unless ret_version
|
143
|
-
raise DtkError, "You are not allowed to delete 'base' version while other versions exist!" if ret_version.eql?('base')
|
144
|
-
version = ret_version
|
145
|
-
else
|
146
|
-
raise DtkError, "There are no versions created for #{module_type} '#{module_name}'!"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
if version
|
151
|
-
if version.eql?('all')
|
152
|
-
# delete only versions (not base)
|
153
|
-
post_body.merge!(:all_except_base => true)
|
154
|
-
opts.merge!(:all_except_base => true)
|
155
|
-
elsif version.eql?('delete_all')
|
156
|
-
# this means delete entire module (including all versions + base)
|
157
|
-
post_body.merge!(:delete_all_versions => true)
|
158
|
-
opts.merge!(:delete_all_versions => true)
|
159
|
-
else
|
160
|
-
# delete specific version only
|
161
|
-
post_body.merge!(:version => version)
|
162
|
-
opts.merge!(:version => version)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
response = post(rest_url("#{module_type}/delete"), post_body)
|
167
|
-
return response unless response.ok?
|
168
|
-
|
169
|
-
# if we do not provide version, server will calculate the latest version which we can use here
|
170
|
-
unless version
|
171
|
-
version = response.data(:version)
|
172
|
-
opts.merge!(:version => version)
|
173
|
-
end
|
174
|
-
|
175
|
-
response =
|
176
|
-
if options.purge? || method_opts[:purge]
|
177
|
-
purge_clone_aux(module_type.to_sym, opts)
|
178
|
-
else
|
179
|
-
Helper(:git_repo).unlink_local_clone?(module_type.to_sym, module_name, version)
|
180
|
-
end
|
181
|
-
|
182
|
-
return response unless response.ok?
|
183
|
-
|
184
|
-
unless method_opts[:no_error_msg]
|
185
|
-
if version && version.eql?('all')
|
186
|
-
OsUtil.print("All versions (except base) of '#{module_name}' module have been deleted.", :yellow)
|
187
|
-
elsif version && version.eql?('delete_all')
|
188
|
-
OsUtil.print("All versions of '#{module_name}' module have been deleted.", :yellow)
|
189
|
-
else
|
190
|
-
msg = "Module '#{module_name}' "
|
191
|
-
if version then msg << "version '#{version}' has been deleted successfully."
|
192
|
-
else msg << "has been deleted successfully."; end
|
193
|
-
OsUtil.print(msg, :yellow)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
Response::Ok.new()
|
198
|
-
end
|
199
|
-
|
200
|
-
def set_attribute_module_aux(context_params)
|
201
|
-
if context_params.is_there_identifier?(:attribute)
|
202
|
-
mapping = [REQ_MODULE_ID, :attribute_id!, :option_1]
|
203
|
-
else
|
204
|
-
mapping = [REQ_MODULE_ID, :option_1!, :option_2]
|
205
|
-
end
|
206
|
-
|
207
|
-
module_id, attribute_id, value = context_params.retrieve_arguments(mapping, method_argument_names)
|
208
|
-
module_type = get_module_type(context_params)
|
209
|
-
|
210
|
-
post_body = {
|
211
|
-
:attribute_id => attribute_id,
|
212
|
-
:attribute_value => value,
|
213
|
-
:attribute_type => module_type,
|
214
|
-
"#{module_type}_id".to_sym => module_id
|
215
|
-
}
|
216
|
-
|
217
|
-
post rest_url('attribute/set'), post_body
|
218
|
-
end
|
219
|
-
|
220
|
-
def push_module_aux(context_params, internal_trigger = false, opts = {})
|
221
|
-
module_type = get_module_type(context_params)
|
222
|
-
module_id, module_name = context_params.retrieve_arguments([REQ_MODULE_ID, "#{module_type}_name".to_sym], method_argument_names)
|
223
|
-
version = options['version']
|
224
|
-
|
225
|
-
module_location = OsUtil.module_location(module_type, module_name, version)
|
226
|
-
|
227
|
-
git_import = opts[:git_import]
|
228
|
-
opts.merge!(:update_from_includes => true, :force_parse => true) unless git_import
|
229
|
-
opts.merge!(:force => options.force?)
|
230
|
-
opts.merge!(:generate_docs => options.docs?)
|
231
|
-
|
232
|
-
reparse_aux(module_location)
|
233
|
-
push_clone_changes_aux(module_type.to_sym, module_id, version, options['message'] || DEFAULT_COMMIT_MSG, internal_trigger, opts)
|
234
|
-
end
|
235
|
-
|
236
|
-
def create_test_module_aux(context_params)
|
237
|
-
test_module_name = context_params.retrieve_arguments([:option_1!], method_argument_names)
|
238
|
-
module_type = get_module_type(context_params)
|
239
|
-
|
240
|
-
response = DTK::Client::TestModuleCreator.create_clone(module_type.to_sym, test_module_name)
|
241
|
-
return response unless response.ok?
|
242
|
-
|
243
|
-
create_response = import(context_params)
|
244
|
-
|
245
|
-
unless create_response.ok?
|
246
|
-
error_msg = create_response['errors'].select { |er| er['message'].include? 'cannot be created since it exists already' }
|
247
|
-
if error_msg.empty?
|
248
|
-
# If server response is not ok and module does not exist on server, delete cloned module, invoke delete method
|
249
|
-
delete(context_params, :force_delete => true, :no_error_msg => true)
|
250
|
-
end
|
251
|
-
|
252
|
-
# remove temp directory
|
253
|
-
FileUtils.rm_rf("#{response['data']['module_directory']}")
|
254
|
-
|
255
|
-
return create_response
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
def import_git_module_aux(context_params)
|
260
|
-
CommonModule::Import.new(self, context_params).from_git(context_params.get_forwarded_options()[:internal_trigger])
|
261
|
-
end
|
262
|
-
|
263
|
-
def import_module_aux(context_params)
|
264
|
-
CommonModule::Import.new(self, context_params).from_file()
|
265
|
-
end
|
266
|
-
|
267
|
-
def install_module_aux(context_params, internal_trigger = false)
|
268
|
-
create_missing_clone_dirs()
|
269
|
-
resolve_direct_access(::DTK::Client::Configurator.check_direct_access)
|
270
|
-
|
271
|
-
remote_module_name, version = context_params.retrieve_arguments([:option_1!, :option_2], method_argument_names)
|
272
|
-
forwarded_version = context_params.get_forwarded_options()['version']
|
273
|
-
add_version = false
|
274
|
-
master_only = (options.version? && options.version.eql?('master'))
|
275
|
-
|
276
|
-
version ||= forwarded_version || options.version
|
277
|
-
version = nil if version.eql?('master')
|
278
|
-
if version
|
279
|
-
check_version_format(version)
|
280
|
-
add_version = true
|
281
|
-
end
|
282
|
-
|
283
|
-
# in case of auto-import via service import, we skip cloning to speed up a process
|
284
|
-
skip_cloning = context_params.get_forwarded_options()['skip_cloning'] if context_params.get_forwarded_options()
|
285
|
-
do_not_raise = context_params.get_forwarded_options()[:do_not_raise] if context_params.get_forwarded_options()
|
286
|
-
skip_ainstall = context_params.get_forwarded_options() ? context_params.get_forwarded_options()[:skip_auto_install] : false
|
287
|
-
skip_base = context_params.get_forwarded_options()['skip_base']
|
288
|
-
module_type = get_module_type(context_params)
|
289
|
-
|
290
|
-
# ignore_component_error = context_params.get_forwarded_options()[:ignore_component_error]||options.ignore? if context_params.get_forwarded_options()
|
291
|
-
ignore_component_error = context_params.get_forwarded_options().empty? ? options.ignore? : context_params.get_forwarded_options()[:ignore_component_error]
|
292
|
-
additional_message = context_params.get_forwarded_options()[:additional_message] if context_params.get_forwarded_options()
|
293
|
-
|
294
|
-
remote_namespace, local_module_name = get_namespace_and_name(remote_module_name, ':')
|
295
|
-
|
296
|
-
post_body = {
|
297
|
-
:remote_module_name => remote_module_name.sub(':', '/'),
|
298
|
-
:local_module_name => local_module_name,
|
299
|
-
:rsa_pub_key => SSHUtil.rsa_pub_key_content()
|
300
|
-
}
|
301
|
-
post_body.merge!(:do_not_raise => do_not_raise) if do_not_raise
|
302
|
-
post_body.merge!(:ignore_component_error => ignore_component_error) if ignore_component_error
|
303
|
-
post_body.merge!(:additional_message => additional_message) if additional_message
|
304
|
-
post_body.merge!(:skip_auto_install => skip_ainstall) if skip_ainstall
|
305
|
-
|
306
|
-
# we need to install base module version if not installed
|
307
|
-
unless skip_base
|
308
|
-
master_response = install_base_version_aux?(context_params, post_body, module_type, version)
|
309
|
-
# return master_response unless master_response.ok?
|
310
|
-
return master_response if !master_response.ok? || master_only
|
311
|
-
|
312
|
-
latest_version = master_response.data(:latest_version)
|
313
|
-
|
314
|
-
unless version
|
315
|
-
version = latest_version.eql?('master') ? nil : latest_version
|
316
|
-
end
|
317
|
-
|
318
|
-
post_body.merge!(:hard_reset_on_pull_version => true) if version
|
319
|
-
end
|
320
|
-
|
321
|
-
if version
|
322
|
-
add_version = true
|
323
|
-
post_body.merge!(:version => version)
|
324
|
-
end
|
325
|
-
|
326
|
-
if clone_dir = Helper(:git_repo).local_clone_dir_exists?(module_type.to_sym, local_module_name, :namespace => remote_namespace, :version => version)
|
327
|
-
message = "Module's directory (#{clone_dir}) exists on client. To install this needs to be renamed or removed."
|
328
|
-
raise DtkError, message unless ignore_component_error
|
329
|
-
end
|
330
|
-
|
331
|
-
response = post rest_url("#{module_type}/import"), post_body
|
332
|
-
|
333
|
-
# when silently installing base version we don't want to print anything
|
334
|
-
unless skip_base
|
335
|
-
# print permission warnings and then check for other warnings
|
336
|
-
are_there_warnings = RemoteDependencyUtil.check_permission_warnings(response)
|
337
|
-
are_there_warnings ||= RemoteDependencyUtil.print_dependency_warnings(response, nil, :ignore_permission_warnings => true)
|
338
|
-
|
339
|
-
# prompt to see if user is ready to continue with warnings/errors
|
340
|
-
if are_there_warnings
|
341
|
-
return false unless Console.confirmation_prompt('Do you still want to proceed with import' + '?')
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
# case when we need to import additional components
|
346
|
-
if response.ok? && !skip_ainstall && (missing_components = response.data(:missing_module_components))
|
347
|
-
required_components = response.data(:required_modules)
|
348
|
-
opts = { :do_not_raise => true }
|
349
|
-
module_opts = ignore_component_error ? opts.merge(:ignore_component_error => true) : opts.merge(:additional_message => true)
|
350
|
-
module_opts.merge!(:update_none => true) if options.update_none?
|
351
|
-
module_opts.merge!(:hide_output => true) if skip_base && !master_only
|
352
|
-
|
353
|
-
continue = trigger_module_auto_import(missing_components, required_components, module_opts)
|
354
|
-
return unless continue
|
355
|
-
|
356
|
-
print_remote_name = add_version ? "#{remote_module_name}(#{version})" : remote_module_name
|
357
|
-
print "Resuming DTK Network import for #{module_type} '#{print_remote_name}' ..." unless skip_base
|
358
|
-
# repeat import call for service
|
359
|
-
post_body.merge!(opts)
|
360
|
-
response = post rest_url("#{module_type}/import"), post_body
|
361
|
-
|
362
|
-
# we set skip cloning since it is already done by import
|
363
|
-
puts ' Done' unless skip_base
|
364
|
-
end
|
365
|
-
|
366
|
-
return response if !response.ok? || response.data(:does_not_exist)
|
367
|
-
module_id, module_name, namespace, repo_url, branch, version = response.data(:module_id, :module_name, :namespace, :repo_url, :workspace_branch, :version)
|
368
|
-
|
369
|
-
if error = response.data(:dsl_parse_error)
|
370
|
-
dsl_parsed_message = ServiceImporter.error_message(module_name, error)
|
371
|
-
DTK::Client::OsUtil.print(dsl_parsed_message, :red)
|
372
|
-
end
|
373
|
-
|
374
|
-
unless skip_cloning
|
375
|
-
# TODO: should we use instead Helper(:git_repo).create_clone_from_optional_branch
|
376
|
-
response = Helper(:git_repo).create_clone_with_branch(module_type.to_sym, module_name, repo_url, branch, version, remote_namespace)
|
377
|
-
end
|
378
|
-
|
379
|
-
resolve_missing_components(module_id, module_name, namespace, options.force?) if module_type.to_s.eql?('service_module')
|
380
|
-
response
|
381
|
-
end
|
382
|
-
|
383
|
-
def install_base_version_aux?(context_params, post_body, module_type, version)
|
384
|
-
master_response = post rest_url("#{module_type}/prepare_for_install_module"), post_body
|
385
|
-
return master_response unless master_response.ok?
|
386
|
-
|
387
|
-
head_installed = master_response.data(:head_installed)
|
388
|
-
latest_version = master_response.data(:latest_version)
|
389
|
-
remote_module_name, param_version = context_params.retrieve_arguments([:option_1!, :option_2], method_argument_names)
|
390
|
-
|
391
|
-
if version
|
392
|
-
versions = master_response.data(:versions)
|
393
|
-
raise DtkError, "Module '#{remote_module_name}' version '#{version}' does not exist on repo manager!" unless versions.include?(version)
|
394
|
-
end
|
395
|
-
|
396
|
-
base_response = nil
|
397
|
-
if !head_installed && !latest_version.eql?('master')
|
398
|
-
new_context_params = DTK::Shell::ContextParams.new
|
399
|
-
new_context_params.add_context_to_params(module_type, module_type)
|
400
|
-
new_context_params.method_arguments = [remote_module_name]
|
401
|
-
new_context_params.forward_options('skip_base' => true, 'version' => 'master')
|
402
|
-
base_response = install_module_aux(new_context_params)
|
403
|
-
end
|
404
|
-
|
405
|
-
return base_response if base_response && (options.version? && options.version.eql?('master'))
|
406
|
-
master_response
|
407
|
-
end
|
408
|
-
|
409
|
-
def delete_from_catalog_aux(context_params)
|
410
|
-
module_type = get_module_type(context_params)
|
411
|
-
remote_module_name = context_params.retrieve_arguments([:option_1!], method_argument_names)
|
412
|
-
version = options.version
|
413
|
-
rsa_pub_key = SSHUtil.rsa_pub_key_content()
|
414
|
-
|
415
|
-
# remote_module_name can be namespace:name or namespace/name
|
416
|
-
remote_namespace, remote_module_name = get_namespace_and_name(remote_module_name, ':')
|
417
|
-
|
418
|
-
if version
|
419
|
-
check_version_format(version)
|
420
|
-
else
|
421
|
-
list_post_body = {
|
422
|
-
"#{module_type}_id".to_sym => "#{remote_namespace}:#{remote_module_name}",
|
423
|
-
:rsa_pub_key => rsa_pub_key,
|
424
|
-
:include_base => true
|
425
|
-
}
|
426
|
-
# versions_response = post rest_url("#{module_type}/list_remote_versions"), list_post_body
|
427
|
-
versions_response = post rest_url("#{module_type}/list_remote"), list_post_body
|
428
|
-
return versions_response unless versions_response.ok?
|
429
|
-
|
430
|
-
selected_module = versions_response.data.find{ |vr| vr['display_name'].eql?("#{remote_namespace}/#{remote_module_name}") }
|
431
|
-
raise DtkError, "Module '#{remote_namespace}/#{remote_module_name}'' does not exist on repo manager!" unless selected_module
|
432
|
-
|
433
|
-
versions = selected_module['versions']
|
434
|
-
if versions.size > 2
|
435
|
-
versions << "all"
|
436
|
-
ret_version = Console.confirmation_prompt_multiple_choice("\nSelect version to delete:", versions)
|
437
|
-
return unless ret_version
|
438
|
-
raise DtkError, "You are not allowed to delete 'base' version while other versions exist!" if ret_version.eql?('base')
|
439
|
-
version = ret_version
|
440
|
-
end
|
441
|
-
end
|
442
|
-
|
443
|
-
unless options.force? || options.confirmed?
|
444
|
-
msg = "Are you sure you want to delete remote #{module_type} '#{remote_namespace.nil? ? '' : remote_namespace + '/'}#{remote_module_name}'"
|
445
|
-
msg += " version '#{version}'" if version
|
446
|
-
msg += " and all items contained in it"
|
447
|
-
return unless Console.confirmation_prompt(msg + '?')
|
448
|
-
end
|
449
|
-
|
450
|
-
post_body = {
|
451
|
-
:rsa_pub_key => rsa_pub_key,
|
452
|
-
:remote_module_name => remote_module_name,
|
453
|
-
:remote_module_namespace => remote_namespace,
|
454
|
-
:force_delete => options.force?
|
455
|
-
}
|
456
|
-
post_body.merge!(:version => version) if version
|
457
|
-
|
458
|
-
response = post rest_url("#{module_type}/delete_remote"), post_body
|
459
|
-
return response unless response.ok?
|
460
|
-
|
461
|
-
full_module_name, version = response.data(:module_full_name, :version)
|
462
|
-
msg = "Module '#{full_module_name}' "
|
463
|
-
msg << "version '#{version}'" if version && !version.eql?('master')
|
464
|
-
msg << " has been deleted successfully."
|
465
|
-
OsUtil.print(msg, :yellow)
|
466
|
-
|
467
|
-
Response::Ok.new()
|
468
|
-
end
|
469
|
-
|
470
|
-
def publish_module_aux(context_params)
|
471
|
-
module_type = get_module_type(context_params)
|
472
|
-
module_id, module_name, input_remote_name = context_params.retrieve_arguments([REQ_MODULE_ID, REQ_MODULE_NAME, :option_1], method_argument_names)
|
473
|
-
|
474
|
-
raise DtkValidationError, "You have to provide version you want to publish!" unless options.version
|
475
|
-
|
476
|
-
unless input_remote_name
|
477
|
-
input_remote_name = module_name.gsub(":","/")
|
478
|
-
context_params.method_arguments << input_remote_name
|
479
|
-
end
|
480
|
-
|
481
|
-
skip_base = context_params.get_forwarded_options()['skip_base']
|
482
|
-
forwarded_version = context_params.get_forwarded_options()['version']
|
483
|
-
|
484
|
-
version = forwarded_version||options.version
|
485
|
-
version = nil if version.eql?('master')
|
486
|
-
|
487
|
-
forward_namespace?(module_name, input_remote_name, context_params)
|
488
|
-
|
489
|
-
post_body = {
|
490
|
-
"#{module_type}_id".to_sym => module_id,
|
491
|
-
:remote_component_name => input_remote_name,
|
492
|
-
:rsa_pub_key => SSHUtil.rsa_pub_key_content(),
|
493
|
-
}
|
494
|
-
|
495
|
-
unless skip_base
|
496
|
-
check_response = post rest_url("#{module_type}/check_remote_exist"), post_body
|
497
|
-
return check_response unless check_response.ok?
|
498
|
-
|
499
|
-
remote_exist = check_response.data(:remote_exist)
|
500
|
-
unless remote_exist
|
501
|
-
context_params.forward_options('skip_base' => true, 'version' => 'master')
|
502
|
-
resp = publish_module_aux(context_params)
|
503
|
-
return resp unless resp.ok?
|
504
|
-
end
|
505
|
-
|
506
|
-
context_params.forward_options('do_not_raise_if_exist' => true, 'version' => version)
|
507
|
-
create_response = create_new_version_aux(context_params, true)
|
508
|
-
return create_response unless create_response.ok?
|
509
|
-
end
|
510
|
-
|
511
|
-
post_body.merge!(:version => version) if version
|
512
|
-
response = post rest_url("#{module_type}/export"), post_body
|
513
|
-
return response unless response.ok?
|
514
|
-
|
515
|
-
unless skip_base
|
516
|
-
full_module_name = "#{response.data['remote_repo_namespace']}/#{response.data['remote_repo_name']}"
|
517
|
-
DTK::Client::RemoteDependencyUtil.print_dependency_warnings(response, "Module has been successfully published to '#{full_module_name}' version '#{version}'!")
|
518
|
-
end
|
519
|
-
|
520
|
-
Response::Ok.new()
|
521
|
-
end
|
522
|
-
|
523
|
-
# def publish_module_aux(context_params)
|
524
|
-
# module_type = get_module_type(context_params)
|
525
|
-
# module_id, module_name, input_remote_name = context_params.retrieve_arguments([REQ_MODULE_ID, REQ_MODULE_NAME, :option_1], method_argument_names)
|
526
|
-
|
527
|
-
# post_body = {
|
528
|
-
# "#{module_type}_id".to_sym => module_id,
|
529
|
-
# :remote_component_name => input_remote_name,
|
530
|
-
# :rsa_pub_key => SSHUtil.rsa_pub_key_content()
|
531
|
-
# }
|
532
|
-
# if options.version?
|
533
|
-
# post_body.merge!(:version => options.version)
|
534
|
-
# else
|
535
|
-
# post_body.merge!(:use_latest => true)
|
536
|
-
# end
|
537
|
-
|
538
|
-
# # check if module exist on repo manager and use it to decide if need to push or publish
|
539
|
-
# check_response = post rest_url("#{module_type}/check_remote_exist"), post_body
|
540
|
-
# return check_response unless check_response.ok?
|
541
|
-
|
542
|
-
# unless options.version?
|
543
|
-
# version = check_response.data(:version)
|
544
|
-
# context_params.forward_options('version' => version)
|
545
|
-
# post_body.merge!(:version => version)
|
546
|
-
# end
|
547
|
-
|
548
|
-
# # if remote module exist and user call 'publish' we do push-dtkn else we publish it as new module
|
549
|
-
# response_data = check_response['data']
|
550
|
-
# if response_data["remote_exist"]
|
551
|
-
# raise DtkValidationError, "You are not allowed to update #{module_type} versions!" if response_data['frozen']
|
552
|
-
|
553
|
-
# # if do publish namespace2/module from namespace1/module, forward namespace as option to be used in push_dtkn_module_aux
|
554
|
-
# forward_namespace?(module_name, input_remote_name, context_params)
|
555
|
-
|
556
|
-
# push_dtkn_module_aux(context_params, true)
|
557
|
-
# else
|
558
|
-
# response = post rest_url("#{module_type}/export"), post_body
|
559
|
-
# return response unless response.ok?
|
560
|
-
|
561
|
-
# full_module_name = "#{response.data['remote_repo_namespace']}/#{response.data['remote_repo_name']}"
|
562
|
-
|
563
|
-
# DTK::Client::RemoteDependencyUtil.print_dependency_warnings(response, "Module has been successfully published to '#{full_module_name}'!")
|
564
|
-
# Response::Ok.new()
|
565
|
-
# end
|
566
|
-
# end
|
567
|
-
|
568
|
-
def pull_dtkn_aux(context_params)
|
569
|
-
module_id, module_name = context_params.retrieve_arguments([REQ_MODULE_ID,REQ_MODULE_NAME,:option_1],method_argument_names)
|
570
|
-
|
571
|
-
catalog = 'dtkn'
|
572
|
-
version = options.version||context_params.get_forwarded_options()[:version]
|
573
|
-
module_type = get_module_type(context_params)
|
574
|
-
skip_recursive_pull = context_params.get_forwarded_options()[:skip_recursive_pull]
|
575
|
-
ignore_dependency_merge_conflict = context_params.get_forwarded_options()[:skip_recursive_pull]
|
576
|
-
|
577
|
-
raise DtkValidationError, "You have to provide valid catalog to pull changes from! Valid catalogs: #{PULL_CATALOGS}" unless catalog
|
578
|
-
|
579
|
-
module_location = OsUtil.module_location(resolve_module_type(), module_name, version)
|
580
|
-
|
581
|
-
if catalog.to_s.eql?("dtkn")
|
582
|
-
clone_aux(module_type.to_sym, module_id, version, true, true) unless File.directory?(module_location)
|
583
|
-
opts = {
|
584
|
-
:force => options.force?,
|
585
|
-
:version => version,
|
586
|
-
:remote_namespace => options.namespace,
|
587
|
-
:skip_recursive_pull => skip_recursive_pull,
|
588
|
-
:ignore_dependency_merge_conflict => ignore_dependency_merge_conflict
|
589
|
-
}
|
590
|
-
|
591
|
-
opts.merge!(:do_not_raise => true) if (context_params.get_forwarded_options()||{})[:do_not_raise]
|
592
|
-
response = pull_from_remote_aux(module_type.to_sym, module_id, opts)
|
593
|
-
return response unless response.ok?
|
594
|
-
|
595
|
-
push_clone_changes_aux(module_type.to_sym, module_id, version, nil, true, {:update_from_includes => true}) if File.directory?(module_location)
|
596
|
-
response.skip_render = true
|
597
|
-
response
|
598
|
-
else
|
599
|
-
raise DtkValidationError, "You have to provide valid catalog to pull changes from! Valid catalogs: #{PULL_CATALOGS}"
|
600
|
-
end
|
601
|
-
end
|
602
|
-
|
603
|
-
def chmod_module_aux(context_params)
|
604
|
-
module_id, permission_selector = context_params.retrieve_arguments([REQ_MODULE_ID, :option_1!], method_argument_names)
|
605
|
-
chmod_aux(module_id, permission_selector, options.namespace)
|
606
|
-
end
|
607
|
-
|
608
|
-
def make_public_module_aux(context_params)
|
609
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
610
|
-
chmod_aux(module_id, "o+r", options.namespace, :make_public)
|
611
|
-
end
|
612
|
-
|
613
|
-
def make_private_module_aux(context_params)
|
614
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
615
|
-
chmod_aux(module_id, "o-rwd", options.namespace, :make_private)
|
616
|
-
end
|
617
|
-
|
618
|
-
def add_collaborators_module_aux(context_params)
|
619
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
620
|
-
collaboration_aux(:add, module_id, options.users, options.groups, options.namespace)
|
621
|
-
end
|
622
|
-
|
623
|
-
def remove_collaborators_module_aux(context_params)
|
624
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
625
|
-
collaboration_aux(:remove, module_id, options.users, options.groups, options.namespace)
|
626
|
-
end
|
627
|
-
|
628
|
-
def list_collaborators_module_aux(context_params)
|
629
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
630
|
-
response = collaboration_list_aux(module_id, options.namespace)
|
631
|
-
response.render_table(:module_collaborators)
|
632
|
-
response
|
633
|
-
end
|
634
|
-
|
635
|
-
def clone_module_aux(context_params, internal_trigger = false)
|
636
|
-
module_type = get_module_type(context_params)
|
637
|
-
forward_options = context_params.get_forwarded_options()
|
638
|
-
thor_options = forward_options.empty? ? options : forward_options
|
639
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
640
|
-
module_name = context_params.retrieve_arguments(["#{module_type}_name".to_sym],method_argument_names)
|
641
|
-
version = thor_options["version"]||options.version
|
642
|
-
internal_trigger = true if thor_options['skip_edit']
|
643
|
-
response = clone_aux(module_type.to_sym, module_id, version, internal_trigger, thor_options['omit_output'], :use_latest => true)
|
644
|
-
|
645
|
-
# if error message 'directory exist on client ...' returned print it here
|
646
|
-
# with forward_options[:service_importer] we know it is triggered from auto-importing dependencies so don't want to print
|
647
|
-
if !response.ok? && response.is_a?(Response::Error::Usage) && !forward_options[:service_importer]
|
648
|
-
if errors = response['errors']
|
649
|
-
if error_msg = errors.first['message']
|
650
|
-
OsUtil.print(errors.first['message'], :red)
|
651
|
-
return
|
652
|
-
end
|
653
|
-
end
|
654
|
-
end
|
655
|
-
|
656
|
-
response
|
657
|
-
end
|
658
|
-
|
659
|
-
def edit_module_aux(context_params)
|
660
|
-
module_type = get_module_type(context_params)
|
661
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
662
|
-
module_name = context_params.retrieve_arguments(["#{module_type}_name".to_sym], method_argument_names)
|
663
|
-
version = options.version||context_params.retrieve_arguments([:option_1], method_argument_names)
|
664
|
-
edit_dsl = context_params.get_forwarded_options()[:edit_dsl] if context_params.get_forwarded_options()
|
665
|
-
|
666
|
-
#TODO: cleanup so dont need :base_file_name and get edit_file from server
|
667
|
-
opts = {}
|
668
|
-
base_file_name = "dtk.model"
|
669
|
-
opts.merge!(:edit_file => {:base_file_name => base_file_name}) if edit_dsl
|
670
|
-
edit_aux(module_type.to_sym, module_id, module_name, version, opts)
|
671
|
-
end
|
672
|
-
|
673
|
-
def push_remote_module_aux(context_params)
|
674
|
-
module_id, module_name, remote_name = context_params.retrieve_arguments([REQ_MODULE_ID, REQ_MODULE_NAME, :option_1],method_argument_names)
|
675
|
-
version = options["version"]
|
676
|
-
module_type = get_module_type(context_params)
|
677
|
-
|
678
|
-
post_body = {
|
679
|
-
"#{module_type}_id".to_sym => module_id
|
680
|
-
}
|
681
|
-
|
682
|
-
response = post rest_url("#{module_type}/info_git_remote"), post_body
|
683
|
-
remotes_list = response.data
|
684
|
-
|
685
|
-
# vital information, abort if it does not exist
|
686
|
-
raise DtkError, "There are no registered remotes, aborting action" if remotes_list.empty?
|
687
|
-
|
688
|
-
# check if there is provided remote
|
689
|
-
if remote_name
|
690
|
-
target_remote = remotes_list.find { |r| remote_name.eql?(r['display_name']) }
|
691
|
-
raise DtkError, "Not able to find remote '#{remote_name}'" unless target_remote
|
692
|
-
end
|
693
|
-
|
694
|
-
# if only one take it, else raise ambiguous error
|
695
|
-
unless target_remote
|
696
|
-
if remotes_list.size == 1
|
697
|
-
target_remote = remotes_list.first
|
698
|
-
else
|
699
|
-
remote_names = remotes_list.collect { |r| r['display_name'] }
|
700
|
-
raise DtkError, "Call is ambiguous, please provide remote name. Remotes: #{remote_names.join(', ')} "
|
701
|
-
end
|
702
|
-
end
|
703
|
-
|
704
|
-
# clone if necessry
|
705
|
-
module_location = OsUtil.module_location(resolve_module_type(), module_name, version)
|
706
|
-
unless File.directory?(module_location)
|
707
|
-
response = clone_aux(module_type.to_sym, module_id, version, true, true)
|
708
|
-
return response unless response.ok?
|
709
|
-
end
|
710
|
-
|
711
|
-
if target_remote['base_git_location']
|
712
|
-
OsUtil.print("Pushing local content to remote #{target_remote['base_git_url']} in folder #{target_remote['base_git_location']} ...")
|
713
|
-
return push_to_git_remote_location_aux(module_name, module_type.to_sym, version, {
|
714
|
-
:remote_repo_url => target_remote['base_git_url'],
|
715
|
-
:remote_repo_location => target_remote['base_git_location'],
|
716
|
-
:remote_branch => 'master',
|
717
|
-
:remote_repo => "#{target_remote['display_name']}--remote"
|
718
|
-
}, options.force?)
|
719
|
-
else
|
720
|
-
OsUtil.print("Pushing local content to remote #{target_remote['repo_url']} ... ", :yellow)
|
721
|
-
return push_to_git_remote_aux(module_name, module_type.to_sym, version, {
|
722
|
-
:remote_repo_url => target_remote['repo_url'],
|
723
|
-
:remote_branch => 'master',
|
724
|
-
:remote_repo => "#{target_remote['display_name']}--remote"
|
725
|
-
}, options.force?)
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
|
-
def push_dtkn_module_aux(context_params, internal_trigger=false)
|
730
|
-
module_id, module_name = context_params.retrieve_arguments([REQ_MODULE_ID, REQ_MODULE_NAME],method_argument_names)
|
731
|
-
catalog = 'dtkn'
|
732
|
-
version = options["version"]||context_params.get_forwarded_thor_option('version')
|
733
|
-
module_type = get_module_type(context_params)
|
734
|
-
|
735
|
-
raise DtkValidationError, "You have to provide valid catalog to push changes to! Valid catalogs: #{PushCatalogs}" unless catalog
|
736
|
-
|
737
|
-
module_location = OsUtil.module_location(resolve_module_type(), module_name, version)
|
738
|
-
reparse_aux(module_location) unless internal_trigger
|
739
|
-
local_namespace, local_module_name = get_namespace_and_name(module_name,':')
|
740
|
-
|
741
|
-
if catalog.to_s.eql?("dtkn")
|
742
|
-
module_refs_content = RemoteDependencyUtil.module_ref_content(module_location)
|
743
|
-
options_namespace = options["namespace"]||context_params.get_forwarded_thor_option('namespace')
|
744
|
-
remote_module_info = get_remote_module_info_aux(module_type.to_sym, module_id, options_namespace, version, module_refs_content, local_namespace)
|
745
|
-
return remote_module_info unless remote_module_info.ok?
|
746
|
-
|
747
|
-
unless File.directory?(module_location)
|
748
|
-
response = clone_aux(module_type.to_sym, module_id, version, true, true)
|
749
|
-
|
750
|
-
if(response.nil? || response.ok?)
|
751
|
-
reparse_aux(module_location)
|
752
|
-
response = push_to_remote_aux(remote_module_info, module_type.to_sym)
|
753
|
-
end
|
754
|
-
|
755
|
-
return response
|
756
|
-
end
|
757
|
-
|
758
|
-
push_to_remote_aux(remote_module_info, module_type.to_sym, options.force?)
|
759
|
-
else
|
760
|
-
raise DtkValidationError, "You have to provide valid catalog to push changes to! Valid catalogs: #{PushCatalogs}"
|
761
|
-
end
|
762
|
-
end
|
763
|
-
|
764
|
-
PushCatalogs = ["origin", "dtkn"]
|
765
|
-
|
766
|
-
def list_diffs_module_aux(context_params)
|
767
|
-
module_type = get_module_type(context_params)
|
768
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID],method_argument_names)
|
769
|
-
module_name = context_params.retrieve_arguments(["#{module_type}_name".to_sym],method_argument_names)
|
770
|
-
version = options["version"]
|
771
|
-
|
772
|
-
module_location = OsUtil.module_location(module_type, module_name, version)
|
773
|
-
|
774
|
-
# check if there is repository cloned
|
775
|
-
if File.directory?(module_location)
|
776
|
-
list_diffs_aux(module_type.to_sym, module_id, options.remote?, version)
|
777
|
-
else
|
778
|
-
if Console.confirmation_prompt("Module '#{module_name}#{version && "-#{version}"}' has not been cloned. Would you like to clone module now"+'?')
|
779
|
-
response = clone_aux(module_type.to_sym, module_id, version, true)
|
780
|
-
# if error return
|
781
|
-
unless response.ok?
|
782
|
-
return response
|
783
|
-
end
|
784
|
-
else
|
785
|
-
# user choose not to clone needed module
|
786
|
-
return
|
787
|
-
end
|
788
|
-
end
|
789
|
-
end
|
790
|
-
|
791
|
-
def list_remote_module_diffs(context_params)
|
792
|
-
module_type = get_module_type(context_params)
|
793
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID],method_argument_names)
|
794
|
-
list_remote_diffs_aux(module_type.to_sym, module_id)
|
795
|
-
end
|
796
|
-
|
797
|
-
def list_versions_aux(context_params)
|
798
|
-
module_type = get_module_type(context_params)
|
799
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
800
|
-
include_base = context_params.get_forwarded_options()['include_base']
|
801
|
-
|
802
|
-
post_body = { "#{module_type}_id".to_sym => module_id }
|
803
|
-
post_body.merge!(:include_base => include_base) if include_base
|
804
|
-
|
805
|
-
response = post rest_url("#{module_type}/list_versions"), post_body
|
806
|
-
end
|
807
|
-
|
808
|
-
def list_remote_versions_aux(context_params)
|
809
|
-
module_type = get_module_type(context_params)
|
810
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID], method_argument_names)
|
811
|
-
|
812
|
-
post_body = {
|
813
|
-
"#{module_type}_id".to_sym => module_id,
|
814
|
-
:rsa_pub_key => SSHUtil.rsa_pub_key_content()
|
815
|
-
}
|
816
|
-
|
817
|
-
response = post rest_url("#{module_type}/list_remote_versions"), post_body
|
818
|
-
end
|
819
|
-
|
820
|
-
def delete_assembly_aux(context_params)
|
821
|
-
module_type = get_module_type(context_params)
|
822
|
-
|
823
|
-
module_id, assembly_template_id = context_params.retrieve_arguments([REQ_MODULE_ID,:option_1!], method_argument_names)
|
824
|
-
module_name = context_params.retrieve_arguments([:service_module_name],method_argument_names)
|
825
|
-
|
826
|
-
assembly_template_name = (assembly_template_id.to_s =~ /^[0-9]+$/) ? DTK::Client::Assembly.get_assembly_template_name_for_service(assembly_template_id, module_name) : assembly_template_id
|
827
|
-
assembly_template_id = DTK::Client::Assembly.get_assembly_template_id_for_service(assembly_template_id, module_name) unless assembly_template_id.to_s =~ /^[0-9]+$/
|
828
|
-
|
829
|
-
return unless Console.confirmation_prompt("Are you sure you want to delete assembly '#{assembly_template_name||assembly_template_id}'"+'?') unless options.force?
|
830
|
-
|
831
|
-
post_body = {
|
832
|
-
"#{module_type}_id".to_sym => module_id,
|
833
|
-
:assembly_id => assembly_template_id,
|
834
|
-
:subtype => :template
|
835
|
-
}
|
836
|
-
|
837
|
-
response = post rest_url("#{module_type}/delete_assembly_template"), post_body
|
838
|
-
return response unless response.ok?
|
839
|
-
|
840
|
-
module_location = OsUtil.module_location(module_type, module_name)
|
841
|
-
|
842
|
-
if (module_location && assembly_template_name)
|
843
|
-
assembly_template_location = "#{module_location}/assemblies/#{assembly_template_name}"
|
844
|
-
base_file = "#{module_location}/assemblies/#{assembly_template_name}.dtk.assembly"
|
845
|
-
|
846
|
-
assembly_file_location =
|
847
|
-
if File.exists?("#{base_file}.yaml")
|
848
|
-
"#{base_file}.yaml"
|
849
|
-
elsif File.exists?("#{base_file}.json")
|
850
|
-
"#{base_file}.json"
|
851
|
-
else
|
852
|
-
nil
|
853
|
-
end
|
854
|
-
end
|
855
|
-
|
856
|
-
FileUtils.rm("#{assembly_file_location}") if assembly_file_location
|
857
|
-
if File.directory?(assembly_template_location)
|
858
|
-
unless (assembly_template_location.nil? || ("#{module_location}/assemblies/" == assembly_template_location))
|
859
|
-
FileUtils.rm_rf("#{assembly_template_location}")
|
860
|
-
end
|
861
|
-
end
|
862
|
-
version = nil
|
863
|
-
commit_msg = "Deleting assembly template #{assembly_template_name.to_s}"
|
864
|
-
internal_trigger = true
|
865
|
-
push_clone_changes_aux(module_type.to_sym, module_id, version, commit_msg, internal_trigger, :skip_cloning => true)
|
866
|
-
|
867
|
-
Response::Ok.new()
|
868
|
-
end
|
869
|
-
|
870
|
-
def list_instances_aux(context_params)
|
871
|
-
module_type = get_module_type(context_params)
|
872
|
-
module_id = context_params.retrieve_arguments([REQ_MODULE_ID],method_argument_names)
|
873
|
-
|
874
|
-
post_body = {
|
875
|
-
"#{module_type}_id".to_sym => module_id,
|
876
|
-
}
|
877
|
-
response = post rest_url("#{module_type}/list_instances"), post_body
|
878
|
-
|
879
|
-
# response.render_table(:assembly_template)
|
880
|
-
response.render_table(:assembly)
|
881
|
-
end
|
882
|
-
|
883
|
-
def fork_aux(context_params)
|
884
|
-
module_type = get_module_type(context_params)
|
885
|
-
module_id, fork_namespace = context_params.retrieve_arguments([REQ_MODULE_ID, :option_1!], method_argument_names)
|
886
|
-
|
887
|
-
raise DtkValidationError, "Namespace '#{fork_namespace}' contains invalid characters. Valid characters are letters, numbers, dash and underscore." unless fork_namespace.to_s =~ /^[0-9a-zA-Z\_\-]*$/
|
888
|
-
|
889
|
-
module_name = context_params.retrieve_arguments(["#{module_type}_name".to_sym],method_argument_names)
|
890
|
-
namespace, name = get_namespace_and_name(module_name,':')
|
891
|
-
|
892
|
-
module_location = OsUtil.module_location(module_type, module_name, nil)
|
893
|
-
unless File.directory?(module_location)
|
894
|
-
if Console.confirmation_prompt("Module '#{module_name}' has not been cloned. Would you like to clone module now"+'?')
|
895
|
-
response = clone_aux(module_type.to_sym, module_id, nil, true)
|
896
|
-
return response unless response.ok?
|
897
|
-
end
|
898
|
-
end
|
899
|
-
|
900
|
-
response = Helper(:git_repo).cp_r_to_new_namespace(module_type, name, namespace, fork_namespace)
|
901
|
-
return response unless response.ok?
|
902
|
-
|
903
|
-
new_context_params = DTK::Shell::ContextParams.new
|
904
|
-
new_context_params.add_context_to_params(module_type, module_type)
|
905
|
-
new_context_params.method_arguments = ["#{fork_namespace}:#{name}"]
|
906
|
-
|
907
|
-
create_response = DTK::Client::ContextRouter.routeTask(module_type, "import", new_context_params, @conn)
|
908
|
-
unless create_response.ok?
|
909
|
-
FileUtils.rm_rf("#{response['data']['module_directory']}")
|
910
|
-
return create_response
|
911
|
-
end
|
912
|
-
|
913
|
-
Response::Ok.new()
|
914
|
-
end
|
915
|
-
|
916
|
-
def create_new_version_aux(context_params, internal_trigger = false)
|
917
|
-
module_type = get_module_type(context_params)
|
918
|
-
module_id, version = context_params.retrieve_arguments([REQ_MODULE_ID, :option_1!], method_argument_names)
|
919
|
-
|
920
|
-
version = (context_params.get_forwarded_options()['version'] || options.version) if internal_trigger
|
921
|
-
|
922
|
-
module_name = context_params.retrieve_arguments(["#{module_type}_name".to_sym],method_argument_names)
|
923
|
-
namespace, name = get_namespace_and_name(module_name,':')
|
924
|
-
do_not_raise_if_exist = context_params.get_forwarded_options()['do_not_raise_if_exist']
|
925
|
-
|
926
|
-
module_location = OsUtil.module_location(module_type, module_name, nil)
|
927
|
-
unless File.directory?(module_location)
|
928
|
-
if Console.confirmation_prompt("Module '#{module_name}' has not been cloned. Would you like to clone module now"+'?')
|
929
|
-
response = clone_aux(module_type.to_sym, module_id, nil, true)
|
930
|
-
return response unless response.ok?
|
931
|
-
end
|
932
|
-
end
|
933
|
-
|
934
|
-
opts = {:do_not_raise_if_exist => do_not_raise_if_exist} if do_not_raise_if_exist
|
935
|
-
m_name, m_namespace, repo_url, branch, not_ok_response = workspace_branch_info(module_type, module_id, nil)
|
936
|
-
resp = Helper(:git_repo).create_new_version(module_type, branch, name, namespace, version, repo_url, opts||{})
|
937
|
-
|
938
|
-
post_body = get_workspace_branch_info_post_body(module_type, module_id, version)
|
939
|
-
post_body.merge!(:do_not_raise_if_exist => do_not_raise_if_exist) if do_not_raise_if_exist
|
940
|
-
create_response = post(rest_url("#{module_type}/create_new_version"), post_body)
|
941
|
-
|
942
|
-
unless create_response.ok?
|
943
|
-
FileUtils.rm_rf("#{resp['module_directory']}") unless resp['exist_already']
|
944
|
-
return create_response
|
945
|
-
end
|
946
|
-
|
947
|
-
if version_exist = create_response.data(:version_exist)
|
948
|
-
return create_response if do_not_raise_if_exist
|
949
|
-
end
|
950
|
-
|
951
|
-
if error = create_response.data(:dsl_parse_error)
|
952
|
-
dsl_parsed_message = ServiceImporter.error_message(module_name, error)
|
953
|
-
DTK::Client::OsUtil.print(dsl_parsed_message, :red)
|
954
|
-
end
|
955
|
-
|
956
|
-
if external_dependencies = create_response.data(:external_dependencies)
|
957
|
-
print_dependencies(external_dependencies)
|
958
|
-
end
|
959
|
-
|
960
|
-
if component_module_refs = create_response.data(:component_module_refs)
|
961
|
-
print_using_dependencies(component_module_refs)
|
962
|
-
end
|
963
|
-
|
964
|
-
Response::Ok.new()
|
965
|
-
end
|
966
|
-
|
967
|
-
def print_ambiguous(ambiguous)
|
968
|
-
end
|
969
|
-
|
970
|
-
def forward_namespace?(module_name, input_remote_name, context_params)
|
971
|
-
return unless input_remote_name
|
972
|
-
local_namespace, local_name = get_namespace_and_name(module_name,':')
|
973
|
-
remote_namespace, remote_name = get_namespace_and_name(input_remote_name,'/')
|
974
|
-
context_params.forward_options('namespace' => remote_namespace) unless local_namespace.eql?(remote_namespace)
|
975
|
-
end
|
976
|
-
|
977
|
-
def print_dependencies(dependencies)
|
978
|
-
ambiguous = dependencies["ambiguous"]||[]
|
979
|
-
amb_sorted = ambiguous.map { |k,v| "#{k.split('/').last} (#{v.join(', ')})" }
|
980
|
-
inconsistent = dependencies["inconsistent"]||[]
|
981
|
-
possibly_missing = dependencies["possibly_missing"]||[]
|
982
|
-
|
983
|
-
OsUtil.print("There are inconsistent module dependencies mentioned in dtk.model.yaml: #{inconsistent.join(', ')}", :red) unless inconsistent.empty?
|
984
|
-
OsUtil.print("There are missing module dependencies mentioned in dtk.model.yaml: #{possibly_missing.join(', ')}", :yellow) unless possibly_missing.empty?
|
985
|
-
OsUtil.print("There are ambiguous module dependencies mentioned in dtk.model.yaml: '#{amb_sorted.join(', ')}'. One of the namespaces should be selected by editing the module_refs file", :yellow) if ambiguous && !ambiguous.empty?
|
986
|
-
end
|
987
|
-
|
988
|
-
def print_using_dependencies(component_refs)
|
989
|
-
unless component_refs.empty?
|
990
|
-
puts 'Using component modules:'
|
991
|
-
names = []
|
992
|
-
component_refs.values.each do |cmp_ref|
|
993
|
-
version = cmp_ref['version_info']
|
994
|
-
name = "#{cmp_ref['namespace_info']}:#{cmp_ref['module_name']}"
|
995
|
-
name << "(#{version})" if version
|
996
|
-
names << name
|
997
|
-
end
|
998
|
-
names.sort.each do |name|
|
999
|
-
puts " #{name}"
|
1000
|
-
end
|
1001
|
-
end
|
1002
|
-
end
|
1003
|
-
|
1004
|
-
def check_version_format(version)
|
1005
|
-
unless version.match(/\A\d{1,2}\.\d{1,2}\.\d{1,2}\Z/)
|
1006
|
-
raise DtkValidationError, "Version has an illegal value '#{version}', format needed: '##.##.##'"
|
1007
|
-
end
|
1008
|
-
end
|
1009
|
-
|
1010
|
-
end
|
1011
|
-
end
|