dtk-shell 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/Gemfile_dev +13 -0
- data/README.md +121 -0
- data/bin/dtk-execute +32 -0
- data/bin/dtk-run +92 -0
- data/bin/dtk-shell +31 -0
- data/dtk-shell.gemspec +50 -0
- data/lib/auxiliary.rb +61 -0
- data/lib/bundler_monkey_patch.rb +26 -0
- data/lib/client.rb +58 -0
- data/lib/command_helper.rb +33 -0
- data/lib/command_helpers/git_repo.rb +589 -0
- data/lib/command_helpers/git_repo/merge.rb +153 -0
- data/lib/command_helpers/jenkins_client.rb +106 -0
- data/lib/command_helpers/jenkins_client/config_xml.rb +288 -0
- data/lib/command_helpers/service_importer.rb +251 -0
- data/lib/command_helpers/service_link.rb +33 -0
- data/lib/command_helpers/test_module_creator.rb +69 -0
- data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +10 -0
- data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +10 -0
- data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +5 -0
- data/lib/commands.rb +57 -0
- data/lib/commands/common/thor/access_control.rb +133 -0
- data/lib/commands/common/thor/action_result_handler.rb +74 -0
- data/lib/commands/common/thor/assembly_template.rb +92 -0
- data/lib/commands/common/thor/assembly_workspace.rb +1801 -0
- data/lib/commands/common/thor/base_command_helper.rb +59 -0
- data/lib/commands/common/thor/clone.rb +82 -0
- data/lib/commands/common/thor/common.rb +88 -0
- data/lib/commands/common/thor/common_base.rb +49 -0
- data/lib/commands/common/thor/create_target.rb +70 -0
- data/lib/commands/common/thor/edit.rb +255 -0
- data/lib/commands/common/thor/inventory_parser.rb +98 -0
- data/lib/commands/common/thor/list_diffs.rb +128 -0
- data/lib/commands/common/thor/module.rb +1011 -0
- data/lib/commands/common/thor/module/import.rb +210 -0
- data/lib/commands/common/thor/node.rb +53 -0
- data/lib/commands/common/thor/poller.rb +65 -0
- data/lib/commands/common/thor/pull_clone_changes.rb +28 -0
- data/lib/commands/common/thor/pull_from_remote.rb +152 -0
- data/lib/commands/common/thor/puppet_forge.rb +72 -0
- data/lib/commands/common/thor/purge_clone.rb +101 -0
- data/lib/commands/common/thor/push_clone_changes.rb +162 -0
- data/lib/commands/common/thor/push_to_remote.rb +94 -0
- data/lib/commands/common/thor/remotes.rb +71 -0
- data/lib/commands/common/thor/reparse.rb +40 -0
- data/lib/commands/common/thor/set_required_attributes.rb +46 -0
- data/lib/commands/thor/account.rb +239 -0
- data/lib/commands/thor/assembly.rb +356 -0
- data/lib/commands/thor/attribute.rb +79 -0
- data/lib/commands/thor/component.rb +70 -0
- data/lib/commands/thor/component_module.rb +501 -0
- data/lib/commands/thor/component_template.rb +174 -0
- data/lib/commands/thor/dependency.rb +34 -0
- data/lib/commands/thor/developer.rb +144 -0
- data/lib/commands/thor/dtk.rb +152 -0
- data/lib/commands/thor/library.rb +125 -0
- data/lib/commands/thor/node.rb +504 -0
- data/lib/commands/thor/node_template.rb +94 -0
- data/lib/commands/thor/project.rb +34 -0
- data/lib/commands/thor/provider.rb +233 -0
- data/lib/commands/thor/remotes.rb +49 -0
- data/lib/commands/thor/service.rb +941 -0
- data/lib/commands/thor/service_module.rb +914 -0
- data/lib/commands/thor/state_change.rb +25 -0
- data/lib/commands/thor/target.rb +250 -0
- data/lib/commands/thor/task.rb +116 -0
- data/lib/commands/thor/test_module.rb +310 -0
- data/lib/commands/thor/utils.rb +21 -0
- data/lib/commands/thor/workspace.rb +685 -0
- data/lib/config/cacert.pem +3785 -0
- data/lib/config/client.conf.header +20 -0
- data/lib/config/configuration.rb +99 -0
- data/lib/config/default.conf +16 -0
- data/lib/config/disk_cacher.rb +80 -0
- data/lib/configurator.rb +176 -0
- data/lib/context_router.rb +44 -0
- data/lib/core.rb +497 -0
- data/lib/domain/git_adapter.rb +412 -0
- data/lib/domain/git_error_handler.rb +64 -0
- data/lib/domain/response.rb +285 -0
- data/lib/domain/response/error_handler.rb +86 -0
- data/lib/dtk-shell/version.rb +20 -0
- data/lib/dtk_constants.rb +40 -0
- data/lib/dtk_error.rb +114 -0
- data/lib/dtk_logger.rb +126 -0
- data/lib/dtk_shell.rb +31 -0
- data/lib/error.rb +85 -0
- data/lib/execute.rb +29 -0
- data/lib/execute/cli_pure/cli_rerouter.rb +102 -0
- data/lib/execute/command.rb +40 -0
- data/lib/execute/command/api_call.rb +60 -0
- data/lib/execute/command/api_call/map.rb +60 -0
- data/lib/execute/command/api_call/service.rb +91 -0
- data/lib/execute/command/api_call/translation_term.rb +119 -0
- data/lib/execute/command/rest_call.rb +37 -0
- data/lib/execute/command_processor.rb +30 -0
- data/lib/execute/command_processor/rest_call.rb +59 -0
- data/lib/execute/error_usage.rb +21 -0
- data/lib/execute/execute_context.rb +86 -0
- data/lib/execute/execute_context/result_store.rb +37 -0
- data/lib/execute/script.rb +64 -0
- data/lib/execute/script/add_tenant.rb +121 -0
- data/lib/git-logs/git.log +0 -0
- data/lib/parser/adapters/option_parser.rb +70 -0
- data/lib/parser/adapters/thor.rb +555 -0
- data/lib/parser/adapters/thor/common_option_defs.rb +40 -0
- data/lib/require_first.rb +104 -0
- data/lib/search_hash.rb +44 -0
- data/lib/shell.rb +261 -0
- data/lib/shell/context.rb +1065 -0
- data/lib/shell/context_aux.rb +46 -0
- data/lib/shell/domain/active_context.rb +186 -0
- data/lib/shell/domain/context_entity.rb +89 -0
- data/lib/shell/domain/context_params.rb +223 -0
- data/lib/shell/domain/override_tasks.rb +88 -0
- data/lib/shell/domain/shadow_entity.rb +76 -0
- data/lib/shell/header_shell.rb +44 -0
- data/lib/shell/help_monkey_patch.rb +283 -0
- data/lib/shell/interactive_wizard.rb +225 -0
- data/lib/shell/message_queue.rb +63 -0
- data/lib/shell/parse_monkey_patch.rb +39 -0
- data/lib/shell/status_monitor.rb +124 -0
- data/lib/task_status.rb +83 -0
- data/lib/task_status/refresh_mode.rb +77 -0
- data/lib/task_status/snapshot_mode.rb +28 -0
- data/lib/task_status/stream_mode.rb +48 -0
- data/lib/task_status/stream_mode/element.rb +101 -0
- data/lib/task_status/stream_mode/element/format.rb +101 -0
- data/lib/task_status/stream_mode/element/hierarchical_task.rb +100 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result.rb +72 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/action.rb +93 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/components.rb +26 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/node_level.rb +26 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps.rb +34 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/action.rb +53 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/components.rb +53 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/node_level.rb +42 -0
- data/lib/task_status/stream_mode/element/no_results.rb +26 -0
- data/lib/task_status/stream_mode/element/render.rb +59 -0
- data/lib/task_status/stream_mode/element/stage.rb +84 -0
- data/lib/task_status/stream_mode/element/stage/render.rb +76 -0
- data/lib/task_status/stream_mode/element/task_end.rb +35 -0
- data/lib/task_status/stream_mode/element/task_start.rb +37 -0
- data/lib/util/common_util.rb +37 -0
- data/lib/util/console.rb +235 -0
- data/lib/util/dtk_puppet.rb +65 -0
- data/lib/util/module_util.rb +66 -0
- data/lib/util/os_util.rb +385 -0
- data/lib/util/permission_util.rb +31 -0
- data/lib/util/remote_dependency_util.rb +84 -0
- data/lib/util/ssh_util.rb +94 -0
- data/lib/view_processor.rb +129 -0
- data/lib/view_processor/augmented_simple_list.rb +44 -0
- data/lib/view_processor/hash_pretty_print.rb +123 -0
- data/lib/view_processor/simple_list.rb +156 -0
- data/lib/view_processor/table_print.rb +309 -0
- data/lib/violation.rb +86 -0
- data/lib/violation/attribute.rb +76 -0
- data/lib/violation/fix.rb +26 -0
- data/lib/violation/fix/result.rb +73 -0
- data/lib/violation/fix/result/error.rb +34 -0
- data/lib/violation/fix/set_attribute.rb +41 -0
- data/lib/violation/sub_classes.rb +60 -0
- data/puppet/manifests/init.pp +72 -0
- data/puppet/manifests/params.pp +16 -0
- data/puppet/r8meta.puppet.yml +35 -0
- data/puppet/templates/bash_profile.erb +2 -0
- data/puppet/templates/client.conf.erb +1 -0
- data/puppet/templates/dtkclient.erb +2 -0
- data/spec/component_module_spec.rb +34 -0
- data/spec/dependency_spec.rb +6 -0
- data/spec/dtk_shell_spec.rb +13 -0
- data/spec/dtk_spec.rb +33 -0
- data/spec/lib/spec_helper.rb +10 -0
- data/spec/lib/spec_thor.rb +108 -0
- data/spec/node_template_spec.rb +24 -0
- data/spec/project_spec.rb +6 -0
- data/spec/repo_spec.rb +7 -0
- data/spec/response_spec.rb +52 -0
- data/spec/service_module_spec.rb +38 -0
- data/spec/service_spec.rb +50 -0
- data/spec/state_change_spec.rb +7 -0
- data/spec/table_print_spec.rb +48 -0
- data/spec/target_spec.rb +57 -0
- data/spec/task_spec.rb +28 -0
- data/views/assembly/augmented_simple_list.rb +12 -0
- data/views/assembly_template/augmented_simple_list.rb +12 -0
- data/views/list_task/augmented_simple_list.rb +12 -0
- metadata +421 -0
|
@@ -0,0 +1,21 @@
|
|
|
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 Utils < CommandBaseThor
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2010-2016 dtk contributors
|
|
3
|
+
#
|
|
4
|
+
# This file is part of the dtk project.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
require 'rest_client'
|
|
19
|
+
require 'json'
|
|
20
|
+
require 'colorize'
|
|
21
|
+
dtk_require_from_base('dtk_logger')
|
|
22
|
+
dtk_require_from_base('util/os_util')
|
|
23
|
+
dtk_require_from_base('command_helper')
|
|
24
|
+
dtk_require_from_base('task_status')
|
|
25
|
+
dtk_require_common_commands('thor/edit')
|
|
26
|
+
dtk_require_common_commands('thor/purge_clone')
|
|
27
|
+
dtk_require_common_commands('thor/assembly_workspace')
|
|
28
|
+
dtk_require_common_commands('thor/action_result_handler')
|
|
29
|
+
# LOG_SLEEP_TIME_W = DTK::Configuration.get(:tail_log_frequency)
|
|
30
|
+
|
|
31
|
+
module DTK::Client
|
|
32
|
+
class Workspace < CommandBaseThor
|
|
33
|
+
no_tasks do
|
|
34
|
+
include TaskStatusMixin
|
|
35
|
+
include SetRequiredParamsMixin
|
|
36
|
+
include EditMixin
|
|
37
|
+
include PurgeCloneMixin
|
|
38
|
+
include AssemblyWorkspaceMixin
|
|
39
|
+
include ActionResultHandler
|
|
40
|
+
|
|
41
|
+
def get_workspace_name(workspace_id)
|
|
42
|
+
get_name_from_id_helper(workspace_id)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.whoami()
|
|
47
|
+
return :workspace, "assembly/list", {:subtype => 'instance'}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.pretty_print_cols()
|
|
51
|
+
PPColumns.get(:assembly)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.valid_children()
|
|
55
|
+
[:utils]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.invisible_context()
|
|
59
|
+
[:node]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# using extended_context when we want to use autocomplete from other context
|
|
63
|
+
# e.g. we are in assembly/apache context and want to create-component we will use extended context to add
|
|
64
|
+
# component-templates to autocomplete
|
|
65
|
+
def self.extended_context()
|
|
66
|
+
{
|
|
67
|
+
:context => {
|
|
68
|
+
:add_component => "component_template",
|
|
69
|
+
:create_node => "node_template",
|
|
70
|
+
:create_node_group => "node_template",
|
|
71
|
+
:add_component_dependency => "component_template",
|
|
72
|
+
:set_target => 'target'
|
|
73
|
+
},
|
|
74
|
+
:command => {
|
|
75
|
+
:edit_component_module => {
|
|
76
|
+
:endpoint => "assembly",
|
|
77
|
+
:url => "assembly/info_about",
|
|
78
|
+
:opts => {:subtype=>"instance", :about=>"modules"}
|
|
79
|
+
},
|
|
80
|
+
:push_component_module_updates => {
|
|
81
|
+
:endpoint => "assembly",
|
|
82
|
+
:url => "assembly/info_about",
|
|
83
|
+
:opts => {:subtype=>"instance", :about=>"modules"}
|
|
84
|
+
},
|
|
85
|
+
:delete_node => {
|
|
86
|
+
:endpoint => "assembly",
|
|
87
|
+
:url => "assembly/get_nodes_without_node_groups"
|
|
88
|
+
},
|
|
89
|
+
:delete_node_group => {
|
|
90
|
+
:endpoint => "assembly",
|
|
91
|
+
:url => "assembly/get_node_groups"
|
|
92
|
+
},
|
|
93
|
+
:pull_base_component_module => {
|
|
94
|
+
:endpoint => "assembly",
|
|
95
|
+
:url => "assembly/info_about",
|
|
96
|
+
:opts => {:subtype=>"instance", :about=>"modules"}
|
|
97
|
+
},
|
|
98
|
+
:action_info => {
|
|
99
|
+
:endpoint => "assembly",
|
|
100
|
+
:url => "assembly/task_action_list"
|
|
101
|
+
},
|
|
102
|
+
:exec => {
|
|
103
|
+
:endpoint => "assembly",
|
|
104
|
+
:url => "assembly/list_actions"
|
|
105
|
+
},
|
|
106
|
+
:exec_sync => {
|
|
107
|
+
:endpoint => "assembly",
|
|
108
|
+
:url => "assembly/list_actions"
|
|
109
|
+
}
|
|
110
|
+
# TODO: DEPRECATE execute_workflow
|
|
111
|
+
# :execute_workflow => {
|
|
112
|
+
# :endpoint => "assembly",
|
|
113
|
+
# :url => "assembly/task_action_list"
|
|
114
|
+
# }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# this includes children of children
|
|
120
|
+
def self.all_children()
|
|
121
|
+
# [:node, :component, :attribute]
|
|
122
|
+
[:node]
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def self.multi_context_children()
|
|
126
|
+
[[:utils],[:node, :utils]]
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def self.valid_child?(name_of_sub_context)
|
|
130
|
+
return Workspace.valid_children().include?(name_of_sub_context.to_sym)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def self.validation_list(context_params)
|
|
134
|
+
get_cached_response(:workspace, "assembly/list_with_workspace", {})
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# TODO: Hack which is necessery for the specific problem (DTK-541), something to reconsider down the line
|
|
138
|
+
# at this point not sure what would be clenear solution
|
|
139
|
+
|
|
140
|
+
# :all => include both for commands with command and identifier
|
|
141
|
+
# :command_only => only on command level
|
|
142
|
+
# :identifier_only => only on identifier level for given entity (command)
|
|
143
|
+
#
|
|
144
|
+
def self.override_allowed_methods()
|
|
145
|
+
return DTK::Shell::OverrideTasks.new({
|
|
146
|
+
:all => {
|
|
147
|
+
:node => [
|
|
148
|
+
# ['delete-component',"delete-component COMPONENT-ID [-y]","# Delete component from assembly's node"],
|
|
149
|
+
# ['list-attributes',"list-attributes","# List attributes associated with workspace's node."],
|
|
150
|
+
# ['list-components',"list-components","# List components associated with workspace's node."]
|
|
151
|
+
],
|
|
152
|
+
:component => [
|
|
153
|
+
['list-attributes',"list-attributes","# List attributes associated with given component."]
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
:command_only => {
|
|
157
|
+
:attribute => [
|
|
158
|
+
['list-attributes',"list-attributes","# List attributes."]
|
|
159
|
+
],
|
|
160
|
+
:node => [
|
|
161
|
+
# ['delete',"delete NAME/ID [-y] ","# Delete component from workspace."],
|
|
162
|
+
['delete',"delete NODE-NAME/ID [-y] ","# Delete node, terminating it if the node has been spun up."],
|
|
163
|
+
['list',"list","# List nodes."]
|
|
164
|
+
],
|
|
165
|
+
:component => [
|
|
166
|
+
['delete',"delete COMPONENT-NAME/ID [-y] ","# Delete component from workspace."],
|
|
167
|
+
['list-components',"list-components","# List components."]
|
|
168
|
+
],
|
|
169
|
+
:utils => [
|
|
170
|
+
# TODO: DTK-2027 might subsume by the dtk actions; currently server changes does not support this command
|
|
171
|
+
# ['execute-tests',"execute-tests [--component COMPONENT-NAME] [--timeout TIMEOUT]","# Execute tests. --component filters execution per component, --timeout changes default execution timeout."],
|
|
172
|
+
['get-netstats',"get-netstats","# Get netstats."],
|
|
173
|
+
['get-ps',"get-ps [--filter PATTERN]","# Get ps."],
|
|
174
|
+
['grep',"grep LOG-PATH NODE-ID-PATTERN GREP-PATTERN [--first]","# Grep log from multiple nodes. --first option returns first match (latest log entry)."],
|
|
175
|
+
['tail',"tail LOG-PATH NODE-NAME [REGEX-PATTERN] [--more]","# Tail specified number of lines from log. CTRL+C to quit."]
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
:identifier_only => {
|
|
179
|
+
:node => [
|
|
180
|
+
['add-component',"add-component COMPONENT","# Add a component to the node."],
|
|
181
|
+
['delete-component',"delete-component COMPONENT-NAME [-y]","# Delete component from workspace's node"],
|
|
182
|
+
['info',"info","# Return info about node instance belonging to given workspace."],
|
|
183
|
+
# ['link-attributes', "link-attributes TARGET-ATTR-TERM SOURCE-ATTR-TERM", "# Set TARGET-ATTR-TERM to SOURCE-ATTR-TERM."],
|
|
184
|
+
['list-attributes',"list-attributes","# List attributes associated with workspace's node."],
|
|
185
|
+
['list-components',"list-components","# List components associated with workspace's node."],
|
|
186
|
+
['set-attribute',"set-attribute ATTRIBUTE-NAME [VALUE] [-u]","# (Un)Set attribute value. The option -u will unset the attribute's value."],
|
|
187
|
+
['start', "start", "# Start node instance."],
|
|
188
|
+
['stop', "stop", "# Stop node instance."],
|
|
189
|
+
['ssh', "ssh REMOTE-USER [-i PATH-TO-PEM]","# SSH into node, optional parameters are path to identity file."]
|
|
190
|
+
],
|
|
191
|
+
|
|
192
|
+
:component => [
|
|
193
|
+
['info',"info","# Return info about component instance belonging to given node."],
|
|
194
|
+
['edit',"edit","# Edit component module related to given component."],
|
|
195
|
+
# ['edit-dsl',"edit-dsl","# Edit component module dsl file related to given component."],
|
|
196
|
+
['link-components',"link-components ANTECEDENT-CMP-NAME [DEPENDENCY-NAME]","#Link components to satisfy component dependency relationship."],
|
|
197
|
+
['list-component-links',"list-component-links","# List component's links to other components."]
|
|
198
|
+
#['unlink-components',"unlink-components SERVICE-TYPE","# Delete service link on component."]
|
|
199
|
+
# ['create-attribute',"create-attribute SERVICE-TYPE DEP-ATTR ARROW BASE-ATTR","# Create an attribute to service link."],
|
|
200
|
+
],
|
|
201
|
+
:attribute => [
|
|
202
|
+
['info',"info","# Return info about attribute instance belonging to given component."]
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}, [:utils])
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
desc "WORKSPACE-NAME/ID cancel-task [TASK-ID]", "Cancel an executing task. If task id is omitted, the most recent executing task is canceled."
|
|
209
|
+
def cancel_task(context_params)
|
|
210
|
+
cancel_task_aux(context_params)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
#desc "WORKSPACE-NAME/ID clear-tasks", "Clears the tasks that have been run already."
|
|
214
|
+
#def clear_tasks(context_params)
|
|
215
|
+
# clear_tasks_aux(context_params)
|
|
216
|
+
#end
|
|
217
|
+
|
|
218
|
+
desc "WORKSPACE-NAME/ID exec [NODE/NODE-GROUP/]ACTION [ACTION-PARAMS]", "Execute action asynchronously"
|
|
219
|
+
def exec(context_params)
|
|
220
|
+
exec_aux(context_params)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
desc "WORKSPACE-NAME/ID exec-sync [NODE/NODE-GROUP/]ACTION [ACTION-PARAMS]", "Execute action synchronously"
|
|
224
|
+
def exec_sync(context_params)
|
|
225
|
+
exec_sync_aux(context_params)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# desc "WORKSPACE-NAME/ID exec SERVICE-LEVEL-ACTION [PARAMS] [--stream-results]", "Execute a service level action"
|
|
229
|
+
# method_option 'stream-results', :aliases => '-s', :type => :boolean, :default => false, :desc => "Stream results"
|
|
230
|
+
# def exec(context_params)
|
|
231
|
+
# opts = {}
|
|
232
|
+
# opts.merge!(:mode => :stream) if context_params.pure_cli_mode or options['stream-results']
|
|
233
|
+
# converge_aux(context_params, opts)
|
|
234
|
+
# end
|
|
235
|
+
|
|
236
|
+
# TODO: DEPRECATE: keeping around for backward compatibiity but will be deprecating execute-workflow
|
|
237
|
+
# desc "WORKSPACE-NAME/ID execute-workflow WORKFLOW-ACTION [WORKFLOW-PARAMS] [-m COMMIT-MSG]", "Execute workflow.", :hide => true
|
|
238
|
+
# method_option "commit_msg",:aliases => "-m",
|
|
239
|
+
# :type => :string,
|
|
240
|
+
# :banner => "COMMIT-MSG",
|
|
241
|
+
# :desc => "Commit message"
|
|
242
|
+
# def execute_workflow(context_params)
|
|
243
|
+
# OsUtil.print_deprecate_message("Command 'execute-workflow' will be deprecated; use 'exec' instead")
|
|
244
|
+
# converge_aux(context_params)
|
|
245
|
+
# end
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
desc "WORKSPACE-NAME/ID converge [-m COMMIT-MSG] [--stream-results]", "Converge workspace instance."
|
|
249
|
+
method_option "commit_msg",:aliases => "-m" ,
|
|
250
|
+
:type => :string,
|
|
251
|
+
:banner => "COMMIT-MSG",
|
|
252
|
+
:desc => "Commit message"
|
|
253
|
+
method_option 'stream-results', :aliases => '-s', :type => :boolean, :default => false, :desc => "Stream results"
|
|
254
|
+
def converge(context_params)
|
|
255
|
+
opts = {}
|
|
256
|
+
opts.merge!(:mode => :stream) if context_params.pure_cli_mode or options['stream-results']
|
|
257
|
+
converge_aux(context_params, opts)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
desc "WORKSPACE-NAME/ID push-component-module-updates COMPONENT-MODULE-NAME [--force]", "Push changes made to a component module in the workspace to its base component module."
|
|
261
|
+
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
|
262
|
+
def push_component_module_updates(context_params)
|
|
263
|
+
push_module_updates_aux(context_params)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
desc "WORKSPACE-NAME/ID pull-base-component-module COMPONENT-MODULE-NAME [--force] [--revert]", "Pull base component module changes to component module in workspace"
|
|
267
|
+
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
|
268
|
+
method_option :revert, :type => :boolean, :default => false, :aliases => '-r'
|
|
269
|
+
def pull_base_component_module(context_params)
|
|
270
|
+
pull_base_component_module_aux(context_params)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
desc "WORKSPACE-NAME/ID push-assembly-updates [NAMESPACE:]SERVICE-MODULE-NAME/ASSEMBLY-NAME", "Push changes made to this workspace to the designated assembly."
|
|
274
|
+
def push_assembly_updates(context_params)
|
|
275
|
+
workspace_id, qualified_assembly_name = context_params.retrieve_arguments([:workspace_id!,:option_1!],method_argument_names)
|
|
276
|
+
if qualified_assembly_name =~ /(^[^\/]*)\/([^\/]*$)/
|
|
277
|
+
service_module_name, assembly_template_name = [$1,$2]
|
|
278
|
+
else
|
|
279
|
+
raise DtkError,"The term (#{qualified_assembly_name}) must have form SERVICE-MODULE-NAME/ASSEMBLY-NAME"
|
|
280
|
+
end
|
|
281
|
+
response = promote_assembly_aux(:update,workspace_id, service_module_name, assembly_template_name)
|
|
282
|
+
return response unless response.ok?
|
|
283
|
+
@@invalidate_map << :assembly
|
|
284
|
+
Response::Ok.new()
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
desc "WORKSPACE-NAME/ID create-assembly [NAMESPACE:]SERVICE-MODULE-NAME ASSEMBLY-NAME [-p] [-m DESCRIPTION]", "Create a new assembly from the workspace instance in the designated service module."
|
|
288
|
+
# The option -p will purge the workspace after assembly creation."
|
|
289
|
+
method_option :purge, :aliases => '-p', :type => :boolean, :default => false
|
|
290
|
+
method_option "description",:aliases => "-m" ,
|
|
291
|
+
:type => :string,
|
|
292
|
+
:banner => "DESCRIPTION"
|
|
293
|
+
def create_assembly(context_params)
|
|
294
|
+
workspace_id, service_module_full_name, assembly_template_name = context_params.retrieve_arguments([:workspace_id!,:option_1!,:option_2!],method_argument_names)
|
|
295
|
+
|
|
296
|
+
# need default_namespace for create-assembly because need to check if local service-module directory existst in promote_assembly_aux
|
|
297
|
+
resp = post rest_url("namespace/default_namespace_name")
|
|
298
|
+
return resp unless resp.ok?
|
|
299
|
+
default_namespace = resp.data
|
|
300
|
+
|
|
301
|
+
opts = {:default_namespace => default_namespace}
|
|
302
|
+
opts.merge!(:description => options.description) if options.description
|
|
303
|
+
response = promote_assembly_aux(:create,workspace_id,service_module_full_name,assembly_template_name,opts)
|
|
304
|
+
return response unless response.ok?
|
|
305
|
+
|
|
306
|
+
if options.purge?
|
|
307
|
+
response = purge_aux(context_params)
|
|
308
|
+
return response unless response.ok?
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
@@invalidate_map << :assembly
|
|
312
|
+
@@invalidate_map << :service
|
|
313
|
+
|
|
314
|
+
Response::Ok.new()
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
desc "WORKSPACE-NAME/ID create-attribute ATTRIBUTE-NAME [VALUE] [--type DATATYPE] [--required] [--dynamic]", "Create a new attribute and optionally assign it a value."
|
|
318
|
+
method_option :required, :type => :boolean, :default => false
|
|
319
|
+
method_option :dynamic, :type => :boolean, :default => false
|
|
320
|
+
method_option :type, :aliases => "-t"
|
|
321
|
+
def create_attribute(context_params)
|
|
322
|
+
create_attribute_aux(context_params)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
#only supported at node-level
|
|
326
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
327
|
+
desc "WORKSPACE-NAME/ID add-component COMPONENT [--auto-complete]", "Add a component to a workspace. Use --auto-complete to link components automatically"
|
|
328
|
+
method_option :auto_complete, :type => :boolean, :default => true
|
|
329
|
+
def add_component(context_params)
|
|
330
|
+
response = create_component_aux(context_params)
|
|
331
|
+
return response unless response.ok?
|
|
332
|
+
|
|
333
|
+
@@invalidate_map << :service
|
|
334
|
+
@@invalidate_map << :service_node
|
|
335
|
+
|
|
336
|
+
response
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# using ^^ before NODE-NAME to remove this command from workspace/node/node_id but show in workspace
|
|
340
|
+
desc "WORKSPACE-NAME/ID create-node ^^NODE-NAME NODE-TEMPLATE", "Add (stage) a new node in the workspace."
|
|
341
|
+
def create_node(context_params)
|
|
342
|
+
response = create_node_aux(context_params)
|
|
343
|
+
return response unless response.ok?
|
|
344
|
+
|
|
345
|
+
@@invalidate_map << :assembly
|
|
346
|
+
@@invalidate_map << :assembly_node
|
|
347
|
+
@@invalidate_map << :service
|
|
348
|
+
@@invalidate_map << :service_node
|
|
349
|
+
@@invalidate_map << :workspace
|
|
350
|
+
@@invalidate_map << :workspace_node
|
|
351
|
+
|
|
352
|
+
message = "Created node '#{response.data["display_name"]}'."
|
|
353
|
+
DTK::Client::OsUtil.print(message, :yellow)
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
desc "WORKSPACE-NAME/ID create-node-group ^^NODE-GROUP-NAME NODE-TEMPLATE [-n CARDINALITY]", "Add (stage) a new node group in the workspace."
|
|
357
|
+
method_option :cardinality, :aliases => '-n', :type => :string, :default => 1
|
|
358
|
+
def create_node_group(context_params)
|
|
359
|
+
response = create_node_group_aux(context_params)
|
|
360
|
+
return response unless response.ok?
|
|
361
|
+
|
|
362
|
+
@@invalidate_map << :assembly
|
|
363
|
+
@@invalidate_map << :assembly_node
|
|
364
|
+
@@invalidate_map << :service
|
|
365
|
+
@@invalidate_map << :service_node
|
|
366
|
+
@@invalidate_map << :workspace
|
|
367
|
+
@@invalidate_map << :workspace_node
|
|
368
|
+
|
|
369
|
+
message = "Created node group '#{response.data["display_name"]}'."
|
|
370
|
+
DTK::Client::OsUtil.print(message, :yellow)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
desc "WORKSPACE-NAME/ID link-components TARGET-CMP-NAME SOURCE-CMP-NAME [DEPENDENCY-NAME]","Link the target component to the source component."
|
|
374
|
+
def link_components(context_params)
|
|
375
|
+
link_components_aux(context_params)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
desc "delete NAME/ID [-y]", ""
|
|
379
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
380
|
+
def delete(context_params)
|
|
381
|
+
if context_params.is_last_command_eql_to?(:node)
|
|
382
|
+
response = delete_node_aux(context_params)
|
|
383
|
+
@@invalidate_map << :service_node
|
|
384
|
+
|
|
385
|
+
response
|
|
386
|
+
elsif context_params.is_last_command_eql_to?(:component)
|
|
387
|
+
response = delete_component_aux(context_params)
|
|
388
|
+
return response unless response.ok?
|
|
389
|
+
@@invalidate_map << :service_node_component
|
|
390
|
+
|
|
391
|
+
response
|
|
392
|
+
end
|
|
393
|
+
# delete_aux(context_params)
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
397
|
+
desc "WORKSPACE-NAME/ID delete-component COMPONENT-NAME [-y]","Delete component from the workspace."
|
|
398
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
399
|
+
def delete_component(context_params)
|
|
400
|
+
response = delete_component_aux(context_params)
|
|
401
|
+
|
|
402
|
+
@@invalidate_map << :service
|
|
403
|
+
@@invalidate_map << :service_node
|
|
404
|
+
@@invalidate_map << :service_node_component
|
|
405
|
+
|
|
406
|
+
return response
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
# using ^^ before NODE-NAME to remove this command from workspace/node/node_id but show in workspace
|
|
410
|
+
desc "WORKSPACE-NAME/ID delete-node ^^NODE-NAME [-y]","Delete node, terminating it if the node has been spun up."
|
|
411
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
412
|
+
def delete_node(context_params)
|
|
413
|
+
response = delete_node_aux(context_params)
|
|
414
|
+
|
|
415
|
+
@@invalidate_map << :assembly
|
|
416
|
+
@@invalidate_map << :assembly_node
|
|
417
|
+
@@invalidate_map << :service
|
|
418
|
+
@@invalidate_map << :service_node
|
|
419
|
+
@@invalidate_map << :workspace
|
|
420
|
+
@@invalidate_map << :workspace_node
|
|
421
|
+
|
|
422
|
+
return response
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
desc "WORKSPACE-NAME/ID delete-node-group ^^NODE-NAME [-y]","Delete node group and all nodes that are part of that group."
|
|
426
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
427
|
+
def delete_node_group(context_params)
|
|
428
|
+
response = delete_node_group_aux(context_params)
|
|
429
|
+
|
|
430
|
+
@@invalidate_map << :assembly
|
|
431
|
+
@@invalidate_map << :assembly_node
|
|
432
|
+
@@invalidate_map << :service
|
|
433
|
+
@@invalidate_map << :service_node
|
|
434
|
+
@@invalidate_map << :workspace
|
|
435
|
+
@@invalidate_map << :workspace_node
|
|
436
|
+
|
|
437
|
+
return response
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
desc "WORKSPACE-NAME/ID unlink-components TARGET-CMP-NAME SOURCE-CMP-NAME [DEPENDENCY-NAME]", "Remove a component link."
|
|
441
|
+
def unlink_components(context_params)
|
|
442
|
+
unlink_components_aux(context_params)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
desc "WORKSPACE-NAME/ID edit-component-module COMPONENT-MODULE-NAME", "Edit a component module used in the workspace."
|
|
446
|
+
def edit_component_module(context_params)
|
|
447
|
+
edit_module_aux(context_params)
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
# desc "WORKSPACE-NAME/ID create-workflow WORKFLOW-NAME [--from BASE-WORKFLOW-NAME]", "Create a new workflow in the workspace."
|
|
451
|
+
# method_option :from, :type => :string
|
|
452
|
+
# def create_workflow(context_params)
|
|
453
|
+
# edit_or_create_workflow_aux(context_params,:create => true,:create_from => options.from)
|
|
454
|
+
# end
|
|
455
|
+
|
|
456
|
+
desc "WORKSPACE-NAME/ID edit-action [WORKSPACE-LEVEL-ACTION]", "Edit a workflow in the workspace."
|
|
457
|
+
def edit_action(context_params)
|
|
458
|
+
edit_or_create_workflow_aux(context_params)
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
desc "WORKSPACE-NAME/ID edit-attributes [-n NODE] [-c COMPONENT] [-a ATTRIBUTE]", "Edit workspace's attributes."
|
|
462
|
+
method_option :node, :aliases => '-n'
|
|
463
|
+
method_option :component, :aliases => '-c'
|
|
464
|
+
method_option :attribute, :aliases => '-a'
|
|
465
|
+
def edit_attributes(context_params)
|
|
466
|
+
response = edit_attributes_aux(context_params)
|
|
467
|
+
|
|
468
|
+
@@invalidate_map << :assembly
|
|
469
|
+
@@invalidate_map << :assembly_node
|
|
470
|
+
@@invalidate_map << :service
|
|
471
|
+
@@invalidate_map << :service_node
|
|
472
|
+
@@invalidate_map << :workspace
|
|
473
|
+
@@invalidate_map << :workspace_node
|
|
474
|
+
|
|
475
|
+
response
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
479
|
+
desc "HIDE_FROM_BASE get-netstats", "Get netstats"
|
|
480
|
+
def get_netstats(context_params)
|
|
481
|
+
get_netstats_aux(context_params)
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
=begin
|
|
485
|
+
# TODO: DTK-2027 might subsume by the dtk actions; currently server changes does not support this command
|
|
486
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
487
|
+
desc "HIDE_FROM_BASE execute-tests [--component COMPONENT-NAME] [--timeout TIMEOUT]", "Execute tests. --component filters execution per component, --timeout changes default execution timeout"
|
|
488
|
+
method_option :component, :type => :string, :desc => "Component name"
|
|
489
|
+
method_option :timeout, :type => :string, :desc => "Timeout"
|
|
490
|
+
def execute_tests(context_params)
|
|
491
|
+
execute_tests_aux(context_params)
|
|
492
|
+
end
|
|
493
|
+
=end
|
|
494
|
+
|
|
495
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
496
|
+
desc "HIDE_FROM_BASE get-ps [--filter PATTERN]", "Get ps"
|
|
497
|
+
method_option :filter, :type => :boolean, :default => false, :aliases => '-f'
|
|
498
|
+
def get_ps(context_params)
|
|
499
|
+
get_ps_aux(context_params)
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
503
|
+
desc "HIDE_FROM_BASE grep LOG-PATH NODES-ID-PATTERN GREP-PATTERN [--first]","Grep log from multiple nodes. --first option returns first match (latest log entry)."
|
|
504
|
+
method_option :first, :type => :boolean, :default => false
|
|
505
|
+
def grep(context_params)
|
|
506
|
+
grep_aux(context_params)
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
desc "WORKSPACE-NAME/ID grant-access USER-ACCOUNT PUB-KEY-NAME [PATH-TO-PUB-KEY] [--nodes NODE-NAMES]", "Grants ssh access to user account USER-ACCOUNT for nodes in workspace"
|
|
510
|
+
method_option :nodes, :type => :string, :default => nil
|
|
511
|
+
def grant_access(context_params)
|
|
512
|
+
grant_access_aux(context_params)
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
desc "WORKSPACE-NAME/ID revoke-access USER-ACCOUNT PUB-KEY-NAME [PATH-TO-PUB-KEY] [--nodes NODE-NAMES]", "Revokes ssh access to user account USER-ACCOUNT for nodes in workspace"
|
|
516
|
+
method_option :nodes, :type => :string, :default => nil
|
|
517
|
+
def revoke_access(context_params)
|
|
518
|
+
revoke_access_aux(context_params)
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
desc "WORKSPACE-NAME/ID list-ssh-access", "List SSH access for each of the nodes"
|
|
522
|
+
def list_ssh_access(context_params)
|
|
523
|
+
list_ssh_access_aux(context_params)
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
desc "WORKSPACE-NAME/ID info", "Get info about content of the workspace."
|
|
527
|
+
def info(context_params)
|
|
528
|
+
info_aux(context_params)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
desc "WORKSPACE-NAME/ID link-attributes TARGET-ATTR SOURCE-ATTR", "Link the value of the target attribute to the source attribute."
|
|
532
|
+
def link_attributes(context_params)
|
|
533
|
+
link_attributes_aux(context_params)
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
desc "list", ""
|
|
537
|
+
def list(context_params)
|
|
538
|
+
if context_params.is_last_command_eql_to?(:node)
|
|
539
|
+
list_nodes_aux(context_params)
|
|
540
|
+
end
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
desc "WORKSPACE-NAME/ID list-attributes [-f FORMAT] [-t TAG,..] [--links] [-n NODE] [-c COMPONENT] [-a ATTRIBUTE]","List attributes associated with workspace."
|
|
544
|
+
method_option :format, :aliases => '-f'
|
|
545
|
+
method_option :tags, :aliases => '-t'
|
|
546
|
+
method_option :links, :type => :boolean, :default => false, :aliases => '-l'
|
|
547
|
+
method_option :node, :aliases => '-n'
|
|
548
|
+
method_option :component, :aliases => '-c'
|
|
549
|
+
method_option :attribute, :aliases => '-a'
|
|
550
|
+
def list_attributes(context_params)
|
|
551
|
+
list_attributes_aux(context_params)
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
desc "WORKSPACE-NAME/ID list-components [--deps]","List components associated with workspace."
|
|
555
|
+
method_option :deps, :type => :boolean, :default => false, :aliases => '-l'
|
|
556
|
+
def list_components(context_params)
|
|
557
|
+
list_components_aux(context_params)
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
desc "WORKSPACE-NAME/ID list-nodes","List nodes associated with workspace."
|
|
561
|
+
def list_nodes(context_params)
|
|
562
|
+
list_nodes_aux(context_params)
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
desc "WORKSPACE-NAME/ID list-component-links","List component links."
|
|
566
|
+
def list_component_links(context_params)
|
|
567
|
+
list_component_links_aux(context_params)
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
desc "WORKSPACE-NAME/ID list-component-modules","List component modules associated with workspace."
|
|
571
|
+
def list_component_modules(context_params)
|
|
572
|
+
list_modules_aux(context_params)
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
desc "WORKSPACE-NAME/ID list-tasks","List tasks associated with workspace."
|
|
576
|
+
def list_tasks(context_params)
|
|
577
|
+
list_tasks_aux(context_params)
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
desc "WORKSPACE-NAME/ID action-info [WORKSPACE-LEVEL-ACTION]", "Get the contents of action associated with the workspace."
|
|
581
|
+
def action_info(context_params)
|
|
582
|
+
action_info_aux(context_params)
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
desc "WORKSPACE-NAME/ID list-actions [--type TYPE]", "List the actions defined on components in the workspace."
|
|
586
|
+
method_option :type, :aliases => '-t'
|
|
587
|
+
def list_actions(context_params)
|
|
588
|
+
list_actions_aux(context_params)
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
# desc "WORKSPACE-NAME/ID list-workflows", "List the workflows associated with the workspace.", :hide => true
|
|
592
|
+
# def list_workflows(context_params)
|
|
593
|
+
# workflow_list_aux(context_params)
|
|
594
|
+
# end
|
|
595
|
+
|
|
596
|
+
desc "WORKSPACE-NAME/ID list-violations", "Finds violations in the workspace that will prevent a converge operation."
|
|
597
|
+
def list_violations(context_params)
|
|
598
|
+
list_violations_aux(context_params)
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
desc "WORKSPACE-NAME/ID print-includes", "Finds includes in the workspace."
|
|
602
|
+
def print_includes(context_params)
|
|
603
|
+
print_includes_aux(context_params)
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
desc "WORKSPACE-NAME/ID purge [-y]", "Purge the workspace, deleting and terminating any nodes that have been spun up."
|
|
607
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
608
|
+
def purge(context_params)
|
|
609
|
+
purge_aux(context_params)
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
desc "WORKSPACE-NAME/ID destroy-and-reset-nodes [-y]", "Terminates all nodes, but keeps config state so they can be spun up from scratch."
|
|
613
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
614
|
+
def destroy_and_reset_nodes(context_params)
|
|
615
|
+
destroy_and_reset_nodes_aux(context_params)
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
desc "WORKSPACE-NAME/ID set-target TARGET-NAME/ID", "Set target associated with workspace."
|
|
619
|
+
def set_target(context_params)
|
|
620
|
+
set_target_aux(context_params)
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
desc "WORKSPACE-NAME/ID set-attribute ATTRIBUTE-NAME [VALUE] [-u] [-c] [-n]", "(Un)Set attribute value. The option -u will unset the attribute's value, -c to set component-attribute, -n to set node-attribute."
|
|
624
|
+
method_option :unset, :aliases => '-u', :type => :boolean, :default => false
|
|
625
|
+
method_option :component_attribute, :aliases => '-c', :type => :boolean, :default => false
|
|
626
|
+
method_option :node_attribute, :aliases => '-n', :type => :boolean, :default => false
|
|
627
|
+
def set_attribute(context_params)
|
|
628
|
+
response = set_attribute_aux(context_params)
|
|
629
|
+
return response unless response.ok?
|
|
630
|
+
|
|
631
|
+
@@invalidate_map << :assembly
|
|
632
|
+
@@invalidate_map << :assembly_node
|
|
633
|
+
@@invalidate_map << :service
|
|
634
|
+
@@invalidate_map << :service_node
|
|
635
|
+
@@invalidate_map << :workspace
|
|
636
|
+
@@invalidate_map << :workspace_node
|
|
637
|
+
|
|
638
|
+
response
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
desc "WORKSPACE-NAME/ID set-required-attributes", "Interactive dialog to set required attributes that are not currently set"
|
|
642
|
+
def set_required_attributes(context_params)
|
|
643
|
+
workspace_id = context_params.retrieve_arguments([:workspace_id!],method_argument_names)
|
|
644
|
+
set_required_attributes_aux(workspace_id,:assembly,:instance)
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
# desc "WORKSPACE-NAME/ID start [NODE-ID-PATTERN]", "Starts all workspace's nodes, specific nodes can be selected via node id regex."
|
|
648
|
+
desc "WORKSPACE-NAME/ID start [NODE-NAME]", "Starts all the workspace nodes. A single node can be selected."
|
|
649
|
+
def start(context_params)
|
|
650
|
+
start_aux(context_params)
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# desc "WORKSPACE-NAME/ID stop [NODE-ID-PATTERN]", "Stops all workspace's nodes, specific nodes can be selected via node id regex."
|
|
654
|
+
desc "WORKSPACE-NAME/ID stop [NODE-NAME]", "Stops all the workspace nodes. A single node can be selected."
|
|
655
|
+
def stop(context_params)
|
|
656
|
+
stop_aux(context_params)
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
# using HIDE_FROM_BASE to hide this command from base context (dtk:/workspace>)
|
|
660
|
+
desc "HIDE_FROM_BASE tail LOG-PATH NODE-NAME [REGEX-PATTERN] [--more]","Tail specified number of lines from log. CTRL+C to quit."
|
|
661
|
+
method_option :more, :type => :boolean, :default => false
|
|
662
|
+
def tail(context_params)
|
|
663
|
+
tail_aux(context_params)
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
#desc "WORKSPACE-NAME/ID task-status [--wait] [--summarize]", "Get the task status of the running or last running workspace task."
|
|
667
|
+
desc "WORKSPACE-NAME/ID task-status [--mode MODE] [--summarize]", "Get the task status of the running or last running workspace task."
|
|
668
|
+
method_option "mode",:aliases => "-m" ,
|
|
669
|
+
:type => :string,
|
|
670
|
+
:banner => "MODE",
|
|
671
|
+
:desc => "Mode in which task status display; one of [stream,snapshot,refresh]; default is 'snapshot'"
|
|
672
|
+
method_option :summarize, :type => :boolean, :default => false, :aliases => '-s'
|
|
673
|
+
# TODO: leaving --wait in for backwards compatability
|
|
674
|
+
method_option :wait, :type => :boolean, :default => false
|
|
675
|
+
|
|
676
|
+
def task_status(context_params)
|
|
677
|
+
task_status_aw_aux(context_params)
|
|
678
|
+
end
|
|
679
|
+
|
|
680
|
+
desc "WORKSPACE-NAME/ID task-action-detail", "Get the task info of the running or last running workspace task."
|
|
681
|
+
def task_action_detail(context_params)
|
|
682
|
+
task_action_detail_aw_aux(context_params)
|
|
683
|
+
end
|
|
684
|
+
end
|
|
685
|
+
end
|