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,31 @@
|
|
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 Operation::Service
|
20
|
+
class SetDefaultTarget < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
post_body = PostBody.new(
|
24
|
+
:service_instance => args.required(:service_instance)
|
25
|
+
)
|
26
|
+
rest_post("#{BaseRoute}/set_default_target", post_body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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 Operation::Service
|
20
|
+
class SetRequiredAttributes < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
service_instance = args.required(:service_instance)
|
24
|
+
response = rest_get "#{BaseRoute}/#{service_instance}/required_attributes"
|
25
|
+
required_attributes = response.data
|
26
|
+
|
27
|
+
if required_attributes.empty?
|
28
|
+
OsUtil.print_info("No parameters to set.")
|
29
|
+
else
|
30
|
+
param_bindings = InteractiveWizard.resolve_missing_params(required_attributes)
|
31
|
+
post_body = PostBody.new(
|
32
|
+
:service_instance => service_instance,
|
33
|
+
:av_pairs_hash => param_bindings.inject(Hash.new){|h,r|h.merge(r[:id] => r[:value])}
|
34
|
+
)
|
35
|
+
rest_post "#{BaseRoute}/#{service_instance}/set_attributes", post_body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,118 @@
|
|
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 Operation::Service
|
20
|
+
class Ssh < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
service_instance = args.required(:service_instance)
|
24
|
+
node_name = args.required(:node_name)
|
25
|
+
remote_user = args[:remote_user]
|
26
|
+
|
27
|
+
if OsUtil.is_windows?
|
28
|
+
OsUtil.print_info "[NOTICE] SSH functionality is currenly not supported on Windows."
|
29
|
+
return
|
30
|
+
end
|
31
|
+
|
32
|
+
identity_file = get_identity_file(args[:identity_file])
|
33
|
+
node_info = get_node_info_for_ssh_login(node_name, service_instance)
|
34
|
+
|
35
|
+
connect(node_info, identity_file, remote_user)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def self.get_identity_file(identity_file)
|
42
|
+
if identity_file
|
43
|
+
unless File.exists?(identity_file)
|
44
|
+
raise Error::Usage, "Not able to find identity file, '#{identity_file}'"
|
45
|
+
end
|
46
|
+
elsif default_identity_file = OsUtil.dtk_identity_file_location
|
47
|
+
if File.exists?(default_identity_file)
|
48
|
+
identity_file = default_identity_file
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
identity_file
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.get_node_info_for_ssh_login(node_name, service_instance)
|
56
|
+
response = rest_get("#{BaseRoute}/#{service_instance}/info")
|
57
|
+
|
58
|
+
unless node_info = response.data(:nodes).find{ |node| node_name == node['display_name'] }
|
59
|
+
raise Error::Usage, "Cannot find info about node with id '#{node_id}'"
|
60
|
+
end
|
61
|
+
|
62
|
+
data = {}
|
63
|
+
node_properties = node_info['node_properties'] || {}
|
64
|
+
|
65
|
+
if public_dns = node_properties['ec2_public_address']
|
66
|
+
data.merge!(:public_dns => public_dns)
|
67
|
+
end
|
68
|
+
|
69
|
+
if default_login_user = default_login_user?(node_properties)
|
70
|
+
data.merge!(:default_login_user => default_login_user)
|
71
|
+
end
|
72
|
+
|
73
|
+
data
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.default_login_user?(node_properties)
|
77
|
+
if os_type = node_properties['os_type']
|
78
|
+
DefaultLoginByOSType[os_type]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
DefaultLoginByOSType = {
|
83
|
+
'ubuntu' => 'ubuntu',
|
84
|
+
'amazon-linux' => 'ec2-user'
|
85
|
+
}
|
86
|
+
|
87
|
+
def self.connect(node_info, identity_file, remote_user)
|
88
|
+
unless public_dns = node_info[:public_dns]
|
89
|
+
raise Error::Usage, "Not able to resolve instance address, has instance been stopped?"
|
90
|
+
end
|
91
|
+
|
92
|
+
unless remote_user ||= node_info[:default_login_user]
|
93
|
+
raise Error::Usage, "Retry command with a specfic login user (a default login user could not be computed)"
|
94
|
+
end
|
95
|
+
|
96
|
+
connection_string = "#{remote_user}@#{public_dns}"
|
97
|
+
|
98
|
+
ssh_command =
|
99
|
+
if identity_file
|
100
|
+
# provided PEM key
|
101
|
+
"ssh -o \"StrictHostKeyChecking no\" -o \"UserKnownHostsFile /dev/null\" -i #{identity_file} #{connection_string}"
|
102
|
+
elsif SSHUtil.ssh_reachable?(remote_user, public_dns)
|
103
|
+
# it has PUB key access
|
104
|
+
"ssh -o \"StrictHostKeyChecking no\" -o \"UserKnownHostsFile /dev/null\" #{connection_string}"
|
105
|
+
end
|
106
|
+
|
107
|
+
unless ssh_command
|
108
|
+
raise Error::Usage, "No public key access or PEM provided, please grant access or provide valid PEM key"
|
109
|
+
end
|
110
|
+
|
111
|
+
OsUtil.print("You are entering SSH terminal (#{connection_string}) ...", :yellow)
|
112
|
+
Kernel.system(ssh_command)
|
113
|
+
OsUtil.print("You are leaving SSH terminal, and returning to DTK Shell ...", :yellow)
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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 Operation::Service
|
20
|
+
class Stage < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
module_ref = args.required(:module_ref)
|
24
|
+
remove_existing = args[:remove_existing]
|
25
|
+
|
26
|
+
post_body = PostBody.new(
|
27
|
+
:namespace => module_ref.namespace,
|
28
|
+
:module_name => module_ref.module_name,
|
29
|
+
:assembly_name? => args.required(:assembly_name),
|
30
|
+
:service_name? => args[:service_name],
|
31
|
+
:version? => args[:version],
|
32
|
+
:target_service? => args[:target_service],
|
33
|
+
:is_target? => args[:is_target]
|
34
|
+
)
|
35
|
+
response = rest_post("#{BaseRoute}/create", post_body)
|
36
|
+
|
37
|
+
service_instance = response.required(:service, :name)
|
38
|
+
|
39
|
+
clone_args = {
|
40
|
+
:module_ref => module_ref,
|
41
|
+
:repo_url => response.required(:repo, :url),
|
42
|
+
:branch => response.required(:branch, :name),
|
43
|
+
:service_instance => service_instance,
|
44
|
+
:remove_existing => remove_existing
|
45
|
+
}
|
46
|
+
message = ClientModuleDir::GitRepo.clone_service_repo(clone_args)
|
47
|
+
target_dir = message.data(:target_repo_dir)
|
48
|
+
|
49
|
+
OsUtil.print_info("Service instance '#{service_instance}' has been created. In order to work with service instance, please navigate to: #{target_dir}")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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 Operation::Service
|
20
|
+
class Start < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
service_instance = args.required(:service_instance)
|
24
|
+
rest_post("#{BaseRoute}/#{service_instance}/start")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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 Operation::Service
|
20
|
+
class Stop < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
service_instance = args.required(:service_instance)
|
24
|
+
rest_post("#{BaseRoute}/#{service_instance}/stop")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -16,58 +16,48 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
module DTK::Client
|
19
|
-
class TaskStatus
|
19
|
+
class Operation::Service::TaskStatus
|
20
20
|
class RefreshMode < self
|
21
|
-
|
21
|
+
DEBUG_SLEEP_TIME = 5 #DTK::Configuration.get(:debug_task_frequency)
|
22
|
+
|
23
|
+
def task_status(opts = {})
|
22
24
|
begin
|
23
25
|
response = nil
|
24
26
|
loop do
|
25
|
-
response =
|
27
|
+
response = rest_call(opts)
|
26
28
|
return response unless response.ok?
|
27
29
|
|
28
30
|
# stop pulling when top level task succeds, fails or timeout
|
29
31
|
if response and response.data and response.data.first
|
30
|
-
#TODO: may fix in server, but now top can have non executing state but a concurrent branch can execute; so
|
31
|
-
#chanding bloew for time being
|
32
|
-
#break unless response.data.first["status"].eql? "executing"
|
33
|
-
# TODO: There is bug where we do not see executing status on start so we have to wait until at
|
34
|
-
# least one 'successed' has been found
|
35
|
-
|
36
32
|
top_task_failed = response.data.first['status'].eql?('failed')
|
37
33
|
is_pending = (response.data.select {|r|r["status"].nil? }).size > 0
|
38
34
|
is_executing = (response.data.select {|r|r["status"].eql? "executing"}).size > 0
|
39
35
|
is_failed = (response.data.select {|r|r["status"].eql? "failed"}).size > 0
|
40
36
|
is_cancelled = response.data.first["status"].eql?("cancelled")
|
41
|
-
|
42
|
-
# commented out because of DTK-1804
|
43
|
-
# when some of the converge tasks fail, stop task-status --wait and set task status to '' for remaining tasks which are not executed
|
44
|
-
# if is_failed
|
45
|
-
# response.data.each {|r| (r["status"] = "") if r["status"].eql?("executing")}
|
46
|
-
# is_cancelled = true
|
47
|
-
# end
|
37
|
+
|
48
38
|
is_cancelled = true if top_task_failed
|
49
39
|
|
50
40
|
unless (is_executing || is_pending) && !is_cancelled
|
51
41
|
system('clear')
|
52
|
-
response.print_error_table = true
|
53
|
-
response.render_table(:task_status)
|
54
|
-
return response
|
42
|
+
# response.print_error_table = true
|
43
|
+
# response.render_table(:task_status)
|
44
|
+
return response.set_render_as_table!
|
55
45
|
end
|
56
46
|
end
|
57
|
-
|
58
|
-
response.render_table(:task_status)
|
47
|
+
|
59
48
|
system('clear')
|
60
|
-
response.
|
49
|
+
response.set_render_as_table!
|
50
|
+
response.render_data
|
61
51
|
|
62
52
|
Console.wait_animation("Watching '#{@object_type}' task status [ #{DEBUG_SLEEP_TIME} seconds refresh ] ", DEBUG_SLEEP_TIME)
|
63
53
|
end
|
64
54
|
rescue Interrupt => e
|
65
55
|
puts ""
|
66
|
-
|
67
|
-
|
56
|
+
response.skip_render(true) unless response.nil?
|
57
|
+
return
|
68
58
|
end
|
69
|
-
|
70
59
|
end
|
71
60
|
end
|
72
61
|
end
|
73
62
|
end
|
63
|
+
|
@@ -16,12 +16,11 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
module DTK::Client
|
19
|
-
class TaskStatus
|
19
|
+
class Operation::Service::TaskStatus
|
20
20
|
class SnapshotMode < self
|
21
|
-
def task_status(opts={})
|
22
|
-
response =
|
23
|
-
response.
|
24
|
-
response.render_table(:task_status)
|
21
|
+
def task_status(opts = {})
|
22
|
+
response = rest_call(opts)
|
23
|
+
response.set_render_as_table!
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
class DTK::Client::TaskStatus::StreamMode::Element
|
18
|
+
class DTK::Client::Operation::Service::TaskStatus::StreamMode::Element
|
19
19
|
class Format < ::Hash
|
20
20
|
Settings = {
|
21
21
|
:task_start => {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Results
|
20
20
|
class Action < self
|
21
21
|
def initialize(element, hash)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Results
|
20
20
|
class Components < self
|
21
21
|
def render_results(results_per_node)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Results
|
20
20
|
class NodeLevel < self
|
21
21
|
def render_results(results_per_node)
|
@@ -15,12 +15,12 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element
|
19
19
|
class HierarchicalTask
|
20
20
|
class Results < self
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
require_relative('result/action')
|
22
|
+
require_relative('result/components')
|
23
|
+
require_relative('result/node_level')
|
24
24
|
|
25
25
|
def initialize(element, hash)
|
26
26
|
super
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Steps
|
20
20
|
class Action < self
|
21
21
|
def initialize(element, hash)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Steps
|
20
20
|
class Components < self
|
21
21
|
def initialize(element, hash)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element::HierarchicalTask
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element::HierarchicalTask
|
19
19
|
class Steps
|
20
20
|
class NodeLevel < self
|
21
21
|
def render_steps(steps)
|
@@ -15,12 +15,12 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element
|
19
19
|
class HierarchicalTask
|
20
20
|
class Steps < self
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
require_relative('steps/action')
|
22
|
+
require_relative('steps/components')
|
23
|
+
require_relative('steps/node_level')
|
24
24
|
|
25
25
|
private
|
26
26
|
|
@@ -15,10 +15,10 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode::Element
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode::Element
|
19
19
|
class HierarchicalTask
|
20
|
-
|
21
|
-
|
20
|
+
require_relative('hierarchical_task/result')
|
21
|
+
require_relative('hierarchical_task/steps')
|
22
22
|
|
23
23
|
def initialize(element, hash)
|
24
24
|
@type = self.class.type(hash)
|
data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/no_results.rb
RENAMED
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode
|
19
19
|
class Element
|
20
20
|
class NoResults < self
|
21
21
|
def task_end?()
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
class DTK::Client::TaskStatus::StreamMode::Element
|
18
|
+
class DTK::Client::Operation::Service::TaskStatus::StreamMode::Element
|
19
19
|
module RenderMixin
|
20
20
|
def render_line(msg, params = {})
|
21
21
|
if msg
|
data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage/render.rb
RENAMED
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
class DTK::Client::TaskStatus::StreamMode::Element::Stage
|
18
|
+
class DTK::Client::Operation::Service::TaskStatus::StreamMode::Element::Stage
|
19
19
|
module Render
|
20
20
|
module Mixin
|
21
21
|
def render
|
@@ -15,10 +15,10 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode
|
19
19
|
class Element
|
20
20
|
class Stage < self
|
21
|
-
|
21
|
+
require_relative('stage/render')
|
22
22
|
include Render::Mixin
|
23
23
|
|
24
24
|
def initialize(response_element, opts = {})
|
@@ -30,7 +30,7 @@ module DTK::Client; class TaskStatus::StreamMode
|
|
30
30
|
# :wait - amount to wait if get no results (required)
|
31
31
|
def self.get_and_render_stages(task_status_handle, opts = {})
|
32
32
|
unless wait = opts[:wait]
|
33
|
-
raise
|
33
|
+
raise Error, "opts[:wait] must be set"
|
34
34
|
end
|
35
35
|
|
36
36
|
cursor = Cursor.new
|
data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_end.rb
RENAMED
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode
|
19
19
|
class Element
|
20
20
|
class TaskEnd < self
|
21
21
|
def task_end?()
|
data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_start.rb
RENAMED
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode
|
19
19
|
class Element
|
20
20
|
class TaskStart < self
|
21
21
|
def self.get(task_status_handle, opts = {})
|
@@ -15,20 +15,20 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
module DTK::Client; class TaskStatus::StreamMode
|
18
|
+
module DTK::Client; class Operation::Service::TaskStatus::StreamMode
|
19
19
|
class Element
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
require_relative('element/format')
|
21
|
+
require_relative('element/render')
|
22
|
+
require_relative('element/hierarchical_task')
|
23
|
+
require_relative('element/task_start')
|
24
|
+
require_relative('element/task_end')
|
25
|
+
require_relative('element/stage')
|
26
|
+
require_relative('element/no_results')
|
27
27
|
include RenderMixin
|
28
28
|
|
29
29
|
def initialize(response_element, opts = {})
|
30
|
-
@response_element
|
31
|
-
@formatter
|
30
|
+
@response_element = response_element
|
31
|
+
@formatter = Format.new(response_element['type'])
|
32
32
|
@ignore_stage_level_info = opts[:ignore_stage_level_info]
|
33
33
|
end
|
34
34
|
|
@@ -48,7 +48,7 @@ module DTK::Client; class TaskStatus::StreamMode
|
|
48
48
|
# opts can have
|
49
49
|
# :ignore_stage_level_info - Boolean
|
50
50
|
def self.get_task_status_elements(task_status_handle, element_type, opts = {})
|
51
|
-
response = task_status_handle.
|
51
|
+
response = task_status_handle.rest_call(opts.merge(:form => :stream_form))
|
52
52
|
create_elements(response, opts)
|
53
53
|
end
|
54
54
|
|
@@ -57,7 +57,7 @@ module DTK::Client; class TaskStatus::StreamMode
|
|
57
57
|
def self.create_elements(response, opts = {})
|
58
58
|
response_elements = response.data
|
59
59
|
unless response_elements.kind_of?(Array)
|
60
|
-
raise
|
60
|
+
raise Error.new("Unexpected that response.data no at array")
|
61
61
|
end
|
62
62
|
response_elements.map { |el| create(el, opts) }
|
63
63
|
end
|
@@ -70,7 +70,7 @@ module DTK::Client; class TaskStatus::StreamMode
|
|
70
70
|
when :stage_start then Stage.new(response_element, {:just_render => :start}.merge(opts))
|
71
71
|
when :stage_end then Stage.new(response_element, {:just_render => :end}.merge(opts))
|
72
72
|
when :no_results then NoResults.new(response_element, opts)
|
73
|
-
else raise
|
73
|
+
else raise Error.new("Unexpected element type '#{type}'")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|