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,25 @@
|
|
|
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 StateChange < CommandBaseThor
|
|
20
|
+
desc "list","List pending state changes"
|
|
21
|
+
def list(context_params)
|
|
22
|
+
get rest_url("state_change/list_pending_changes")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2010-2016 dtk contributors
|
|
3
|
+
#
|
|
4
|
+
# This file is part of the dtk project.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
dtk_require_common_commands('thor/common_base')
|
|
19
|
+
dtk_require_common_commands('thor/inventory_parser')
|
|
20
|
+
dtk_require_common_commands('thor/create_target')
|
|
21
|
+
module DTK::Client
|
|
22
|
+
class Target < CommandBaseThor
|
|
23
|
+
include Commands
|
|
24
|
+
include InventoryParserMixin
|
|
25
|
+
|
|
26
|
+
def self.pretty_print_cols()
|
|
27
|
+
PPColumns.get(:target)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.alternate_identifiers()
|
|
31
|
+
return ['PROVIDER']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.extended_context()
|
|
35
|
+
{
|
|
36
|
+
:context => {
|
|
37
|
+
# want auto complete for --provider option
|
|
38
|
+
"--provider" => "provider"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc "TARGET-NAME/ID list-nodes","Lists node instances in given targets."
|
|
44
|
+
def list_nodes(context_params)
|
|
45
|
+
context_params.method_arguments = ["nodes"]
|
|
46
|
+
list(context_params)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
desc "TARGET-NAME/ID info","Provides information about specified target"
|
|
50
|
+
def info(context_params)
|
|
51
|
+
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
|
52
|
+
|
|
53
|
+
post_body = {:target_id => target_id}
|
|
54
|
+
post rest_url('target/info'), post_body
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
desc "TARGET-NAME/ID import-nodes --source SOURCE","Reads from inventory dsl and populates the node instance objects (SOURCE: file:/path/to/file.yaml)."
|
|
58
|
+
method_option :source, :type => :string
|
|
59
|
+
def import_nodes(context_params)
|
|
60
|
+
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
|
61
|
+
source = context_params.retrieve_thor_options([:source!], options)
|
|
62
|
+
|
|
63
|
+
parsed_source = source.match(/^(\w+):(.+)/)
|
|
64
|
+
raise DtkValidationError, "Invalid source! Valid source should contain source_type:source_path (e.g. --source file:path/to/file.yaml)." unless parsed_source
|
|
65
|
+
|
|
66
|
+
import_type = parsed_source[1]
|
|
67
|
+
path = parsed_source[2]
|
|
68
|
+
|
|
69
|
+
raise DtkValidationError, "We do not support '#{import_type}' as import source at the moment. Valid sources: #{ValidImportTypes}" unless ValidImportTypes.include?(import_type)
|
|
70
|
+
|
|
71
|
+
post_body = {:target_id => target_id}
|
|
72
|
+
|
|
73
|
+
if import_type.eql?('file')
|
|
74
|
+
inventory_data = parse_inventory_file(path)
|
|
75
|
+
post_body.merge!(:inventory_data => inventory_data)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
response = post rest_url("target/import_nodes"), post_body
|
|
79
|
+
return response unless response.ok?
|
|
80
|
+
|
|
81
|
+
if response.data.empty?
|
|
82
|
+
OsUtil.print("No new nodes to import!", :yellow)
|
|
83
|
+
else
|
|
84
|
+
OsUtil.print("Successfully imported nodes:", :yellow)
|
|
85
|
+
response.data.each do |node|
|
|
86
|
+
OsUtil.print("#{node}", :yellow)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
ValidImportTypes = ["file"]
|
|
91
|
+
|
|
92
|
+
desc "set-default-target TARGET-NAME","Sets the default target."
|
|
93
|
+
def set_default_target(context_params)
|
|
94
|
+
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
|
95
|
+
post rest_url("target/set_default"), { :target_id => target_id }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
desc "TARGET-NAME/ID install-agents","Install node agents on imported physical nodes."
|
|
99
|
+
def install_agents(context_params)
|
|
100
|
+
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
|
101
|
+
|
|
102
|
+
post_body = {:target_id => target_id}
|
|
103
|
+
post rest_url("target/install_agents"), post_body
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
desc "create-target-ec2-classic [TARGET-NAME] --provider PROVIDER --region REGION [--keypair KEYPAIR] [--security-group SECURITY-GROUP(S)]", "Create target based on given provider"
|
|
107
|
+
method_option :provider, :type => :string
|
|
108
|
+
method_option :region, :type => :string
|
|
109
|
+
method_option :keypair, :type => :string
|
|
110
|
+
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
|
111
|
+
def create_target_ec2_classic(context_params)
|
|
112
|
+
option_list = [:provider!, :region!, :keypair, :security_group]
|
|
113
|
+
response = Common::CreateTarget.new(self, context_params).execute(:ec2_classic,option_list)
|
|
114
|
+
@@invalidate_map << :target
|
|
115
|
+
response
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
desc "create-target-ec2-vpc [TARGET-NAME] --provider PROVIDER --region REGION --subnet SUBNET-ID [--keypair KEYPAIR] [--security-group SECURITY-GROUP(S)]", "Create target based on given provider"
|
|
119
|
+
method_option :provider, :type => :string
|
|
120
|
+
method_option :subnet, :type => :string
|
|
121
|
+
method_option :region, :type => :string
|
|
122
|
+
method_option :keypair, :type => :string
|
|
123
|
+
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
|
124
|
+
def create_target_ec2_vpc(context_params)
|
|
125
|
+
option_list = [:provider!, :subnet!, :region!, :keypair, :security_group]
|
|
126
|
+
response = Common::CreateTarget.new(self, context_params).execute(:ec2_vpc,option_list)
|
|
127
|
+
@@invalidate_map << :target
|
|
128
|
+
response
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
desc "TARGET-NAME/ID list-services","Lists service instances in given targets."
|
|
133
|
+
def list_services(context_params)
|
|
134
|
+
context_params.method_arguments = ["assemblies"]
|
|
135
|
+
list(context_params)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.validation_list(context_params)
|
|
139
|
+
provider_id = context_params.retrieve_arguments([:provider_id])
|
|
140
|
+
|
|
141
|
+
if provider_id
|
|
142
|
+
# if assembly_id is present we're loading nodes filtered by assembly_id
|
|
143
|
+
post_body = {
|
|
144
|
+
:subtype => :instance,
|
|
145
|
+
:parent_id => provider_id
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
response = get_cached_response(:provider_target, "target/list", post_body)
|
|
149
|
+
else
|
|
150
|
+
# otherwise, load all nodes
|
|
151
|
+
response = get_cached_response(:target, "target/list", { :subtype => :instance })
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
response
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
desc "list","Lists available targets."
|
|
158
|
+
def list(context_params)
|
|
159
|
+
provider_id, target_id, about = context_params.retrieve_arguments([:provider_id, :target_id, :option_1],method_argument_names||="")
|
|
160
|
+
|
|
161
|
+
if target_id.nil?
|
|
162
|
+
post_body = {
|
|
163
|
+
:subtype => :instance,
|
|
164
|
+
:parent_id => provider_id
|
|
165
|
+
}
|
|
166
|
+
response = post rest_url("target/list"), post_body
|
|
167
|
+
|
|
168
|
+
response.render_table(:target)
|
|
169
|
+
else
|
|
170
|
+
post_body = {
|
|
171
|
+
:target_id => target_id,
|
|
172
|
+
:about => about
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
case about
|
|
176
|
+
when "nodes"
|
|
177
|
+
response = post rest_url("target/info_about"), post_body
|
|
178
|
+
data_type = :node
|
|
179
|
+
when "assemblies"
|
|
180
|
+
post_body.merge!(:detail_level => 'nodes', :include_workspace => true)
|
|
181
|
+
response = post rest_url("target/info_about"), post_body
|
|
182
|
+
data_type = :assembly
|
|
183
|
+
else
|
|
184
|
+
raise_validation_error_method_usage('list')
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
response.render_table(data_type)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
desc "delete-and-destroy TARGET-NAME [-y]","Deletes target or provider"
|
|
192
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
193
|
+
def delete_and_destroy(context_params)
|
|
194
|
+
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
|
195
|
+
|
|
196
|
+
unless options.force?
|
|
197
|
+
return unless Console.confirmation_prompt("Are you sure you want to delete target '#{target_id}' (all services/nodes that belong to this target will be deleted as well)'"+'?')
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
post_body = {
|
|
201
|
+
:target_id => target_id,
|
|
202
|
+
:type => 'instance'
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@@invalidate_map << :target
|
|
206
|
+
|
|
207
|
+
response = post(rest_url("target/delete_and_destroy"),post_body)
|
|
208
|
+
return response unless response.ok?
|
|
209
|
+
if info_array = response.data['info']
|
|
210
|
+
info_array.each{|info_msg|OsUtil.print(info_msg, :yellow)}
|
|
211
|
+
end
|
|
212
|
+
Response::Ok.new()
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
=begin
|
|
216
|
+
# TODO: DTK-2056: rewite
|
|
217
|
+
also put in list property
|
|
218
|
+
desc "TARGET-NAME/ID set-property PROPERTY VALUE
|
|
219
|
+
method_option :keypair, :type => :string
|
|
220
|
+
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
|
221
|
+
def set_property(context_params)
|
|
222
|
+
raise "change so that param is seperated key value parts"
|
|
223
|
+
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
|
224
|
+
keypair, security_group = context_params.retrieve_thor_options([:keypair, :security_group], options)
|
|
225
|
+
|
|
226
|
+
raise ::DTK::Client::DtkValidationError.new("You have to provide security-group or keypair to edit target!") unless keypair || security_group
|
|
227
|
+
|
|
228
|
+
security_groups, iaas_properties = [], {}
|
|
229
|
+
iaas_properties.merge!(:keypair => keypair) if keypair
|
|
230
|
+
|
|
231
|
+
if security_group
|
|
232
|
+
raise ::DTK::Client::DtkValidationError.new("Multiple security groups should be separated with ',' and without spaces between them (e.g. --security_groups gr1,gr2,gr3,...) ") if security_group.end_with?(',')
|
|
233
|
+
security_groups = security_group.split(',')
|
|
234
|
+
if (security_groups.empty? || security_groups.size==1)
|
|
235
|
+
iaas_properties.merge!(:security_group => security_group)
|
|
236
|
+
else
|
|
237
|
+
iaas_properties.merge!(:security_group_set => security_groups)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
@@invalidate_map << :target
|
|
241
|
+
|
|
242
|
+
post_body = {
|
|
243
|
+
:target_id => target_id,
|
|
244
|
+
:iaas_properties => iaas_properties
|
|
245
|
+
}
|
|
246
|
+
post rest_url("target/set_properties"), post_body
|
|
247
|
+
end
|
|
248
|
+
=end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
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 Task < CommandBaseThor
|
|
20
|
+
|
|
21
|
+
def self.whoami()
|
|
22
|
+
return :task, "task/list", nil
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# TODO: Current bug: Disable list method invocation from /task/111111> level
|
|
26
|
+
desc "list [--list]","List tasks"
|
|
27
|
+
method_option :list, :type => :boolean, :default => false
|
|
28
|
+
def list(context_params)
|
|
29
|
+
|
|
30
|
+
#TODO: just hard coded params now
|
|
31
|
+
search_hash = SearchHash.new()
|
|
32
|
+
search_hash.cols = [:commit_message,:status,:id,:created_at,:started_at,:ended_at]
|
|
33
|
+
search_hash.filter = [:eq, ":task_id", nil] #just top level tasks
|
|
34
|
+
search_hash.set_order_by!(:created_at,"DESC")
|
|
35
|
+
response = post rest_url("task/list"), search_hash.post_body_hash()
|
|
36
|
+
|
|
37
|
+
response.render_table(:task) unless options.list?
|
|
38
|
+
return response
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc "[TASK-NAME/ID] status", "Return task status; if no TASK-ID then information about most recent task"
|
|
42
|
+
method_option "detail-level",:default => "summary", :aliases => "-d", :desc => "detail level to report task status"
|
|
43
|
+
def status(context_params)
|
|
44
|
+
task_id = context_params.retrieve_arguments([:task_id],method_argument_names)
|
|
45
|
+
detail_level = options["detail-level"]
|
|
46
|
+
post_hash_body = Hash.new
|
|
47
|
+
post_hash_body[:detail_level] = detail_level if detail_level
|
|
48
|
+
post_hash_body[:task_id] = task_id if task_id
|
|
49
|
+
post rest_url("task/status"),post_hash_body
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
desc "commit-changes", "Commit changes"
|
|
53
|
+
def commit_changes(context_params)
|
|
54
|
+
scope = context_params.retrieve_arguments([:option_1],method_argument_names)
|
|
55
|
+
post_hash_body = Hash.new
|
|
56
|
+
post_hash_body.merge!(:scope => scope) if scope
|
|
57
|
+
post rest_url("task/create_task_from_pending_changes"),post_hash_body
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
desc "TASK-NAME/ID execute", "Execute task"
|
|
61
|
+
def execute(context_params)
|
|
62
|
+
task_id = context_params.retrieve_arguments([:task_id!],method_argument_names)
|
|
63
|
+
post rest_url("task/execute"), :task_id => task_id
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
desc "commit-changes-and-execute", "Commit changes and execute task"
|
|
67
|
+
def commit_changes_and_execute(context_params)
|
|
68
|
+
response = commit_changes(context_params)
|
|
69
|
+
if response.ok?
|
|
70
|
+
execute(response.data(:task_id))
|
|
71
|
+
else
|
|
72
|
+
response
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
#alias for commit-changes-and-execute
|
|
76
|
+
desc "simple-run", "Commit changes and execute task"
|
|
77
|
+
def simple_run(context_params)
|
|
78
|
+
commit_changes_and_execute(context_params)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
desc "converge-node NODE-ID", "(Re)Converge node"
|
|
82
|
+
def converge_node(context_params)
|
|
83
|
+
node_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
|
84
|
+
|
|
85
|
+
scope = node_id && {:node_id => node_id}
|
|
86
|
+
response = post(rest_url("task/create_converge_state_changes"),scope)
|
|
87
|
+
return response unless response.ok?
|
|
88
|
+
response = commit_changes_and_execute(scope)
|
|
89
|
+
while not task_complete(response) do
|
|
90
|
+
response = status()
|
|
91
|
+
sleep(TASK_STATUS_POLLING_INTERVAL)
|
|
92
|
+
end
|
|
93
|
+
response
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
desc "converge-nodes", "(Re)Converge nodes"
|
|
97
|
+
def converge_nodes()
|
|
98
|
+
converge_node(nil)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
|
|
103
|
+
@@count = 0
|
|
104
|
+
|
|
105
|
+
TASK_STATUS_POLLING_INTERVAL = 3
|
|
106
|
+
TASK_STATUS_MAX_TIME = 60
|
|
107
|
+
|
|
108
|
+
def task_complete(response)
|
|
109
|
+
return true unless response.ok?
|
|
110
|
+
@@count += 1
|
|
111
|
+
return true if (@@count * TASK_STATUS_POLLING_INTERVAL) > TASK_STATUS_MAX_TIME
|
|
112
|
+
%w{succeeded failed}.include?(response.data(:status))
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2010-2016 dtk contributors
|
|
3
|
+
#
|
|
4
|
+
# This file is part of the dtk project.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
dtk_require_common_commands('thor/module')
|
|
19
|
+
require 'fileutils'
|
|
20
|
+
|
|
21
|
+
module DTK::Client
|
|
22
|
+
class TestModule < CommandBaseThor
|
|
23
|
+
|
|
24
|
+
no_tasks do
|
|
25
|
+
include ModuleMixin
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.valid_children()
|
|
29
|
+
# [:"component-template"]
|
|
30
|
+
[:component, :remotes]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# this includes children of children - has to be sorted by n-level access
|
|
34
|
+
def self.all_children()
|
|
35
|
+
# [:"component-template", :attribute] # Amar: attribute context commented out per Rich suggeston
|
|
36
|
+
# [:"component-template"]
|
|
37
|
+
[:component]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.multi_context_children()
|
|
41
|
+
[[:component], [:remotes], [:component, :remotes]]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.valid_child?(name_of_sub_context)
|
|
45
|
+
return TestModule.valid_children().include?(name_of_sub_context.to_sym)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.validation_list(context_params)
|
|
49
|
+
get_cached_response(:test_module, "test_module/list", {})
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.whoami()
|
|
53
|
+
return :test_module, "test_module/list", nil
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.override_allowed_methods()
|
|
57
|
+
return DTK::Shell::OverrideTasks.new(
|
|
58
|
+
{
|
|
59
|
+
:command_only => {
|
|
60
|
+
:remotes => [
|
|
61
|
+
["push-remote", "push-remote [REMOTE-NAME] [--force]", "# Push local changes to remote git repository"],
|
|
62
|
+
["list-remotes", "list-remotes", "# List git remotes for given module"],
|
|
63
|
+
["add-remote", "add-remote REMOTE-NAME REMOTE-URL", "# Add git remote for given module"],
|
|
64
|
+
["remove-remote", "remove-remote REPO-NAME [-y]", "# Remove git remote for given module"] ]
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
desc "delete TEST-MODULE-NAME [-y] [-p]", "Delete test module and all items contained in it. Optional parameter [-p] is to delete local directory."
|
|
70
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
71
|
+
method_option :purge, :aliases => '-p', :type => :boolean, :default => false
|
|
72
|
+
def delete(context_params,method_opts={})
|
|
73
|
+
response = delete_module_aux(context_params, method_opts)
|
|
74
|
+
@@invalidate_map << :test_module if response && response.ok?
|
|
75
|
+
|
|
76
|
+
response
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
desc "TEST-MODULE-NAME/ID set-attribute ATTRIBUTE-ID VALUE", "Set value of test module attributes"
|
|
80
|
+
def set_attribute(context_params)
|
|
81
|
+
set_attribute_module_aux(context_params)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
desc "list [--remote] [--diff] [-n NAMESPACE]", "List loaded or remote test modules. Use --diff to compare loaded and remote test modules."
|
|
85
|
+
method_option :remote, :type => :boolean, :default => false
|
|
86
|
+
method_option :diff, :type => :boolean, :default => false
|
|
87
|
+
method_option :namespace, :aliases => "-n" ,
|
|
88
|
+
:type => :string,
|
|
89
|
+
:banner => "NAMESPACE",
|
|
90
|
+
:desc => "List modules only in specific namespace."
|
|
91
|
+
def list(context_params)
|
|
92
|
+
return module_info_about(context_params, :components, :component) if context_params.is_there_command?(:"component")
|
|
93
|
+
|
|
94
|
+
forwarded_remote = context_params.get_forwarded_options()["remote"] if context_params.get_forwarded_options()
|
|
95
|
+
remote = options.remote? || forwarded_remote
|
|
96
|
+
action = (remote ? "list_remote" : "list")
|
|
97
|
+
|
|
98
|
+
post_body = (remote ? { :rsa_pub_key => SSHUtil.rsa_pub_key_content() } : {:detail_to_include => ["remotes"]})
|
|
99
|
+
post_body[:diff] = options.diff? ? options.diff : {}
|
|
100
|
+
post_body.merge!(:module_namespace => options.namespace)
|
|
101
|
+
|
|
102
|
+
response = post rest_url("test_module/#{action}"),post_body
|
|
103
|
+
|
|
104
|
+
return response unless response.ok?
|
|
105
|
+
response.render_table()
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
desc "TEST-MODULE-NAME/ID list-components", "List all components for given test module."
|
|
109
|
+
def list_components(context_params)
|
|
110
|
+
module_info_about(context_params, :components, :component)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
desc "TEST-MODULE-NAME/ID list-attributes", "List all attributes for given test module."
|
|
114
|
+
def list_attributes(context_params)
|
|
115
|
+
module_info_about(context_params, :attributes, :attribute_without_link)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
desc "TEST-MODULE-NAME/ID list-instances", "List all instances for given test module."
|
|
119
|
+
def list_instances(context_params)
|
|
120
|
+
module_info_about(context_params, :instances, :component)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
desc "import [NAMESPACE:]TEST-MODULE-NAME", "Create new test module from local clone"
|
|
124
|
+
def import(context_params)
|
|
125
|
+
response = import_module_aux(context_params)
|
|
126
|
+
@@invalidate_map << :test_module
|
|
127
|
+
|
|
128
|
+
response
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
#
|
|
132
|
+
# Creates component module from input git repo, removing .git dir to rid of pointing to user github, and creates component module
|
|
133
|
+
#
|
|
134
|
+
desc "import-git GIT-SSH-REPO-URL [NAMESPACE:]TEST-MODULE-NAME", "Create new local test module by importing from provided git repo URL"
|
|
135
|
+
def import_git(context_params)
|
|
136
|
+
response = import_git_module_aux(context_params)
|
|
137
|
+
@@invalidate_map << :test_module
|
|
138
|
+
response
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
desc "install NAMESPACE/REMOTE-TEST-MODULE-NAME","Install remote test module into local environment"
|
|
142
|
+
method_option "repo-manager",:aliases => "-r" ,
|
|
143
|
+
:type => :string,
|
|
144
|
+
:banner => "REPO-MANAGER",
|
|
145
|
+
:desc => "DTK Repo Manager from which to resolve requested module."
|
|
146
|
+
def install(context_params)
|
|
147
|
+
response = install_module_aux(context_params)
|
|
148
|
+
@@invalidate_map << :test_module if response && response.ok?
|
|
149
|
+
|
|
150
|
+
response
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
desc "create [NAMESPACE:]TEST-MODULE-NAME", "Create template test module and generate all needed test module helper files"
|
|
154
|
+
def create(context_params)
|
|
155
|
+
create_test_module_aux(context_params)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
desc "delete-from-catalog NAMESPACE/REMOTE-TEST-MODULE-NAME [-y] [--force]", "Delete the test module from the DTK Network catalog"
|
|
159
|
+
method_option :confirmed, :aliases => '-y', :type => :boolean, :default => false
|
|
160
|
+
method_option :force, :type => :boolean, :default => false
|
|
161
|
+
def delete_from_catalog(context_params)
|
|
162
|
+
delete_from_catalog_aux(context_params)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
desc "TEST-MODULE-NAME/ID publish [[NAMESPACE/]REMOTE-TEST-MODULE-NAME]", "Publish test module to remote repository."
|
|
166
|
+
def publish(context_params)
|
|
167
|
+
publish_module_aux(context_params)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
desc "TEST-MODULE-NAME/ID update [-n NAMESPACE] [--force]", "Update local test module from remote repository."
|
|
171
|
+
method_option :namespace,:aliases => '-n',
|
|
172
|
+
:type => :string,
|
|
173
|
+
:banner => "NAMESPACE",
|
|
174
|
+
:desc => "Remote namespace"
|
|
175
|
+
method_option :force,:aliases => '-f',
|
|
176
|
+
:type => :boolean,
|
|
177
|
+
:desc => "Force pull",
|
|
178
|
+
:default => false
|
|
179
|
+
def update(context_params)
|
|
180
|
+
update_aux(context_params)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
desc "TEST-MODULE-NAME/ID chmod PERMISSION-SELECTOR", "Update remote permissions e.g. ug+rw , user and group get RW permissions"
|
|
184
|
+
method_option "namespace", :aliases => "-n", :type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
185
|
+
def chmod(context_params)
|
|
186
|
+
chmod_module_aux(context_params)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
desc "TEST-MODULE-NAME/ID make-public", "Make this module public"
|
|
190
|
+
method_option "namespace", :aliases => "-n", :type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
191
|
+
def make_public(context_params)
|
|
192
|
+
make_public_module_aux(context_params)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
desc "TEST-MODULE-NAME/ID make-private", "Make this module private"
|
|
196
|
+
method_option "namespace", :aliases => "-n", :type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
197
|
+
def make_private(context_params)
|
|
198
|
+
make_private_module_aux(context_params)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
desc "TEST-MODULE-NAME/ID add-collaborators", "Add collabrators users or groups comma seperated (--users or --groups)"
|
|
202
|
+
method_option "namespace", :aliases => "-n", :type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
203
|
+
method_option "users",:aliases => "-u", :type => :string, :banner => "USERS", :desc => "User collabrators"
|
|
204
|
+
method_option "groups",:aliases => "-g", :type => :string, :banner => "GROUPS", :desc => "Group collabrators"
|
|
205
|
+
def add_collaborators(context_params)
|
|
206
|
+
add_collaborators_module_aux(context_params)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
desc "TEST-MODULE-NAME/ID remove-collaborators", "Remove collabrators users or groups comma seperated (--users or --groups)"
|
|
210
|
+
method_option "namespace",:aliases => "-n",:type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
211
|
+
method_option "users",:aliases => "-u", :type => :string, :banner => "USERS", :desc => "User collabrators"
|
|
212
|
+
method_option "groups",:aliases => "-g", :type => :string, :banner => "GROUPS", :desc => "Group collabrators"
|
|
213
|
+
def remove_collaborators(context_params)
|
|
214
|
+
remove_collaborators_module_aux(context_params)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
desc "TEST-MODULE-NAME/ID list-collaborators", "List collaborators for given module"
|
|
218
|
+
method_option "namespace",:aliases => "-n",:type => :string, :banner => "NAMESPACE", :desc => "Remote namespace"
|
|
219
|
+
def list_collaborators(context_params)
|
|
220
|
+
list_collaborators_module_aux(context_params)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
desc "TEST-MODULE-NAME/ID clone [-n]", "Locally clone test module and test files. Use -n to skip edit prompt"
|
|
224
|
+
method_option :skip_edit, :aliases => '-n', :type => :boolean, :default => false
|
|
225
|
+
def clone(context_params, internal_trigger=false)
|
|
226
|
+
clone_module_aux(context_params, internal_trigger)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
desc "TEST-MODULE-NAME/ID edit","Switch to unix editing for given test module."
|
|
230
|
+
def edit(context_params)
|
|
231
|
+
edit_module_aux(context_params)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
desc "TEST-MODULE-NAME/ID push [--force] [--docs]", "Push changes from local copy of test module to server"
|
|
235
|
+
version_method_option
|
|
236
|
+
method_option "message",:aliases => "-m" ,
|
|
237
|
+
:type => :string,
|
|
238
|
+
:banner => "COMMIT-MSG",
|
|
239
|
+
:desc => "Commit message"
|
|
240
|
+
# hidden option for dev
|
|
241
|
+
method_option 'force-parse', :aliases => '-f', :type => :boolean, :default => false
|
|
242
|
+
method_option :force, :type => :boolean, :default => false
|
|
243
|
+
method_option :docs, :type => :boolean, :default => false, :aliases => '-d'
|
|
244
|
+
def push(context_params, internal_trigger=false)
|
|
245
|
+
push_module_aux(context_params, internal_trigger)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
desc "TEST-MODULE-NAME/ID push-dtkn [-n NAMESPACE] [--force]", "Push changes from local copy of test module to remote repository (dtkn)."
|
|
249
|
+
method_option "message",:aliases => "-m" ,
|
|
250
|
+
:type => :string,
|
|
251
|
+
:banner => "COMMIT-MSG",
|
|
252
|
+
:desc => "Commit message"
|
|
253
|
+
method_option "namespace",:aliases => "-n",
|
|
254
|
+
:type => :string,
|
|
255
|
+
:banner => "NAMESPACE",
|
|
256
|
+
:desc => "Remote namespace"
|
|
257
|
+
#hidden option for dev
|
|
258
|
+
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
|
259
|
+
def push_dtkn(context_params, internal_trigger=false)
|
|
260
|
+
push_dtkn_module_aux(context_params, internal_trigger)
|
|
261
|
+
end
|
|
262
|
+
PushCatalogs = ["origin", "dtkn"]
|
|
263
|
+
|
|
264
|
+
desc "TEST-MODULE-NAME/ID list-diffs", "List diffs between module on server and remote repo"
|
|
265
|
+
method_option :remote, :type => :boolean, :default => false
|
|
266
|
+
def list_diffs(context_params)
|
|
267
|
+
list_remote_module_diffs(context_params)
|
|
268
|
+
# list_diffs_module_aux(context_params)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# REMOTE INTERACTION
|
|
272
|
+
|
|
273
|
+
desc "HIDE_FROM_BASE push-remote [REMOTE-NAME] [--force]", "Push local changes to remote git repository"
|
|
274
|
+
method_option :force, :type => :boolean, :default => false
|
|
275
|
+
def push_remote(context_params)
|
|
276
|
+
push_remote_module_aux(context_params)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
desc "HIDE_FROM_BASE list-remotes", "List git remotes for given module"
|
|
280
|
+
def list_remotes(context_params)
|
|
281
|
+
remote_list_aux(context_params)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
desc "HIDE_FROM_BASE add-remote REMOTE-NAME REMOTE-URL", "Add git remote for given module"
|
|
285
|
+
def add_remote(context_params)
|
|
286
|
+
remote_add_aux(context_params)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
desc "HIDE_FROM_BASE remove-remote REPO-NAME [-y]", "Remove git remote for given module"
|
|
290
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
|
291
|
+
def remove_remote(context_params)
|
|
292
|
+
remote_remove_aux(context_params)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
#
|
|
296
|
+
# DEVELOPMENT MODE METHODS
|
|
297
|
+
#
|
|
298
|
+
if DTK::Configuration.get(:development_mode)
|
|
299
|
+
desc "delete-all","Delete all service modules"
|
|
300
|
+
def delete_all(context_params)
|
|
301
|
+
return unless Console.confirmation_prompt("This will DELETE ALL test modules, are you sure"+'?')
|
|
302
|
+
response = list(context_params)
|
|
303
|
+
|
|
304
|
+
response.data().each do |e|
|
|
305
|
+
run_shell_command("delete #{e['display_name']} -y -p")
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|