dtk-client 0.7.4.1 → 0.7.5
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 +4 -4
- data/bin/dtk +10 -3
- data/bin/dtk-shell +1 -1
- data/lib/command_helpers/git_repo.rb +26 -20
- data/lib/command_helpers/jenkins_client.rb +4 -3
- data/lib/command_helpers/service_importer.rb +37 -25
- data/lib/commands.rb +2 -2
- data/lib/commands/common/thor/assembly_workspace.rb +185 -173
- data/lib/commands/common/thor/base_command_helper.rb +42 -0
- data/lib/commands/common/thor/clone.rb +1 -1
- data/lib/commands/common/thor/module.rb +37 -58
- data/lib/commands/common/thor/module/import.rb +1 -1
- data/lib/commands/common/thor/pull_from_remote.rb +7 -12
- data/lib/commands/common/thor/purge_clone.rb +1 -1
- data/lib/commands/common/thor/push_clone_changes.rb +3 -1
- data/lib/commands/common/thor/task_status.rb +52 -75
- data/lib/commands/common/thor/task_status/refresh_mode.rb +56 -0
- data/lib/commands/common/thor/task_status/snapshot_mode.rb +11 -0
- data/lib/commands/common/thor/task_status/stream_mode.rb +31 -0
- data/lib/commands/common/thor/task_status/stream_mode/element.rb +90 -0
- data/lib/commands/common/thor/task_status/stream_mode/element/no_results.rb +10 -0
- data/lib/commands/common/thor/task_status/stream_mode/element/render.rb +88 -0
- data/lib/commands/common/thor/task_status/stream_mode/element/stage.rb +13 -0
- data/lib/commands/common/thor/task_status/stream_mode/element/task_end.rb +10 -0
- data/lib/commands/common/thor/task_status/stream_mode/element/task_start.rb +10 -0
- data/lib/commands/thor/account.rb +10 -8
- data/lib/commands/thor/assembly.rb +9 -2
- data/lib/commands/thor/component_module.rb +0 -52
- data/lib/commands/thor/library.rb +1 -0
- data/lib/commands/thor/node.rb +1 -36
- data/lib/commands/thor/node_template.rb +4 -47
- data/lib/commands/thor/service.rb +57 -46
- data/lib/commands/thor/service_module.rb +2 -49
- data/lib/commands/thor/target.rb +7 -7
- data/lib/commands/thor/workspace.rb +44 -27
- data/lib/context_router.rb +4 -0
- data/lib/core.rb +71 -99
- data/lib/domain/response.rb +9 -0
- data/lib/domain/response/error_handler.rb +61 -0
- data/lib/dtk-client/version.rb +1 -1
- data/lib/dtk_client.rb +14 -0
- data/lib/dtk_error.rb +91 -0
- data/lib/error.rb +3 -9
- data/lib/execute/cli_pure/cli_rerouter.rb +82 -0
- data/lib/parser/adapters/thor.rb +3 -0
- data/lib/shell.rb +2 -1
- data/lib/shell/domain/context_params.rb +2 -0
- data/lib/util/console.rb +1 -1
- data/lib/util/os_util.rb +1 -0
- data/lib/util/remote_dependency_util.rb +20 -3
- data/lib/view_processor/table_print.rb +7 -25
- metadata +17 -5
- data/lib/commands/common/thor/test_action_agent.rb +0 -39
- data/lib/commands/thor/repo.rb +0 -35
data/lib/commands/thor/node.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
dtk_require_common_commands('thor/task_status')
|
2
2
|
dtk_require_common_commands('thor/set_required_attributes')
|
3
|
-
dtk_require_common_commands('thor/test_action_agent')
|
4
3
|
|
5
4
|
module DTK::Client
|
6
5
|
class Node < CommandBaseThor
|
@@ -10,7 +9,6 @@ module DTK::Client
|
|
10
9
|
no_tasks do
|
11
10
|
include TaskStatusMixin
|
12
11
|
include SetRequiredParamsMixin
|
13
|
-
include TestActionAgent
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.pretty_print_cols()
|
@@ -96,39 +94,6 @@ module DTK::Client
|
|
96
94
|
post rest_url("node/info"), post_body
|
97
95
|
end
|
98
96
|
|
99
|
-
desc "NODE-NAME/ID test-action-agent BASH-COMMAND-LINE", "Run bash command on test action agent"
|
100
|
-
def test_action_agent(context_params)
|
101
|
-
response = test_agent_aux(context_params)
|
102
|
-
return response unless response.ok?
|
103
|
-
|
104
|
-
# this I will fix to have more clear output
|
105
|
-
data = response.data(:results)
|
106
|
-
|
107
|
-
datas = data.values.first['results']
|
108
|
-
errors = data.values.first['errors']
|
109
|
-
|
110
|
-
|
111
|
-
datas.each do |data|
|
112
|
-
OsUtil.print("Command: #{data['description']}, status: #{data['status']}", :yellow)
|
113
|
-
if data['stdout'] && !data['stdout'].empty?
|
114
|
-
print data['stdout']
|
115
|
-
end
|
116
|
-
|
117
|
-
if data['stderr'] && !data['stderr'].empty?
|
118
|
-
print data['stderr']
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
if errors && !errors.empty?
|
123
|
-
puts; puts;
|
124
|
-
OsUtil.print('Some errors have been detected', :white)
|
125
|
-
errors.each_with_index { |err, index| OsUtil.print("#{index+1}. #{err}", :red) }
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
return nil
|
130
|
-
end
|
131
|
-
|
132
97
|
desc "NODE-NAME/ID ssh REMOTE-USER [-i PATH-TO-PEM]","SSH into node, optional parameters are path to indentity file."
|
133
98
|
method_option "--identity-file",:aliases => '-i',:type => :string, :desc => "Identity-File used for connection, if not provided default is used", :banner => "IDENTITY-FILE"
|
134
99
|
def ssh(context_params)
|
@@ -164,7 +129,7 @@ module DTK::Client
|
|
164
129
|
|
165
130
|
connection_string = "#{remote_user}@#{public_dns}"
|
166
131
|
|
167
|
-
|
132
|
+
|
168
133
|
ssh_command = nil
|
169
134
|
|
170
135
|
if identity_file_location
|
@@ -21,7 +21,7 @@ module DTK::Client
|
|
21
21
|
desc "list", "List all node templates."
|
22
22
|
method_option :all, :type => :boolean, :default => false
|
23
23
|
method_option "target_identifier",:aliases => "-t" ,
|
24
|
-
:type => :string,
|
24
|
+
:type => :string,
|
25
25
|
:banner => "TARGET-IDENTIFIER",
|
26
26
|
:desc => "Name or ID of desired target"
|
27
27
|
def list(context_params)
|
@@ -46,10 +46,10 @@ module DTK::Client
|
|
46
46
|
end
|
47
47
|
|
48
48
|
desc "add-node-template NODE-TEMPLATE-NAME [-t TARGET-NAME/ID] --os OS --image-id IMAGE-ID --size SIZE[,SIZE2,..]", "Add new node template"
|
49
|
-
method_option "target",:aliases => "-t"
|
49
|
+
method_option "target",:aliases => "-t"
|
50
50
|
method_option "os"
|
51
|
-
method_option "image-id",:aliases => "-i"
|
52
|
-
method_option "size",:aliases => "-s"
|
51
|
+
method_option "image-id",:aliases => "-i"
|
52
|
+
method_option "size",:aliases => "-s"
|
53
53
|
def add_node_template(context_params)
|
54
54
|
node_template_name = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
55
55
|
size_array = options[:size] && options[:size].split(',')
|
@@ -73,49 +73,6 @@ module DTK::Client
|
|
73
73
|
post rest_url("node/delete_node_template"), post_body
|
74
74
|
end
|
75
75
|
|
76
|
-
=begin
|
77
|
-
#Not implemented yet
|
78
|
-
desc "NODE-TEMPLATE-NAME/ID info", "Get information about given node template."
|
79
|
-
method_option :list, :type => :boolean, :default => false
|
80
|
-
def info(context_params)
|
81
|
-
node_template_id = context_params.retrieve_arguments([:node_template_id!],method_argument_names)
|
82
|
-
data_type = :node
|
83
|
-
|
84
|
-
post_body = {
|
85
|
-
:node_id => node_template_id,
|
86
|
-
:subtype => 'template'
|
87
|
-
}
|
88
|
-
response = post rest_url("node/info"), post_body
|
89
|
-
|
90
|
-
response.render_table(data_type) unless options.list?
|
91
|
-
|
92
|
-
return response
|
93
|
-
end
|
94
|
-
=end
|
95
|
-
|
96
|
-
=begin
|
97
|
-
#TODO: move to form desc "NODE-TEMPLATE-NAME/ID stage [INSTANCE-NAME]"
|
98
|
-
#will then have to reverse arguments
|
99
|
-
desc "stage NODE-TEMPLATE-NAME [INSTANCE-NAME]", "Stage node template in target."
|
100
|
-
method_option "in-target",:aliases => "-t" ,
|
101
|
-
:type => :numeric,
|
102
|
-
:banner => "TARGET-ID",
|
103
|
-
:desc => "Target (id) to create node instance in"
|
104
|
-
def stage(context_params)
|
105
|
-
node_template_id, name = context_params.retrieve_arguments([:option_1!, :option_2],method_argument_names)
|
106
|
-
post_body = {
|
107
|
-
:node_template_identifier => node_template_id
|
108
|
-
}
|
109
|
-
post_body.merge!(:target_id => options["in-target"]) if options["in-target"]
|
110
|
-
post_body.merge!(:name => name) if name
|
111
|
-
response = post rest_url("node/stage"), post_body
|
112
|
-
# when changing context send request for getting latest node_templates instead of getting from cache
|
113
|
-
@@invalidate_map << :node_template
|
114
|
-
@@invalidate_map << :node
|
115
|
-
|
116
|
-
response
|
117
|
-
end
|
118
|
-
=end
|
119
76
|
end
|
120
77
|
end
|
121
78
|
|
@@ -17,7 +17,6 @@ DEBUG_SLEEP_TIME = DTK::Configuration.get(:debug_task_frequency)
|
|
17
17
|
|
18
18
|
module DTK::Client
|
19
19
|
class Service < CommandBaseThor
|
20
|
-
|
21
20
|
no_tasks do
|
22
21
|
include TaskStatusMixin
|
23
22
|
include SetRequiredParamsMixin
|
@@ -45,8 +44,6 @@ module DTK::Client
|
|
45
44
|
assembly_id
|
46
45
|
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
47
|
end
|
51
48
|
|
52
49
|
def self.whoami()
|
@@ -169,7 +166,7 @@ module DTK::Client
|
|
169
166
|
]
|
170
167
|
},
|
171
168
|
:identifier_only => {
|
172
|
-
:node
|
169
|
+
:node => [
|
173
170
|
['add-component',"add-component COMPONENT","# Add a component to the node."],
|
174
171
|
['delete-component',"delete-component COMPONENT-NAME [-y]","# Delete component from service's node"],
|
175
172
|
['info',"info","# Return info about node instance belonging to given workspace."],
|
@@ -211,7 +208,6 @@ module DTK::Client
|
|
211
208
|
destroy_and_reset_nodes_aux(context_params)
|
212
209
|
end
|
213
210
|
|
214
|
-
|
215
211
|
desc "SERVICE-NAME/ID start [NODE-NAME]", "Starts all the service nodes. A single node can be selected."
|
216
212
|
def start(context_params)
|
217
213
|
start_aux(context_params)
|
@@ -251,32 +247,53 @@ module DTK::Client
|
|
251
247
|
Response::Ok.new()
|
252
248
|
end
|
253
249
|
|
254
|
-
|
255
|
-
|
250
|
+
desc "SERVICE-NAME/ID execute-workflow WORKFLOW-ACTION [WORKFLOW-PARAMS] [-m COMMIT-MSG]", "Execute workflow."
|
251
|
+
method_option "commit_msg",:aliases => "-m" ,
|
252
|
+
:type => :string,
|
253
|
+
:banner => "COMMIT-MSG",
|
254
|
+
:desc => "Commit message"
|
255
|
+
def execute_workflow(context_params)
|
256
|
+
converge(context_params)
|
257
|
+
end
|
256
258
|
desc "SERVICE-NAME/ID converge [-m COMMIT-MSG]", "Converge service instance."
|
257
259
|
method_option "commit_msg",:aliases => "-m" ,
|
258
260
|
:type => :string,
|
259
261
|
:banner => "COMMIT-MSG",
|
260
262
|
:desc => "Commit message"
|
261
263
|
def converge(context_params)
|
262
|
-
|
264
|
+
opts = Hash.new
|
265
|
+
if context_params.pure_cli_mode
|
266
|
+
opts.merge!(:mode => :stream)
|
267
|
+
end
|
268
|
+
converge_aux(context_params,opts)
|
269
|
+
end
|
270
|
+
|
271
|
+
desc "SERVICE-NAME/ID execute-action COMPONENT-INSTANCE [ACTION-NAME [ACTION-PARAMS]]", "Converge the component or execute tha action on the component."
|
272
|
+
def execute_action(context_params)
|
273
|
+
execute_ad_hoc_action_aux(context_params)
|
274
|
+
end
|
275
|
+
|
276
|
+
desc "SERVICE-NAME/ID list-actions [--summary]", "List the actions defined on components in the service instance."
|
277
|
+
method_option :summary, :aliases => '-s', :type => :boolean, :default => false
|
278
|
+
def list_actions(context_params)
|
279
|
+
list_ad_hoc_actions_aux(context_params)
|
263
280
|
end
|
264
281
|
|
265
282
|
desc "SERVICE-NAME/ID push-assembly-updates [NAMESPACE:SERVICE-MODULE-NAME/ASSEMBLY-NAME]", "Push changes made to this service instance to the designated assembly; default is parent assembly."
|
266
283
|
def push_assembly_updates(context_params)
|
267
|
-
assembly_id, qualified_assembly_name = context_params.retrieve_arguments([:service_id
|
284
|
+
assembly_id, qualified_assembly_name = context_params.retrieve_arguments([:service_id!, :option_1], method_argument_names)
|
268
285
|
service_module_name, assembly_template_name =
|
269
286
|
if qualified_assembly_name
|
270
287
|
if qualified_assembly_name =~ /(^[^\/]*)\/([^\/]*$)/
|
271
288
|
[$1,$2]
|
272
289
|
else
|
273
|
-
raise DtkError,"The term (#{qualified_assembly_name}) must have form SERVICE-MODULE-NAME/ASSEMBLY-NAME"
|
290
|
+
raise DtkError, "The term (#{qualified_assembly_name}) must have form SERVICE-MODULE-NAME/ASSEMBLY-NAME"
|
274
291
|
end
|
275
292
|
else
|
276
|
-
[nil,nil]
|
293
|
+
[nil, nil]
|
277
294
|
end
|
278
295
|
|
279
|
-
response = promote_assembly_aux(:update,assembly_id, service_module_name, assembly_template_name,
|
296
|
+
response = promote_assembly_aux(:update, assembly_id, service_module_name, assembly_template_name, :use_module_namespace => true)
|
280
297
|
return response unless response.ok?
|
281
298
|
@@invalidate_map << :assembly
|
282
299
|
Response::Ok.new()
|
@@ -300,9 +317,15 @@ module DTK::Client
|
|
300
317
|
edit_module_aux(context_params)
|
301
318
|
end
|
302
319
|
|
303
|
-
desc "SERVICE-NAME/ID
|
320
|
+
desc "SERVICE-NAME/ID create-workflow WORKFLOW-NAME [--from BASE-WORKFLOW-NAME]", "Create a new workflow in the service instance."
|
321
|
+
method_option :from, :type => :string
|
322
|
+
def create_workflow(context_params)
|
323
|
+
edit_or_create_workflow_aux(context_params,:create => true,:create_from => options.from)
|
324
|
+
end
|
325
|
+
|
326
|
+
desc "SERVICE-NAME/ID edit-workflow [WORKFLOW-NAME]", "Edit a workflow in the service instance."
|
304
327
|
def edit_workflow(context_params)
|
305
|
-
|
328
|
+
edit_or_create_workflow_aux(context_params)
|
306
329
|
end
|
307
330
|
|
308
331
|
desc "SERVICE-NAME/ID edit-attributes", "Edit service's attributes."
|
@@ -341,21 +364,18 @@ TODO: will put in dot release and will rename to 'extend'
|
|
341
364
|
return response
|
342
365
|
end
|
343
366
|
|
344
|
-
desc "ASSEMBLY-NAME/ID possible-extensions", "Lists the possible extensions to the assembly"
|
345
|
-
def possible_extensions(context_params)
|
346
|
-
assembly_id = context_params.retrieve_arguments([:assembly_id!],method_argument_names)
|
347
|
-
|
348
|
-
post_body = {
|
349
|
-
:assembly_id => assembly_id
|
350
|
-
}
|
351
|
-
response = post(rest_url("assembly/list_possible_add_ons"),post_body)
|
352
|
-
response.render_table(:service_add_on)
|
353
|
-
end
|
354
367
|
=end
|
355
368
|
|
356
|
-
|
357
|
-
|
369
|
+
# TODO: deprecating --wait since subsubsumed by mode
|
370
|
+
# desc "SERVICE-NAME/ID task-status [--wait] [--summarize]", "Get the task status of the running or last running service task."
|
371
|
+
desc "SERVICE-NAME/ID task-status [--mode MODE] [--summarize]", "Get the task status of the running or last running service task."
|
372
|
+
method_option "mode",:aliases => "-m" ,
|
373
|
+
:type => :string,
|
374
|
+
:banner => "MODE",
|
375
|
+
:desc => "Mode in which task status display; one of [stream,snapshot,refresh]; default is 'snapshot'"
|
358
376
|
method_option :summarize, :type => :boolean, :default => false, :aliases => '-s'
|
377
|
+
# leaving --wait in for backwards compatability
|
378
|
+
method_option :wait, :type => :boolean, :default => false
|
359
379
|
def task_status(context_params)
|
360
380
|
task_status_aw_aux(context_params)
|
361
381
|
end
|
@@ -409,11 +429,16 @@ TODO: will put in dot release and will rename to 'extend'
|
|
409
429
|
print_includes_aux(context_params)
|
410
430
|
end
|
411
431
|
|
412
|
-
desc "SERVICE-NAME/ID workflow-info", "Get the
|
432
|
+
desc "SERVICE-NAME/ID workflow-info [WORKFLOW-NAME]", "Get the contents of a workflow associated with the service."
|
413
433
|
def workflow_info(context_params)
|
414
434
|
workflow_info_aux(context_params)
|
415
435
|
end
|
416
436
|
|
437
|
+
desc "SERVICE-NAME/ID workflow-list", "List the workflows associated with the service."
|
438
|
+
def workflow_list(context_params)
|
439
|
+
workflow_list_aux(context_params)
|
440
|
+
end
|
441
|
+
|
417
442
|
desc "list","List services."
|
418
443
|
def list(context_params)
|
419
444
|
assembly_id, node_id, component_id, attribute_id, about = context_params.retrieve_arguments([:service_id,:node_id,:component_id,:attribute_id,:option_1],method_argument_names)
|
@@ -484,22 +509,6 @@ TODO: will put in dot release and will rename to 'extend'
|
|
484
509
|
list_remote_module_diffs(context_params)
|
485
510
|
end
|
486
511
|
|
487
|
-
# desc "ASSEMBLY-NAME/ID list-attribute-mappings SERVICE-LINK-NAME/ID", "List attribute mappings associated with service link"
|
488
|
-
# def list_attribute_mappings(context_params)
|
489
|
-
# post_body = Helper(:service_link).post_body_with_id_keys(context_params,method_argument_names)
|
490
|
-
# post rest_url("assembly/list_attribute_mappings"), post_body
|
491
|
-
# end
|
492
|
-
|
493
|
-
#desc "ASSEMBLY-NAME/ID list-smoketests","List smoketests on asssembly"
|
494
|
-
#def list_smoketests(context_params)
|
495
|
-
# assembly_id = context_params.retrieve_arguments([:assembly_id!],method_argument_names)
|
496
|
-
#
|
497
|
-
# post_body = {
|
498
|
-
# :assembly_id => assembly_id
|
499
|
-
# }
|
500
|
-
# post rest_url("assembly/list_smoketests"), post_body
|
501
|
-
#end
|
502
|
-
|
503
512
|
desc "SERVICE-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 service instance"
|
504
513
|
method_option :nodes, :type => :string, :default => nil
|
505
514
|
def grant_access(context_params)
|
@@ -571,8 +580,10 @@ TODO: will put in dot release and will rename to 'extend'
|
|
571
580
|
response
|
572
581
|
end
|
573
582
|
|
574
|
-
desc "SERVICE-NAME/ID set-attribute ATTRIBUTE-NAME [VALUE] [-u]", "(Un)Set attribute value. The option -u will unset the attribute's value."
|
583
|
+
desc "SERVICE-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."
|
575
584
|
method_option :unset, :aliases => '-u', :type => :boolean, :default => false
|
585
|
+
method_option :component_attribute, :aliases => '-c', :type => :boolean, :default => false
|
586
|
+
method_option :node_attribute, :aliases => '-n', :type => :boolean, :default => false
|
576
587
|
def set_attribute(context_params)
|
577
588
|
set_attribute_aux(context_params)
|
578
589
|
end
|
@@ -626,7 +637,7 @@ TODO: will put in dot release and will rename to 'extend'
|
|
626
637
|
|
627
638
|
# only supported at node-level
|
628
639
|
# using HIDE_FROM_BASE to hide this command from base context (dtk:/assembly>)
|
629
|
-
desc "
|
640
|
+
desc "SERVICE-NAME/ID add-component COMPONENT", "Add a component to the service."
|
630
641
|
def add_component(context_params)
|
631
642
|
response = create_component_aux(context_params)
|
632
643
|
|
@@ -690,7 +701,7 @@ TODO: will put in dot release and will rename to 'extend'
|
|
690
701
|
end
|
691
702
|
|
692
703
|
# using HIDE_FROM_BASE to hide this command from base context (dtk:/assembly>)
|
693
|
-
desc "
|
704
|
+
desc "SERVICE-NAME/ID delete-component COMPONENT-NAME [-y]","Delete component from the service."
|
694
705
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
695
706
|
def delete_component(context_params)
|
696
707
|
response = delete_component_aux(context_params)
|
@@ -181,9 +181,9 @@ module DTK::Client
|
|
181
181
|
# end
|
182
182
|
|
183
183
|
# version_method_option
|
184
|
-
desc "install NAMESPACE/REMOTE-SERVICE-MODULE-NAME [-y]
|
184
|
+
desc "install NAMESPACE/REMOTE-SERVICE-MODULE-NAME [-y]", "Install remote service module into local environment. -y will automatically clone component modules."
|
185
185
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
186
|
-
method_option :ignore, :aliases => '-i', :type => :boolean, :default => false
|
186
|
+
# method_option :ignore, :aliases => '-i', :type => :boolean, :default => false
|
187
187
|
method_option :update_none, :type => :boolean, :default => false
|
188
188
|
def install(context_params)
|
189
189
|
response = install_module_aux(context_params)
|
@@ -367,53 +367,6 @@ module DTK::Client
|
|
367
367
|
edit_module_aux(context_params)
|
368
368
|
end
|
369
369
|
|
370
|
-
# desc "SERVICE-MODULE-NAME/ID create-version NEW-VERSION", "Snapshot current state of service module as a new version"
|
371
|
-
# def create_version(context_params)
|
372
|
-
# service_module_id,version = context_params.retrieve_arguments([:service_module_id!,:option_1!],method_argument_names)
|
373
|
-
# post_body = {
|
374
|
-
# :service_module_id => service_module_id,
|
375
|
-
# :rsa_pub_key => SSHUtil.rsa_pub_key_content()
|
376
|
-
# }
|
377
|
-
# response = post rest_url("service_module/versions"), post_body
|
378
|
-
# return response unless response.ok?
|
379
|
-
# versions = (response.data.first && response.data.first['versions'])||Array.new
|
380
|
-
# if versions.include?(version)
|
381
|
-
# return Response::Error::Usage.new("Version #{version} exists already")
|
382
|
-
# end
|
383
|
-
|
384
|
-
# service_module_name = get_service_module_name(service_module_id)
|
385
|
-
# module_location = OsUtil.module_location(:service_module,service_module_name,version)
|
386
|
-
# if File.directory?(module_location)
|
387
|
-
# raise DtkError, "Target service module directory for version #{version} (#{module_location}) exists already; it must be deleted and this comamnd retried"
|
388
|
-
# end
|
389
|
-
|
390
|
-
# post_body = {
|
391
|
-
# :service_module_id => service_module_id,
|
392
|
-
# :version => version
|
393
|
-
# }
|
394
|
-
|
395
|
-
# response = post rest_url("service_module/create_new_version"), post_body
|
396
|
-
# return response unless response.ok?
|
397
|
-
|
398
|
-
# internal_trigger = omit_output = true
|
399
|
-
# clone_aux(:service_module,service_module_name,version,internal_trigger,omit_output)
|
400
|
-
# end
|
401
|
-
|
402
|
-
# desc "SERVICE-MODULE-NAME/ID set-component-module-version COMPONENT-MODULE-NAME VERSION", "Set the version of the component module to use in the service module's assemblies"
|
403
|
-
# def set_component_module_version(context_params)
|
404
|
-
# service_module_id,component_module_id,version = context_params.retrieve_arguments([:service_module_id!,:option_1!,:option_2!],method_argument_names)
|
405
|
-
# post_body = {
|
406
|
-
# :service_module_id => service_module_id,
|
407
|
-
# :component_module_id => component_module_id,
|
408
|
-
# :version => version
|
409
|
-
# }
|
410
|
-
# response = post rest_url("service_module/set_component_module_version"), post_body
|
411
|
-
# @@invalidate_map << :service_module
|
412
|
-
# return response unless response.ok?()
|
413
|
-
# module_name,commit_sha,workspace_branch = response.data(:module_name,:commit_sha,:workspace_branch)
|
414
|
-
# Helper(:git_repo).synchronize_clone(:service_module,module_name,commit_sha,:local_branch=>workspace_branch)
|
415
|
-
# end
|
416
|
-
|
417
370
|
# TODO: put in two versions, one that creates empty and anotehr taht creates from local dir; use --empty flag
|
418
371
|
desc "import [NAMESPACE:]SERVICE-MODULE-NAME", "Create new service module from local clone"
|
419
372
|
def import(context_params)
|
data/lib/commands/thor/target.rb
CHANGED
@@ -5,7 +5,7 @@ module DTK::Client
|
|
5
5
|
class Target < CommandBaseThor
|
6
6
|
include Commands
|
7
7
|
include InventoryParserMixin
|
8
|
-
|
8
|
+
|
9
9
|
def self.pretty_print_cols()
|
10
10
|
PPColumns.get(:target)
|
11
11
|
end
|
@@ -48,7 +48,7 @@ module DTK::Client
|
|
48
48
|
|
49
49
|
import_type = parsed_source[1]
|
50
50
|
path = parsed_source[2]
|
51
|
-
|
51
|
+
|
52
52
|
raise DtkValidationError, "We do not support '#{import_type}' as import source at the moment. Valid sources: #{ValidImportTypes}" unless ValidImportTypes.include?(import_type)
|
53
53
|
|
54
54
|
post_body = {:target_id => target_id}
|
@@ -57,7 +57,7 @@ module DTK::Client
|
|
57
57
|
inventory_data = parse_inventory_file(path)
|
58
58
|
post_body.merge!(:inventory_data => inventory_data)
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
response = post rest_url("target/import_nodes"), post_body
|
62
62
|
return response unless response.ok?
|
63
63
|
|
@@ -142,12 +142,12 @@ module DTK::Client
|
|
142
142
|
provider_id, target_id, about = context_params.retrieve_arguments([:provider_id, :target_id, :option_1],method_argument_names||="")
|
143
143
|
|
144
144
|
if target_id.nil?
|
145
|
-
post_body = {
|
145
|
+
post_body = {
|
146
146
|
:subtype => :instance,
|
147
147
|
:parent_id => provider_id
|
148
148
|
}
|
149
149
|
response = post rest_url("target/list"), post_body
|
150
|
-
|
150
|
+
|
151
151
|
response.render_table(:target)
|
152
152
|
else
|
153
153
|
post_body = {
|
@@ -176,8 +176,8 @@ module DTK::Client
|
|
176
176
|
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
177
177
|
|
178
178
|
# No -y options since risk is too great
|
179
|
-
return unless Console.confirmation_prompt("Are you sure you want to delete target '#{target_id}' (all
|
180
|
-
|
179
|
+
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)'"+'?')
|
180
|
+
|
181
181
|
post_body = {
|
182
182
|
:target_id => target_id,
|
183
183
|
:type => 'instance'
|