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
@@ -0,0 +1,42 @@
|
|
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
|
+
module DTK::Client
|
19
|
+
class CLI::Context
|
20
|
+
module Type
|
21
|
+
require_relative('type/top')
|
22
|
+
require_relative('type/module')
|
23
|
+
require_relative('type/service')
|
24
|
+
|
25
|
+
# This function can have the side of updating base_dsl_file_obj
|
26
|
+
def self.create_context!(base_dsl_file_obj)
|
27
|
+
if path = base_dsl_file_obj.path?
|
28
|
+
case base_dsl_file_obj.file_type.type
|
29
|
+
when :common_module
|
30
|
+
Module.new(base_dsl_file_obj)
|
31
|
+
when :service_instance
|
32
|
+
Service.new(base_dsl_file_obj)
|
33
|
+
else
|
34
|
+
raise Error, "Unexpected file_type '#{file_type.type}'"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
Top.new(base_dsl_file_obj)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/cli/context.rb
ADDED
@@ -0,0 +1,174 @@
|
|
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
|
+
module DTK::Client
|
19
|
+
module CLI
|
20
|
+
# Object that provides the context for interpreting commands
|
21
|
+
class Context
|
22
|
+
require_relative('context/type')
|
23
|
+
require_relative('context/attributes')
|
24
|
+
|
25
|
+
def self.determine_context
|
26
|
+
#testing stub
|
27
|
+
#dir_path = File.expand_path('../../examples/spark', File.dirname(__FILE__))
|
28
|
+
#base_dsl_file_obj = base_dsl_file_obj(:dir_path => dir_path)
|
29
|
+
base_dsl_file_obj = base_dsl_file_obj()
|
30
|
+
Type.create_context!(base_dsl_file_obj)
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(base_dsl_file_obj)
|
34
|
+
@base_dsl_file_obj = base_dsl_file_obj
|
35
|
+
@command_processor = Processor.default
|
36
|
+
@context_attributes = Attributes.new(self)
|
37
|
+
add_command_defs_defaults_and_hooks!
|
38
|
+
end
|
39
|
+
private :initialize
|
40
|
+
|
41
|
+
def run_and_return_response_object(argv)
|
42
|
+
@flag = true if argv.include?('-d')
|
43
|
+
@command_processor.run_and_return_response_object(argv)
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_missing(method, *args, &body)
|
47
|
+
command_processor_object_methods.include?(method) ? @command_processor.send(method, *args, &body) : super
|
48
|
+
end
|
49
|
+
|
50
|
+
def respond_to?(method)
|
51
|
+
command_processor_object_methods.include?(method) or super
|
52
|
+
end
|
53
|
+
|
54
|
+
def value_from_base_dsl_file?(key)
|
55
|
+
case key
|
56
|
+
when :module_ref
|
57
|
+
module_ref_from_base_dsl_file?
|
58
|
+
when :service_instance
|
59
|
+
service_instance_from_base_dsl_file?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
attr_reader :context_attributes, :base_dsl_file_obj
|
66
|
+
|
67
|
+
def module_ref_from_base_dsl_file?
|
68
|
+
parsed_module = base_dsl_file_obj.parse_content(:common_module_summary)
|
69
|
+
namespace = parsed_module.val(:Namespace)
|
70
|
+
module_name = parsed_module.val(:ModuleName)
|
71
|
+
version = parsed_module.val(:ModuleVersion) || 'master'
|
72
|
+
if namespace and module_name
|
73
|
+
client_dir_path = base_dsl_file_obj.parent_dir?
|
74
|
+
ModuleRef.new(:namespace => namespace, :module_name => module_name, :version => version, :client_dir_path => client_dir_path)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def service_instance_from_base_dsl_file?
|
79
|
+
#raise_error_when_missing_context(:service_instance) unless base_dsl_file_obj.file_type == DTK::DSL::FileType::ServiceInstance
|
80
|
+
base_dsl_file_obj.file_type == DTK::DSL::FileType::ServiceInstance
|
81
|
+
base_dsl_file_obj.parse_content(:service_module_summary).val(:Name)
|
82
|
+
end
|
83
|
+
|
84
|
+
# opts can have keys
|
85
|
+
# :dir_path
|
86
|
+
def set_base_dsl_file_obj!(opts = {})
|
87
|
+
opts[:flag] = @flag
|
88
|
+
@base_dsl_file_obj = self.class.base_dsl_file_obj(opts)
|
89
|
+
end
|
90
|
+
|
91
|
+
# opts can have keys
|
92
|
+
# :dir_path
|
93
|
+
def self.base_dsl_file_obj(opts = {})
|
94
|
+
opts[:flag] = false if opts[:flag].nil?
|
95
|
+
DirectoryParser.matching_file_obj?(FILE_TYPES, opts)
|
96
|
+
end
|
97
|
+
FILE_TYPES =
|
98
|
+
[
|
99
|
+
::DTK::DSL::FileType::CommonModule,
|
100
|
+
::DTK::DSL::FileType::ServiceInstance
|
101
|
+
]
|
102
|
+
|
103
|
+
def module_ref_in_options_or_context(options)
|
104
|
+
module_ref_in_options_or_context?(options) || raise_error_when_missing_context(:module_ref, options)
|
105
|
+
end
|
106
|
+
|
107
|
+
def module_ref_in_options_or_context?(options)
|
108
|
+
if options[:module_ref]
|
109
|
+
opts = {:namespace_module_name => options[:module_ref]}
|
110
|
+
opts.merge!(:version => options[:version]) if options[:version]
|
111
|
+
ModuleRef.new(opts)
|
112
|
+
else
|
113
|
+
if module_dir_path = options[:directory_path]
|
114
|
+
set_base_dsl_file_obj!(:dir_path => module_dir_path)
|
115
|
+
end
|
116
|
+
context_attributes[:module_ref]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def service_instance_in_options_or_context(options)
|
121
|
+
service_instance_in_options_or_context?(options) || raise_error_when_missing_context(:service_instance, options)
|
122
|
+
end
|
123
|
+
|
124
|
+
def service_instance_in_options_or_context?(options)
|
125
|
+
if ret = options[:service_instance]
|
126
|
+
ret
|
127
|
+
else
|
128
|
+
if module_dir_path = options[:directory_path]
|
129
|
+
set_base_dsl_file_obj!(:dir_path => module_dir_path)
|
130
|
+
end
|
131
|
+
context_attributes[:service_instance]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
ERROR_MSG_MAPPING = {
|
137
|
+
:service_instance => 'service instance',
|
138
|
+
:module_ref => 'mdoule'
|
139
|
+
}
|
140
|
+
def raise_error_when_missing_context(type, options = {})
|
141
|
+
if options["d"].nil?
|
142
|
+
@base_dsl_file_obj.raise_error_if_no_content
|
143
|
+
else
|
144
|
+
@base_dsl_file_obj.raise_error_if_no_content_flag(type)
|
145
|
+
end
|
146
|
+
# TODO: not sure if below can be reached
|
147
|
+
error_msg =
|
148
|
+
if options[:directory_path]
|
149
|
+
"Bad #{ERROR_MSG_MAPPING[type]} directory path '#{options[:directory_path]}'"
|
150
|
+
else
|
151
|
+
"This command must be executed from within a #{ERROR_MSG_MAPPING[type]} directory or a directory path must be given using option '#{option_ref(:directory_path)}'"
|
152
|
+
end
|
153
|
+
raise Error::Usage, error_msg
|
154
|
+
end
|
155
|
+
|
156
|
+
# Methods related to adding cli command definitions
|
157
|
+
def add_command_defs!
|
158
|
+
raise Error::NoMethodForConcreteClass.new(self.class)
|
159
|
+
end
|
160
|
+
|
161
|
+
def add_command_defs_defaults_and_hooks!
|
162
|
+
add_command_defaults!
|
163
|
+
add_command_defs!
|
164
|
+
add_command_hooks!
|
165
|
+
self
|
166
|
+
end
|
167
|
+
|
168
|
+
def command_processor_object_methods
|
169
|
+
@@command_processor_object_methods ||= Processor::Methods.all
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,105 @@
|
|
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
|
+
|
19
|
+
module DTK::Client; module CLI
|
20
|
+
class DirectoryParser
|
21
|
+
# For Finding relevant content when files in a vanilla file system
|
22
|
+
class FileSystem < self
|
23
|
+
# file_types - a single or array of FileObj objects
|
24
|
+
# opts can have keys
|
25
|
+
# :file_path - string
|
26
|
+
# :dir_path - string
|
27
|
+
# Returns FileObj object or nil that match a file_type
|
28
|
+
def matching_file_obj?(file_types, opts = {})
|
29
|
+
ret = nil
|
30
|
+
file_types = [file_types] unless file_types.kind_of?(Array)
|
31
|
+
|
32
|
+
file_type, file_path = matching_type_and_path?(file_types, opts)
|
33
|
+
file_obj_opts = {
|
34
|
+
dir_path: opts[:dir_path],
|
35
|
+
current_dir: OsUtil.current_dir,
|
36
|
+
content: get_content?(file_path)
|
37
|
+
}
|
38
|
+
FileObj.new(file_type, file_path, file_obj_opts)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def get_content?(file_path)
|
44
|
+
File.open(file_path).read if file_path and File.exists?(file_path)
|
45
|
+
end
|
46
|
+
|
47
|
+
# This method finds the base dsl file if it exists and returns its path
|
48
|
+
# opts can have keys:
|
49
|
+
# :dir_path
|
50
|
+
# :file_path
|
51
|
+
# returns nil or [file_type, path]
|
52
|
+
def matching_type_and_path?(file_types, opts = {})
|
53
|
+
ret = nil
|
54
|
+
flag = opts[:flag]
|
55
|
+
if path = opts[:file_path]
|
56
|
+
file_types.each do | file_type |
|
57
|
+
if file_type.matches?(path)
|
58
|
+
return [file_type, path]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
else
|
62
|
+
file_types.each do | file_type |
|
63
|
+
path_info = file_type.create_path_info
|
64
|
+
if path = most_nested_matching_file_path?(path_info, flag, :current_dir => opts[:dir_path])
|
65
|
+
return [file_type, path]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
ret
|
70
|
+
end
|
71
|
+
|
72
|
+
# return either a string file path or of match to path_info working from current directory and 'otwards'
|
73
|
+
# until base_path in path_info (if it exists)
|
74
|
+
# opts can have keys
|
75
|
+
# :current_dir if set means start from this dir; otherwise start from computed current dir
|
76
|
+
def most_nested_matching_file_path?(path_info, flag, opts = {})
|
77
|
+
base_dir = path_info.base_dir || OsUtil.home_dir
|
78
|
+
current_dir = opts[:current_dir] || OsUtil.current_dir
|
79
|
+
check_match_recurse_on_failure?(path_info, current_dir, base_dir, flag)
|
80
|
+
end
|
81
|
+
|
82
|
+
def check_match_recurse_on_failure?(path_info, current_dir, base_dir, flag)
|
83
|
+
match = matching_file_paths(current_dir, path_info)
|
84
|
+
if match.empty?
|
85
|
+
unless current_dir == base_dir
|
86
|
+
if parent_path = OsUtil.parent_dir?(current_dir)
|
87
|
+
check_match_recurse_on_failure?(path_info, parent_path, base_dir, flag) unless flag
|
88
|
+
end
|
89
|
+
end
|
90
|
+
elsif match.size == 1
|
91
|
+
match.first
|
92
|
+
else
|
93
|
+
raise Error, "Unexpected that more than one match: #{match.join(', ')}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# returns an array of strings that are file paths
|
98
|
+
def matching_file_paths(dir_path, path_info)
|
99
|
+
Dir.glob("#{dir_path}/*").select { |file_path| File.file?(file_path) and path_info.matches?(file_path) }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end; end
|
104
|
+
|
105
|
+
|
@@ -15,26 +15,23 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
class DTK::Client::Execute
|
19
|
-
class Command
|
20
|
-
dtk_require('command/rest_call')
|
21
|
-
dtk_require('command/api_call')
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
module DTK::Client::CLI
|
20
|
+
class DirectoryParser < ::DTK::DSL::DirectoryParser
|
21
|
+
require_relative('directory_parser/file_system')
|
22
|
+
# file_types - a single or array of FileObj objects
|
23
|
+
# opts can have keys
|
24
|
+
# :file_path - string
|
25
|
+
# :dir_path - string
|
26
|
+
# Returns FileObj that matches a file_typeo bject that matches a file_type in file_types
|
27
|
+
# or returns nil if no match found
|
28
|
+
def self.matching_file_obj?(file_types, opts = {})
|
29
|
+
adapter.matching_file_obj?(file_types, opts)
|
27
30
|
end
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
unless @input_hash.has_key?(key)
|
32
|
-
raise ErrorUsage.new("Missing required key '#{key}' in: #{@input_hash.inspect}")
|
33
|
-
end
|
34
|
-
@input_hash[key]
|
35
|
-
end
|
36
|
-
def optional?(key)
|
37
|
-
@input_hash[key]
|
32
|
+
def self.adapter
|
33
|
+
@adapter ||= FileSystem.new
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|
37
|
+
|
@@ -15,15 +15,19 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client
|
19
|
-
class Execute
|
20
|
-
# The order matters
|
21
|
-
dtk_require('execute/error_usage')
|
22
|
-
dtk_require('execute/command')
|
23
|
-
dtk_require('execute/command_processor')
|
24
|
-
dtk_require('execute/execute_context')
|
25
|
-
dtk_require('execute/script')
|
26
18
|
|
27
|
-
|
19
|
+
module DTK::Client
|
20
|
+
module CLI
|
21
|
+
class FileObj < ::DTK::DSL::FileObj
|
22
|
+
def parent_dir
|
23
|
+
parent_dir? || raise(Error, "Unexpected that 'file_obj.path?' is nil")
|
24
|
+
end
|
25
|
+
|
26
|
+
def parent_dir?
|
27
|
+
if path = path?
|
28
|
+
OsUtil.parent_dir(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
@@ -0,0 +1,70 @@
|
|
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
|
+
require 'gli'
|
19
|
+
module DTK::Client; module CLI
|
20
|
+
class Processor
|
21
|
+
module Plugin
|
22
|
+
class Gli
|
23
|
+
include ::GLI::App
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@response_obj = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_and_return_response_object(argv)
|
30
|
+
run(argv)
|
31
|
+
@response_obj
|
32
|
+
end
|
33
|
+
|
34
|
+
# add_command_hooks! works in conjunction with run
|
35
|
+
def add_command_hooks!
|
36
|
+
around do |_global_options, _command, _options, _arguments, code|
|
37
|
+
# It is expected that last line in code block returns response
|
38
|
+
@response_obj = code.call
|
39
|
+
end
|
40
|
+
|
41
|
+
on_error do |err|
|
42
|
+
if err.kind_of?(::GLI::BadCommandLine) or err.kind_of?(::GLI::UnknownCommand)
|
43
|
+
true # so gli mechanism processes it
|
44
|
+
elsif err.kind_of?(Error::ServerNotOkResponse)
|
45
|
+
@response_obj = err.response
|
46
|
+
nil
|
47
|
+
elsif err.kind_of?(Error)
|
48
|
+
raise err
|
49
|
+
else
|
50
|
+
raise Error::Client.new(err.message, :backtrace => err.backtrace)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_command_defaults!
|
56
|
+
program_desc 'DTK CLI tool'
|
57
|
+
version VERSION
|
58
|
+
subcommand_option_handling :normal
|
59
|
+
arguments :strict
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end; end
|
65
|
+
# monkey patch so that [global options] does not appear in help menu
|
66
|
+
class GLI::Commands::HelpModules::FullSynopsisFormatter
|
67
|
+
def global_flags_and_switches
|
68
|
+
{}
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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
|
+
module DTK::Client
|
19
|
+
module CLI
|
20
|
+
# Delegation module for wrapping third party library used to do parsing
|
21
|
+
class Processor
|
22
|
+
module Plugin
|
23
|
+
DEFAULT = :gli
|
24
|
+
DEFAULT_CLASS_NAME = "#{DEFAULT.to_s.capitalize}"
|
25
|
+
# autoload DEFAULT_CLASS_NAME.to_sym, "plugin/#{DEFAULT_PLUGIN}"
|
26
|
+
require_relative("processor/plugin/#{DEFAULT}")
|
27
|
+
def self.default_class
|
28
|
+
const_get DEFAULT_CLASS_NAME
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Methods
|
33
|
+
def self.all
|
34
|
+
[:arg_name, :command, :default_value, :desc, :flag, :switch, :add_command_defaults!, :add_command_hooks!, :run_and_return_response_object]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.default
|
39
|
+
new(Plugin.default_class)
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(plugin_class)
|
43
|
+
@plugin = plugin_class.new
|
44
|
+
end
|
45
|
+
private :initialize
|
46
|
+
|
47
|
+
def method_missing(method, *args, &body)
|
48
|
+
Methods.all.include?(method) ? @plugin.send(method, *args, &body) : super
|
49
|
+
end
|
50
|
+
|
51
|
+
def respond_to?(method)
|
52
|
+
Methods.all.include?(method) or super
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
@@ -0,0 +1,75 @@
|
|
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
|
+
module DTK::Client; module CLI
|
19
|
+
class Runner
|
20
|
+
module DTKNAccess
|
21
|
+
include ::DTK::Client
|
22
|
+
# check if .add_direct_access file exists, if not then add direct access and create .add_direct_access file
|
23
|
+
def self.resolve_direct_access(config_existed)
|
24
|
+
params = Configurator.check_direct_access
|
25
|
+
return if params[:username_exists]
|
26
|
+
|
27
|
+
OsUtil.print_info('Processing ...') if config_existed
|
28
|
+
# check to see if catalog credentials are set
|
29
|
+
conn = Session.get_connection
|
30
|
+
response = conn.post 'account/check_catalog_credentials'
|
31
|
+
|
32
|
+
# set catalog credentails
|
33
|
+
if response.ok? && !response.data(:catalog_credentials_set)
|
34
|
+
# setting up catalog credentials
|
35
|
+
catalog_creds = Configurator.ask_catalog_credentials
|
36
|
+
unless catalog_creds.empty?
|
37
|
+
post_body = {
|
38
|
+
:username => catalog_creds[:username],
|
39
|
+
:password => catalog_creds[:password],
|
40
|
+
:validate => true
|
41
|
+
}
|
42
|
+
response = conn.post 'account/set_catalog_credentials', post_body
|
43
|
+
unless response.ok?
|
44
|
+
error_message = response.error_message.gsub(/\.[ ]*$/,'')
|
45
|
+
OsUtil.print_error("#{error_message}. You will have to set catalog credentials manually ('dtk account set-catalog-credentials').")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
add_key_opts = {
|
50
|
+
:first_registration => true,
|
51
|
+
:name => "#{Session.connection_username}-client"
|
52
|
+
}
|
53
|
+
response = Operation::Account.add_key(params[:ssh_key_path], add_key_opts)
|
54
|
+
matched_pub_key = response.data(:matched_pub_key)
|
55
|
+
matched_username = response.data(:matched_username)
|
56
|
+
|
57
|
+
if !response.ok?
|
58
|
+
error_message = response.error_message.gsub(/\.[ ]*$/,'')
|
59
|
+
OsUtil.print_warning("We were not able to add access for current user. #{error_message}. In order to properly use dtk-shell you will have to add access manually ('dtk account add-ssh-key').\n")
|
60
|
+
elsif matched_pub_key
|
61
|
+
# message will be displayed by add key # TODO: Refactor this flow
|
62
|
+
OsUtil.print_warning("Provided SSH PUB key has already been added.")
|
63
|
+
Configurator.add_current_user_to_direct_access
|
64
|
+
elsif matched_username
|
65
|
+
OsUtil.print_warning("User with provided name already exists.")
|
66
|
+
else
|
67
|
+
# commented out because 'add_key' method called above will also print the same message
|
68
|
+
# OsUtil.print_info("Your SSH PUB key has been successfully added.")
|
69
|
+
Configurator.add_current_user_to_direct_access
|
70
|
+
end
|
71
|
+
response
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end; end
|
data/lib/cli/runner.rb
ADDED
@@ -0,0 +1,58 @@
|
|
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
|
+
module DTK::Client
|
19
|
+
module CLI
|
20
|
+
# Top-level entry class for dtk CLI executable
|
21
|
+
class Runner
|
22
|
+
require_relative('runner/dtkn_access')
|
23
|
+
|
24
|
+
def self.run(argv)
|
25
|
+
Error.top_level_trap_error do
|
26
|
+
Configurator.check_git
|
27
|
+
Configurator.create_missing_client_dirs
|
28
|
+
|
29
|
+
# checks if config exists and if not prompts user with questions to create a config
|
30
|
+
config_existed = Configurator.check_config_exists
|
31
|
+
|
32
|
+
raise_error_if_invalid_connection
|
33
|
+
|
34
|
+
# check if .add_direct_access file exists, if not then add direct access and create .add_direct_access file
|
35
|
+
DTKNAccess.resolve_direct_access(config_existed)
|
36
|
+
|
37
|
+
context = Context.determine_context
|
38
|
+
if response_obj = context.run_and_return_response_object(argv)
|
39
|
+
# render_response will raise Error in case of error response
|
40
|
+
render_response(response_obj)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def self.raise_error_if_invalid_connection
|
48
|
+
connection = Session.get_connection
|
49
|
+
raise Error::InvalidConnection.new(connection) if connection.connection_error?
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.render_response(response_obj)
|
53
|
+
Response::ErrorHandler.raise_if_error(response_obj)
|
54
|
+
response_obj.render_data
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/cli/version.rb
ADDED
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
development_mode=false
|
2
|
+
debug_grit=false
|
3
|
+
meta_table_ttl=7200000 # time to live (ms)
|
4
|
+
meta_constants_ttl=7200000 # time to live (ms)
|
5
|
+
meta_pretty_print_ttl=7200000 # time to live (ms)
|
6
|
+
task_check_frequency=60 # check frequency for task status threads (seconds)
|
7
|
+
tail_log_frequency=2 # assembly - frequency between requests (seconds)
|
8
|
+
debug_task_frequency=5 # assembly - frequency between requests (seconds)
|
9
|
+
auto_commit_changes=false # autocommit for modules
|
10
|
+
verbose_rest_calls=false # logging of REST calls
|
11
|
+
|
12
|
+
service_instance_location=service
|
13
|
+
module_location=component-modules
|
14
|
+
service_location=service-modules
|
15
|
+
assembly_module_base_location=assemblies
|
16
|
+
backups_location=backups
|
17
|
+
|
18
|
+
server_port=80
|
19
|
+
secure_connection=true
|
20
|
+
secure_connection_server_port=443
|