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
data/lib/view_processor.rb
DELETED
@@ -1,129 +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
|
-
module DTK
|
19
|
-
module Client
|
20
|
-
module RenderView
|
21
|
-
SIMPLE_LIST = "simple_list"
|
22
|
-
TABLE = "table_print"
|
23
|
-
PRETTY_PRINT = "hash_pretty_print"
|
24
|
-
AUG_SIMPLE_LIST = "augmented_simple_list"
|
25
|
-
end
|
26
|
-
|
27
|
-
class ViewProcessor
|
28
|
-
class << self
|
29
|
-
include Auxiliary
|
30
|
-
def render(command_class, ruby_obj, type, data_type, adapter=nil, print_error_table=false)
|
31
|
-
adapter ||= get_adapter(type,command_class,data_type)
|
32
|
-
if type == RenderView::TABLE
|
33
|
-
# for table there is only one rendering, we use command class to
|
34
|
-
# determine output of the table
|
35
|
-
adapter.render(ruby_obj, command_class, data_type, nil, print_error_table)
|
36
|
-
|
37
|
-
# saying no additional print needed (see core class)
|
38
|
-
return false
|
39
|
-
elsif ruby_obj.kind_of?(Hash)
|
40
|
-
adapter.render(ruby_obj)
|
41
|
-
elsif ruby_obj.kind_of?(Array)
|
42
|
-
ruby_obj.map{|el|render(command_class,el,type,nil,adapter)}
|
43
|
-
elsif ruby_obj.kind_of?(String)
|
44
|
-
ruby_obj
|
45
|
-
else
|
46
|
-
raise Error.new("ruby_obj has unexepected type")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def get_adapter(type,command_class,data_type=nil)
|
51
|
-
|
52
|
-
data_type_index = use_data_type_index?(command_class,data_type)
|
53
|
-
cached =
|
54
|
-
if data_type_index
|
55
|
-
((AdapterCacheAug[type]||{})[command_class]||{})[data_type_index]
|
56
|
-
else
|
57
|
-
(AdapterCache[type]||{})[command_class]
|
58
|
-
end
|
59
|
-
|
60
|
-
return cached if cached
|
61
|
-
dtk_nested_require("view_processor",type)
|
62
|
-
klass = DTK::Client.const_get "ViewProc#{cap_form(type)}"
|
63
|
-
if data_type_index
|
64
|
-
AdapterCacheAug[type] ||= Hash.new
|
65
|
-
AdapterCacheAug[type][command_class] ||= Hash.new
|
66
|
-
AdapterCacheAug[type][command_class][data_type_index] = klass.new(type,command_class,data_type_index)
|
67
|
-
else
|
68
|
-
AdapterCache[type] ||= Hash.new
|
69
|
-
AdapterCache[type][command_class] = klass.new(type,command_class)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
AdapterCache = Hash.new
|
74
|
-
AdapterCacheAug = Hash.new
|
75
|
-
end
|
76
|
-
private
|
77
|
-
def initialize(type,command_class,data_type_index=nil)
|
78
|
-
@command_class = command_class
|
79
|
-
@data_type_index = data_type_index
|
80
|
-
end
|
81
|
-
|
82
|
-
#data_type_index is used if there is adata type passed and it is different than command_class defualt data type
|
83
|
-
def self.use_data_type_index?(command_class,data_type)
|
84
|
-
if data_type
|
85
|
-
data_type_index = data_type.downcase
|
86
|
-
if data_type_index != snake_form(command_class)
|
87
|
-
data_type_index
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def get_meta(type,command_class,data_type_index=nil)
|
93
|
-
ret = nil
|
94
|
-
view = data_type_index||snake_form(command_class)
|
95
|
-
view = command_class if view.empty?
|
96
|
-
# TODO: Fix this logic, but we first need to see what to do with simple lists
|
97
|
-
if type.eql?('hash_pretty_print')
|
98
|
-
return pretty_print_meta(command_class, data_type_index)
|
99
|
-
end
|
100
|
-
|
101
|
-
begin
|
102
|
-
dtk_require("../views/#{view}/#{type}")
|
103
|
-
view_const = DTK::Client::ViewMeta.const_get cap_form(view)
|
104
|
-
ret = view_const.const_get cap_form(type)
|
105
|
-
rescue Exception
|
106
|
-
ret = failback_meta(command_class.respond_to?(:pretty_print_cols) ? command_class.pretty_print_cols() : [])
|
107
|
-
end
|
108
|
-
|
109
|
-
return ret
|
110
|
-
end
|
111
|
-
|
112
|
-
def pretty_print_meta(command_class,data_type_index=nil)
|
113
|
-
view = data_type_index||snake_form(command_class)
|
114
|
-
view = command_class if view.empty?
|
115
|
-
# content = DiskCacher.new.fetch("http://localhost/mockup/get_pp_metadata", ::DTK::Configuration.get(:meta_table_ttl))
|
116
|
-
content = DiskCacher.new.fetch("pp_metadata", ::DTK::Configuration.get(:meta_table_ttl))
|
117
|
-
raise DTK::Client::DtkError, "Pretty print metadata is empty, please contact DTK team." if content.empty?
|
118
|
-
hash_content = JSON.parse(content, {:symbolize_names => true})
|
119
|
-
(view && (not view.empty?) && hash_content[view.to_sym])||empty_pretty_print_meta()
|
120
|
-
end
|
121
|
-
|
122
|
-
def empty_pretty_print_meta()
|
123
|
-
{:top_type=>:top, :defs=>{:top_def=>[]}}
|
124
|
-
end
|
125
|
-
end
|
126
|
-
module ViewMeta
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
data/puppet/manifests/init.pp
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
class dtk_client($server_hostname)
|
2
|
-
{
|
3
|
-
include dtk_client::params
|
4
|
-
$repos = $dtk_client::params::repos
|
5
|
-
$client_user = $dtk_client::params::client_user
|
6
|
-
$client_user_homedir = $dtk_client::params::client_user_homedir
|
7
|
-
$dtk_username = $dtk_client::params::dtk_username
|
8
|
-
$dtk_password = $dtk_client::params::dtk_password
|
9
|
-
$client_src_path = $dtk_client::params::repo_targets['client']
|
10
|
-
$dtk_client_bin_path = "${client_user_homedir}/${client_src_path}/bin"
|
11
|
-
|
12
|
-
package {['thor','activesupport']:
|
13
|
-
ensure => 'installed',
|
14
|
-
provider => 'gem'
|
15
|
-
}
|
16
|
-
|
17
|
-
user { $client_user:
|
18
|
-
home => $client_homedir,
|
19
|
-
shell => '/bin/bash',
|
20
|
-
managehome => true
|
21
|
-
}
|
22
|
-
|
23
|
-
file { "${client_user_homedir}/.bash_profile":
|
24
|
-
content => template('dtk_client/bash_profile.erb'),
|
25
|
-
owner => $client_user,
|
26
|
-
require => User[$client_user]
|
27
|
-
}
|
28
|
-
|
29
|
-
file { "${client_user_homedir}/dtk/connection.conf":
|
30
|
-
content => template('dtk_client/dtkclient.erb'),
|
31
|
-
owner => $client_user,
|
32
|
-
require => User[$client_user]
|
33
|
-
}
|
34
|
-
|
35
|
-
file { '/etc/dtk/':
|
36
|
-
ensure => directory,
|
37
|
-
owner => $client_user,
|
38
|
-
require => User[$client_user]
|
39
|
-
}
|
40
|
-
|
41
|
-
file { '/etc/dtk/client.conf':
|
42
|
-
content => template('dtk_client/client.conf.erb'),
|
43
|
-
owner => $client_user,
|
44
|
-
require => File['/etc/dtk/']
|
45
|
-
}
|
46
|
-
dtk_client::github_repo { $repos:
|
47
|
-
require => User[$client_user]
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
#TODO: change to real app deployment; this only works when right keys already on node
|
52
|
-
define dtk_client::github_repo(
|
53
|
-
)
|
54
|
-
{
|
55
|
-
$repo = $name
|
56
|
-
include dtk_client::params
|
57
|
-
$repo_url = $dtk_client::params::repo_urls[$repo]
|
58
|
-
$target = $dtk_client::params::repo_targets[$repo]
|
59
|
-
$client_user = $dtk_client::params::client_user
|
60
|
-
$client_user_homedir = $dtk_client::params::client_user_homedir
|
61
|
-
|
62
|
-
$repo_target_dir = "${client_user_homedir}/${target}"
|
63
|
-
$git_clone_cmd = "git clone ${repo_url} ${repo_target_dir}"
|
64
|
-
$chown_cmd = "chown -R ${client_user} ${repo_target_dir}"
|
65
|
-
|
66
|
-
exec { "clone ${name}":
|
67
|
-
command => "${git_clone_cmd}; ${chown_cmd}",
|
68
|
-
path => ['/bin','/usr/bin'],
|
69
|
-
logoutput => true,
|
70
|
-
creates => $repo_target_dir
|
71
|
-
}
|
72
|
-
}
|
data/puppet/manifests/params.pp
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class dtk_client::params()
|
2
|
-
{
|
3
|
-
$client_user = 'dtk-client'
|
4
|
-
$dtk_username = 'joe'
|
5
|
-
$dtk_password = 'r8server'
|
6
|
-
$client_user_homedir = "/home/${client_user}"
|
7
|
-
$repos = ['client','common']
|
8
|
-
$repo_urls = {
|
9
|
-
'client' => 'git@github.com:rich-reactor8/dtk-client.git',
|
10
|
-
'common' => 'git@github.com:rich-reactor8/dtk-common.git'
|
11
|
-
}
|
12
|
-
$repo_targets = {
|
13
|
-
'client' => 'src',
|
14
|
-
'common' => 'common'
|
15
|
-
}
|
16
|
-
}
|
data/puppet/r8meta.puppet.yml
DELETED
@@ -1,35 +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
|
-
--- !omap
|
19
|
-
- dtk_client: !omap
|
20
|
-
- display_name: dtk_client
|
21
|
-
- description: DTK client
|
22
|
-
- external_ref:
|
23
|
-
class_name: dtk_client
|
24
|
-
type: puppet_class
|
25
|
-
- basic_type: service
|
26
|
-
- component_type: dtk_client
|
27
|
-
- attribute: !omap
|
28
|
-
- server_hostname: !omap
|
29
|
-
- display_name: server_hostname
|
30
|
-
- description: DTK server hostname
|
31
|
-
- data_type: string
|
32
|
-
- required: true
|
33
|
-
- external_ref:
|
34
|
-
type: puppet_attribute
|
35
|
-
path: node[dtk_client][server_hostname]
|
@@ -1 +0,0 @@
|
|
1
|
-
server_host = <%= server_hostname %>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/component_module', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
describe DTK::Client::ComponentModule do
|
8
|
-
$component_module_id = nil
|
9
|
-
|
10
|
-
context '#list' do
|
11
|
-
$component_module_list = run_from_dtk_shell('component-module list')
|
12
|
-
|
13
|
-
it "should have component module listing" do
|
14
|
-
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
15
|
-
end
|
16
|
-
|
17
|
-
unless $component_module_list.nil?
|
18
|
-
unless $component_module_list['data'].nil?
|
19
|
-
$component_module_id = $component_module_list['data'].first['id'] unless $component_module_list['data'].empty?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "#list/command" do
|
25
|
-
unless $component_module_id.nil?
|
26
|
-
output = run_from_dtk_shell("component-module #{$component_module_id} list-components")
|
27
|
-
|
28
|
-
it "should list all components for component module with id #{$component_module_id}" do
|
29
|
-
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
data/spec/dependency_spec.rb
DELETED
data/spec/dtk_shell_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.expand_path('../lib/shell', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
describe DTK::Shell do
|
4
|
-
|
5
|
-
# generic test for all task of Thor class
|
6
|
-
#test_task_interface(DTK::Client::Task)
|
7
|
-
|
8
|
-
init_shell_context()
|
9
|
-
|
10
|
-
line = 'cc /service'
|
11
|
-
execute_shell_command(line,'')
|
12
|
-
|
13
|
-
end
|
data/spec/dtk_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
|
4
|
-
include SpecThor
|
5
|
-
|
6
|
-
describe DTK::Client::Dtk do
|
7
|
-
|
8
|
-
# generic test for all task of Thor class
|
9
|
-
#test_task_interface(DTK::Client::Dtk)
|
10
|
-
|
11
|
-
context "Dtk CLI command" do
|
12
|
-
|
13
|
-
f = IO.popen('dtk')
|
14
|
-
output = f.readlines.join('')
|
15
|
-
|
16
|
-
it "should have service listing" do
|
17
|
-
output.should match(/(dtk|service|ok|status|empty|INFO|WARNING)/)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should have node listing" do
|
21
|
-
output.should match(/(dtk|node|ok|status|empty|INFO|WARNING)/)
|
22
|
-
end
|
23
|
-
|
24
|
-
# it "should have repo listing" do
|
25
|
-
# output.should include("dtk repo")
|
26
|
-
# end
|
27
|
-
|
28
|
-
it "should have task listing" do
|
29
|
-
output.should match(/(dtk|task|ok|status|empty|INFO|WARNING)/)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
data/spec/lib/spec_helper.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
# Use color in STDOUT
|
3
|
-
config.color_enabled = true
|
4
|
-
|
5
|
-
# Use color not only in STDOUT but also in pagers and files
|
6
|
-
config.tty = true
|
7
|
-
|
8
|
-
# Use the specified formatter
|
9
|
-
#config.formatter = :documentation # :progress, :html, :textmate
|
10
|
-
end
|
data/spec/lib/spec_thor.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require File.expand_path('../../lib/client', File.dirname(__FILE__))
|
2
|
-
require File.expand_path('../../lib/parser/adapters/thor', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../../lib/shell/context', File.dirname(__FILE__))
|
4
|
-
require File.expand_path('../../lib/shell/domain/context_entity', File.dirname(__FILE__))
|
5
|
-
require File.expand_path('../../lib/shell/domain/active_context', File.dirname(__FILE__))
|
6
|
-
require File.expand_path('../../lib/shell/domain/context_params', File.dirname(__FILE__))
|
7
|
-
require File.expand_path('../../lib/shell/domain/override_tasks', File.dirname(__FILE__))
|
8
|
-
Dir[File.expand_path('../../lib/shell/parse_monkey_patch.rb', File.dirname(__FILE__))].each {|file| require file }
|
9
|
-
|
10
|
-
require 'shellwords'
|
11
|
-
require 'rspec'
|
12
|
-
|
13
|
-
module SpecThor
|
14
|
-
|
15
|
-
include DTK::Client::Auxiliary
|
16
|
-
|
17
|
-
def run_from_dtk_shell(line)
|
18
|
-
args = Shellwords.split(line)
|
19
|
-
cmd = args.shift
|
20
|
-
conn = DTK::Client::Session.get_connection()
|
21
|
-
|
22
|
-
# special case for when no params are provided use help method
|
23
|
-
if (cmd == 'help' || cmd.nil?)
|
24
|
-
cmd = 'dtk'
|
25
|
-
args = ['help']
|
26
|
-
end
|
27
|
-
|
28
|
-
context = DTK::Shell::Context.new(true)
|
29
|
-
|
30
|
-
entity_name, method_name, hashed_argv, options_args = context.get_dtk_command_parameters(cmd, args)
|
31
|
-
entity_class = DTK::Client.const_get "#{cap_form(entity_name)}"
|
32
|
-
|
33
|
-
return entity_class.execute_from_cli(conn,method_name,hashed_argv,options_args,true)
|
34
|
-
end
|
35
|
-
|
36
|
-
##
|
37
|
-
# Capturing stream and returning string
|
38
|
-
def capture(stream)
|
39
|
-
begin
|
40
|
-
stream = stream.to_s
|
41
|
-
eval "$#{stream} = StringIO.new"
|
42
|
-
yield
|
43
|
-
result = eval("$#{stream}").string
|
44
|
-
ensure
|
45
|
-
eval("$#{stream} = #{stream.upcase}")
|
46
|
-
end
|
47
|
-
|
48
|
-
result
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# Method work with classes that inherit Thor class. Method will take each task
|
53
|
-
# and just run it to check for any errors. In this case internal error.
|
54
|
-
def test_task_interface(clazz)
|
55
|
-
|
56
|
-
# this will stop buffering of print method, for proper output
|
57
|
-
# STDOUT.sync = true
|
58
|
-
|
59
|
-
clazz.all_tasks.each do |a,task|
|
60
|
-
context "#{clazz.name} CLI command (#{task.name})" do
|
61
|
-
|
62
|
-
# e.g. shell execute: dtk assembly list
|
63
|
-
command = "dtk #{get_task_name(clazz.name)} #{task.name}"
|
64
|
-
|
65
|
-
print ">> Surface test for #{command} ... "
|
66
|
-
|
67
|
-
output = `#{command}`
|
68
|
-
|
69
|
-
it "should not have errors." do
|
70
|
-
output.should_not include("[INTERNAL ERROR]")
|
71
|
-
end
|
72
|
-
|
73
|
-
# test finished (print OK! in green color)
|
74
|
-
puts "\e[32mOK!\e[0m"
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
# Redirects stderr and stdout to /dev/null.
|
82
|
-
def silence_output
|
83
|
-
$stderr = File.new('/dev/null', 'w')
|
84
|
-
$stdout = File.new('/dev/null', 'w')
|
85
|
-
end
|
86
|
-
|
87
|
-
# Replace stdout and stderr so anything else is output correctly.
|
88
|
-
def enable_output
|
89
|
-
$stderr = STDOUT
|
90
|
-
$stdout = STDERR
|
91
|
-
end
|
92
|
-
|
93
|
-
def unindent(num=nil)
|
94
|
-
regex = num ? /^\s{#{num}}/ : /^\s*/
|
95
|
-
gsub(regex, '').chomp
|
96
|
-
end
|
97
|
-
|
98
|
-
private
|
99
|
-
|
100
|
-
##
|
101
|
-
# Method will take task name from class name
|
102
|
-
# e.g. DTK::Client::Assembly => assembly
|
103
|
-
def get_task_name(clazz_name)
|
104
|
-
snake_form(clazz_name.split('::').last).downcase
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
end
|
data/spec/node_template_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/node_template', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
describe DTK::Client::NodeTemplate do
|
8
|
-
$node_template_id = nil
|
9
|
-
|
10
|
-
context '#list' do
|
11
|
-
$node_template_list = run_from_dtk_shell('node-template list')
|
12
|
-
|
13
|
-
it "should have node-template listing" do
|
14
|
-
$node_template_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
15
|
-
end
|
16
|
-
|
17
|
-
unless $node_template_list.nil?
|
18
|
-
unless $node_template_list['data'].nil?
|
19
|
-
$node_template_id = $node_template_list['data'].first['id'] unless $node_template_list['data'].empty?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/spec/project_spec.rb
DELETED
data/spec/repo_spec.rb
DELETED
data/spec/response_spec.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
|
4
|
-
include SpecThor
|
5
|
-
|
6
|
-
describe DTK::Client::Response do
|
7
|
-
# before{
|
8
|
-
# @hash = {"data"=>[{"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147507731, "nodes"=>[{"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::datanode", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib"], "node_id"=>2147507717, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147507725, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::R8-C5-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506303, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147506290, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506296, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-CS-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506141, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506134, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-CS-HADOOP_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505988, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505961, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp", "hdp-hbase::zk-conn", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505978, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505973, "node_name"=>"HBASE-ZK"}], "display_name"=>"abh::R8-CS-HBASE"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506008, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505996, "node_name"=>"HBASE-slave01"}], "display_name"=>"abh::R8-CS-HBASE_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505734, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505728, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505723, "node_name"=>"HDFS-NN"}], "display_name"=>"abh::R8-CS-HDFS"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505743, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505737, "node_name"=>"HDFS-slave01"}], "display_name"=>"abh::R8-CS-HDFS_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505230, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505224, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505217, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-RH-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505240, "nodes"=>[{"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505233, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-RH-HADOOP_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505617, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505612, "node_name"=>"HBASE-ZK"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505590, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505602, "node_name"=>"HBASE-NN-JT-HM"}], "display_name"=>"abh::R8-RH-HBASE"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505637, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505625, "node_name"=>"HBASE-slave01"}], "display_name"=>"abh::R8-RH-HBASE_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505200, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505194, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505189, "node_name"=>"HDFS-NN"}], "display_name"=>"abh::R8-RH-HDFS"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505356, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib"], "node_id"=>2147505350, "node_name"=>"HDFS-slave01"}], "display_name"=>"abh::R8-RH-HDFS_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508641, "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508634, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508627, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::centos_hadoop_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508533, "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508519, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::jobtracker", "hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib"], "node_id"=>2147508526, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::hadoop_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508831, "nodes"=>[{"components"=>["hdp-hbase::master-conn", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hbase::regionserver"], "node_id"=>2147508819, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp-hadoop::smoketest_hdfs", "hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508808, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp-zookeeper", "hdp", "stdlib"], "node_id"=>2147508803, "node_name"=>"HBASE-ZK"}], "display_name"=>"abh::hbase_centos_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147493292, "nodes"=>[{"components"=>["hdp-hadoop::namenode", "hdp-hbase::master", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hbase::zk-conn"], "node_id"=>2147493278, "node_name"=>"master"}, {"components"=>["stdlib", "hdp-hadoop::namenode-conn", "hdp-hbase::regionserver", "hdp-hbase::master-conn", "hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-zookeeper", "hdp"], "node_id"=>2147493259, "node_name"=>"slave"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::client", "hdp-hadoop::smoketest_hdfs", "hdp", "stdlib"], "node_id"=>2147493271, "node_name"=>"client"}], "display_name"=>"abh::smoke"}], "status"=>"ok"}
|
9
|
-
# # @response = DTK::Client::Response.new(:assembly, @hash)
|
10
|
-
|
11
|
-
# # @response.render_table(:assembly)
|
12
|
-
# # @a = @response.render_data.to_s
|
13
|
-
# }
|
14
|
-
|
15
|
-
# it "render_table" do
|
16
|
-
|
17
|
-
# expected_table = <<-TABLE.unindent
|
18
|
-
# +------------+--------------------------+--------+-------+------------+
|
19
|
-
# | id | assembly_name | status | nodes | components |
|
20
|
-
# +------------+--------------------------+--------+-------+------------+
|
21
|
-
# | 2147507731 | abh::R8-C5-HADOOP | | 2 | |
|
22
|
-
# | 2147506303 | abh::R8-CS-HADOOP | | 2 | |
|
23
|
-
# | 2147506141 | abh::R8-CS-HADOOP_slave | | 1 | |
|
24
|
-
# | 2147505988 | abh::R8-CS-HBASE | | 3 | |
|
25
|
-
# | 2147506008 | abh::R8-CS-HBASE_slave | | 1 | |
|
26
|
-
# | 2147505734 | abh::R8-CS-HDFS | | 2 | |
|
27
|
-
# | 2147505743 | abh::R8-CS-HDFS_slave | | 1 | |
|
28
|
-
# | 2147505230 | abh::R8-RH-HADOOP | | 2 | |
|
29
|
-
# | 2147505240 | abh::R8-RH-HADOOP_slave | | 1 | |
|
30
|
-
# | 2147505617 | abh::R8-RH-HBASE | | 3 | |
|
31
|
-
# | 2147505637 | abh::R8-RH-HBASE_slave | | 1 | |
|
32
|
-
# | 2147505200 | abh::R8-RH-HDFS | | 2 | |
|
33
|
-
# | 2147505356 | abh::R8-RH-HDFS_slave | | 1 | |
|
34
|
-
# | 2147508641 | abh::centos_hadoop_smoke | | 2 | |
|
35
|
-
# | 2147508533 | abh::hadoop_smoke | | 2 | |
|
36
|
-
# | 2147508831 | abh::hbase_centos_smoke | | 3 | |
|
37
|
-
# | 2147493292 | abh::smoke | | 3 | |
|
38
|
-
# +------------+--------------------------+--------+-------+------------+
|
39
|
-
|
40
|
-
# 17 rows in set
|
41
|
-
# TABLE
|
42
|
-
|
43
|
-
# @data = [{"execution_status"=>nil, "id"=>2147507731, "display_name"=>"abh::R8-C5-HADOOP", "nodes"=>[{"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::datanode", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib"], "node_id"=>2147507717, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147507725, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506303, "display_name"=>"abh::R8-CS-HADOOP", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147506290, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506296, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506141, "display_name"=>"abh::R8-CS-HADOOP_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506134, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505988, "display_name"=>"abh::R8-CS-HBASE", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505961, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp", "hdp-hbase::zk-conn", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505978, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505973, "node_name"=>"HBASE-ZK"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506008, "display_name"=>"abh::R8-CS-HBASE_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505996, "node_name"=>"HBASE-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505734, "display_name"=>"abh::R8-CS-HDFS", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505728, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505723, "node_name"=>"HDFS-NN"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505743, "display_name"=>"abh::R8-CS-HDFS_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505737, "node_name"=>"HDFS-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505230, "display_name"=>"abh::R8-RH-HADOOP", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505224, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505217, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505240, "display_name"=>"abh::R8-RH-HADOOP_slave", "nodes"=>[{"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505233, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505617, "display_name"=>"abh::R8-RH-HBASE", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505612, "node_name"=>"HBASE-ZK"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505590, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505602, "node_name"=>"HBASE-NN-JT-HM"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505637, "display_name"=>"abh::R8-RH-HBASE_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505625, "node_name"=>"HBASE-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505200, "display_name"=>"abh::R8-RH-HDFS", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505194, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505189, "node_name"=>"HDFS-NN"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505356, "display_name"=>"abh::R8-RH-HDFS_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib"], "node_id"=>2147505350, "node_name"=>"HDFS-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508641, "display_name"=>"abh::centos_hadoop_smoke", "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508634, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508627, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508533, "display_name"=>"abh::hadoop_smoke", "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508519, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::jobtracker", "hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib"], "node_id"=>2147508526, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508831, "display_name"=>"abh::hbase_centos_smoke", "nodes"=>[{"components"=>["hdp-hbase::master-conn", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hbase::regionserver"], "node_id"=>2147508819, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp-hadoop::smoketest_hdfs", "hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508808, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp-zookeeper", "hdp", "stdlib"], "node_id"=>2147508803, "node_name"=>"HBASE-ZK"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147493292, "display_name"=>"abh::smoke", "nodes"=>[{"components"=>["hdp-hadoop::namenode", "hdp-hbase::master", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hbase::zk-conn"], "node_id"=>2147493278, "node_name"=>"master"}, {"components"=>["stdlib", "hdp-hadoop::namenode-conn", "hdp-hbase::regionserver", "hdp-hbase::master-conn", "hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-zookeeper", "hdp"], "node_id"=>2147493259, "node_name"=>"slave"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::client", "hdp-hadoop::smoketest_hdfs", "hdp", "stdlib"], "node_id"=>2147493271, "node_name"=>"client"}], "module_branch_id"=>2147485695}]
|
44
|
-
# @command_clazz = :assembly
|
45
|
-
# @data_type_clazz = "ASSEMBLY"
|
46
|
-
|
47
|
-
# @a = DTK::Client::ViewProcTablePrint.new("table_print", :assembly)
|
48
|
-
# @a.render(@data, @command_clazz, @data_type_clazz)
|
49
|
-
# end
|
50
|
-
|
51
|
-
|
52
|
-
end
|
data/spec/service_module_spec.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/service_module', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
describe DTK::Client::ServiceModule do
|
8
|
-
$about = ['assemblies']
|
9
|
-
$service_module_id = nil
|
10
|
-
|
11
|
-
context '#list' do
|
12
|
-
$service_module_list = run_from_dtk_shell('service-module list')
|
13
|
-
|
14
|
-
it "should have service modules listing" do
|
15
|
-
$service_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
16
|
-
end
|
17
|
-
|
18
|
-
unless $service_module_list.nil?
|
19
|
-
unless $service_module_list['data'].nil?
|
20
|
-
$service_module_id = $service_module_list['data'].first['id'] unless $service_module_list['data'].empty?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "#list/command" do
|
26
|
-
unless $service_module_id.nil?
|
27
|
-
$about.each do |type|
|
28
|
-
output = run_from_dtk_shell("service-module #{$service_module_id} list #{type}")
|
29
|
-
|
30
|
-
it "should list all #{type} for service module with id #{$service_module_id}" do
|
31
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|