dtk-client 0.5.6.1 → 0.5.8
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 +8 -8
- data/lib/command_helpers/git_repo.rb +0 -1
- data/lib/commands/common/thor/assembly_workspace.rb +31 -13
- data/lib/commands/common/thor/reparse.rb +1 -0
- data/lib/commands/thor/account.rb +21 -24
- data/lib/commands/thor/assembly.rb +12 -1
- data/lib/commands/thor/component_module.rb +15 -8
- data/lib/commands/thor/node.rb +7 -1
- data/lib/commands/thor/node_template.rb +5 -3
- data/lib/commands/thor/provider.rb +13 -4
- data/lib/commands/thor/service.rb +16 -7
- data/lib/commands/thor/service_module.rb +5 -3
- data/lib/commands/thor/workspace.rb +11 -5
- data/lib/core.rb +15 -5
- data/lib/dtk-client/version.rb +1 -1
- data/lib/shell/interactive_wizard.rb +5 -2
- data/lib/util/os_util.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWFhMGY3ZWUzYzgxMjM3MjJlZmI2MDJmMTdlOTkzZjFkYmQ2ODJiMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWVjMmRiMGE4NWFjN2U4M2QyYTJkN2Q5YTgxNWU5NmJkN2Q2MmIxNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmNhNTcwYzllZmY5MTRhMTdlZDRhOTg0ZGQxNTNkMzU0YWMzMTdlZDUyZjg3
|
10
|
+
NzIwYWIwMzk0MmMzNGE1ZmExMWY1YmJiZTk5YmZlM2QzMjQ0MGE0OTRhZDE2
|
11
|
+
Yzg3ZGJiYWVhNTcyYjA2OWIwMTZlMTU3YTFmMjQwY2VmNGE3YTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTczZjRiOWI4NDBkZDNiZGMzMWFhNjAyNWU3NDZmZjVmZDQ1NjM4ZTEyODIy
|
14
|
+
MDIyZjUxMTkwZDE3Yzg0NDBkYTUwYjAyNzljZDcxMzIwNWE2ZThiMzk3Y2I1
|
15
|
+
YWRlNTg5YWJiOTM0MzBkOTg1OTYxMWE5ZDE2NDUzY2NkNjZjYTc=
|
@@ -618,6 +618,18 @@ module DTK::Client
|
|
618
618
|
response = post(rest_url("assembly/purge"),post_body)
|
619
619
|
end
|
620
620
|
|
621
|
+
def destroy_and_reset_nodes_aux(context_params)
|
622
|
+
assembly_or_workspace_id = context_params.retrieve_arguments([REQ_ASSEMBLY_OR_WS_ID],method_argument_names)
|
623
|
+
unless options.force?
|
624
|
+
return unless Console.confirmation_prompt("Are you sure you want to destroy and reset all nodes in the workspace"+'?')
|
625
|
+
end
|
626
|
+
|
627
|
+
post_body = {
|
628
|
+
:assembly_id => assembly_or_workspace_id
|
629
|
+
}
|
630
|
+
response = post(rest_url("assembly/destroy_and_reset_nodes"),post_body)
|
631
|
+
end
|
632
|
+
|
621
633
|
def delete_aux(context_params)
|
622
634
|
if context_params.is_last_command_eql_to?(:node)
|
623
635
|
delete_node_aux(context_params)
|
@@ -829,26 +841,32 @@ module DTK::Client
|
|
829
841
|
sleep(1)
|
830
842
|
end
|
831
843
|
|
832
|
-
|
844
|
+
if response.data(:is_complete)
|
845
|
+
# due to complicated response we change its formating
|
846
|
+
response = response.data(:results).first[1]
|
833
847
|
|
834
|
-
|
835
|
-
|
848
|
+
unless response["error"].nil?
|
849
|
+
raise DTK::Client::DtkError, response["error"]
|
850
|
+
end
|
836
851
|
|
837
|
-
|
838
|
-
|
839
|
-
end
|
852
|
+
# removing invalid chars from log
|
853
|
+
output = response["output"].gsub(/`/,'\'')
|
840
854
|
|
841
|
-
|
842
|
-
|
855
|
+
unless output.empty?
|
856
|
+
file_ready = true
|
857
|
+
tail_temp_file << output
|
858
|
+
tail_temp_file.flush
|
859
|
+
end
|
843
860
|
|
844
|
-
|
861
|
+
last_line = response["last_line"]
|
862
|
+
sleep(LOG_SLEEP_TIME_W)
|
863
|
+
else
|
845
864
|
file_ready = true
|
846
|
-
tail_temp_file <<
|
865
|
+
tail_temp_file << "\n\nError while logging there was no successful response after 3 tries, (^C, Q) to exit. \n\n"
|
847
866
|
tail_temp_file.flush
|
867
|
+
tail_temp_file.close
|
868
|
+
Thread.current.exit
|
848
869
|
end
|
849
|
-
|
850
|
-
last_line = response["last_line"]
|
851
|
-
sleep(LOG_SLEEP_TIME_W)
|
852
870
|
end
|
853
871
|
end
|
854
872
|
|
@@ -33,7 +33,7 @@ module DTK::Client
|
|
33
33
|
|
34
34
|
def self.add_key(path_to_key, name=nil)
|
35
35
|
match, matched_username = nil, nil
|
36
|
-
|
36
|
+
|
37
37
|
unless File.file?(path_to_key)
|
38
38
|
OsUtil.put_warning "[ERROR] " ,"No ssh key file found at (#{path_to_key}). Path is wrong or it is necessary to generate the public rsa key (e.g., run `ssh-keygen -t rsa`)", :red
|
39
39
|
abort
|
@@ -45,32 +45,21 @@ module DTK::Client
|
|
45
45
|
|
46
46
|
post_body.merge!(:username => name.chomp) if name
|
47
47
|
proper_response = nil
|
48
|
-
response, key_exists_already = Account.internal_add_user_access("service_module/add_user_direct_access", post_body, 'service module')
|
49
|
-
return response unless (response.ok? || key_exists_already)
|
50
|
-
|
51
48
|
|
52
|
-
|
53
|
-
proper_response = response
|
54
|
-
match = response.data['match']
|
55
|
-
matched_username = response.data['matched_username']
|
56
|
-
end
|
49
|
+
response, key_exists_already = Account.internal_add_user_access("account/add_user_direct_access", post_body, 'service module')
|
57
50
|
|
58
|
-
response, key_exists_already = Account.internal_add_user_access("component_module/add_user_direct_access", post_body, 'component module')
|
59
51
|
return response unless (response.ok? || key_exists_already)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
repo_manager_fingerprint,repo_manager_dns = proper_response.data_ret_and_remove!(:repo_manager_fingerprint,:repo_manager_dns)
|
52
|
+
|
53
|
+
match = response.data['match']
|
54
|
+
matched_username = response.data['matched_username']
|
55
|
+
|
56
|
+
if response && !match
|
57
|
+
repo_manager_fingerprint,repo_manager_dns = response.data_ret_and_remove!(:repo_manager_fingerprint,:repo_manager_dns)
|
67
58
|
SshProcessing.update_ssh_known_hosts(repo_manager_dns,repo_manager_fingerprint)
|
68
59
|
OsUtil.print("Ssh key added successfully!", :yellow)
|
69
|
-
|
70
|
-
return proper_response
|
71
|
-
else
|
72
|
-
nil
|
73
60
|
end
|
61
|
+
|
62
|
+
return response, match, matched_username
|
74
63
|
end
|
75
64
|
|
76
65
|
desc "set-password", "Change password for your dtk user account"
|
@@ -123,9 +112,16 @@ module DTK::Client
|
|
123
112
|
def add_ssh_key(context_params)
|
124
113
|
name, path_to_key = context_params.retrieve_arguments([:option_1!, :option_2],method_argument_names)
|
125
114
|
path_to_key ||= SshProcessing.default_rsa_pub_key_path()
|
126
|
-
access_granted = Account.add_key(path_to_key, name)
|
127
115
|
|
128
|
-
|
116
|
+
response, matched, matched_username = Account.add_key(path_to_key, name)
|
117
|
+
|
118
|
+
if matched
|
119
|
+
DTK::Client::OsUtil.print("Provided SSH PUB key has already been added.", :yellow)
|
120
|
+
elsif matched_username
|
121
|
+
DTK::Client::OsUtil.print("User ('#{matched_username}') already exists.", :yellow)
|
122
|
+
else
|
123
|
+
FileUtils.touch(DTK::Client::Configurator::DIRECT_ACCESS) if response.ok?
|
124
|
+
end
|
129
125
|
end
|
130
126
|
|
131
127
|
desc "remove-ssh-key NAME ","Removes user and direct access to modules."
|
@@ -139,7 +135,8 @@ module DTK::Client
|
|
139
135
|
response = post rest_url("service_module/remove_user_direct_access"), post_body
|
140
136
|
return response unless response.ok?
|
141
137
|
|
142
|
-
OsUtil.print("
|
138
|
+
OsUtil.print("SSH key removed successfully!", :yellow)
|
139
|
+
response
|
143
140
|
end
|
144
141
|
|
145
142
|
|
@@ -211,17 +211,26 @@ module DTK::Client
|
|
211
211
|
:type => :string,
|
212
212
|
:banner => "TARGET-NAME/ID",
|
213
213
|
:desc => "Target (id) to create assembly in"
|
214
|
+
#hidden option
|
215
|
+
method_option "instance-bindings",
|
216
|
+
:type => :string
|
217
|
+
|
214
218
|
def stage(context_params)
|
215
219
|
assembly_template_id, name = context_params.retrieve_arguments([:assembly_id!, :option_1],method_argument_names)
|
216
220
|
post_body = {
|
217
221
|
:assembly_id => assembly_template_id
|
218
222
|
}
|
219
223
|
|
224
|
+
# using this to make sure cache will be invalidated after new assembly is created from other commands e.g.
|
225
|
+
# 'assembly-create', 'install' etc.
|
226
|
+
@@invalidate_map << :assembly
|
227
|
+
|
220
228
|
assembly_template_name = get_assembly_name(assembly_template_id)
|
221
229
|
assembly_template_name.gsub!('::','-') if assembly_template_name
|
222
230
|
|
223
231
|
# we check current options and forwarded options (from deploy method)
|
224
232
|
in_target = options["in-target"] || context_params.get_forwarded_thor_option("in-target")
|
233
|
+
instance_bindings = options["instance-bindings"]
|
225
234
|
assembly_list = Assembly.assembly_list()
|
226
235
|
|
227
236
|
if name
|
@@ -232,6 +241,7 @@ module DTK::Client
|
|
232
241
|
|
233
242
|
post_body.merge!(:target_id => in_target) if in_target
|
234
243
|
post_body.merge!(:name => name) if name
|
244
|
+
post_body.merge!(:instance_bindings => instance_bindings) if instance_bindings
|
235
245
|
|
236
246
|
response = post rest_url("assembly/stage"), post_body
|
237
247
|
return response unless response.ok?
|
@@ -242,6 +252,7 @@ module DTK::Client
|
|
242
252
|
return response
|
243
253
|
end
|
244
254
|
|
255
|
+
=begin
|
245
256
|
# desc "ASSEMBLY-NAME/ID deploy [-v VERSION] [INSTANCE-NAME] [-t TARGET-NAME/ID] [-m COMMIT-MSG]", "Stage and deploy assembly in target."
|
246
257
|
# version_method_option
|
247
258
|
desc "ASSEMBLY-NAME/ID deploy [INSTANCE-NAME] [-t TARGET-NAME/ID] [-m COMMIT-MSG]", "Stage and deploy assembly in target."
|
@@ -300,7 +311,7 @@ module DTK::Client
|
|
300
311
|
|
301
312
|
return ret
|
302
313
|
end
|
303
|
-
|
314
|
+
=end
|
304
315
|
|
305
316
|
desc "delete ASSEMBLY-ID", "Delete assembly"
|
306
317
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
@@ -296,10 +296,12 @@ TODO: might deprecate
|
|
296
296
|
|
297
297
|
external_dependencies = response.data(:external_dependencies)
|
298
298
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
299
|
+
# commented out for now, since we have this same part of the code in push method
|
300
|
+
# which will always be called from this method
|
301
|
+
# if error = response.data(:dsl_parsed_info)
|
302
|
+
# dsl_parsed_message = ServiceImporter.error_message(module_name, error)
|
303
|
+
# DTK::Client::OsUtil.print(dsl_parsed_message, :red)
|
304
|
+
# end
|
303
305
|
|
304
306
|
dsl_created_info = response.data(:dsl_created_info)
|
305
307
|
if dsl_created_info and !dsl_created_info.empty?
|
@@ -312,8 +314,11 @@ TODO: might deprecate
|
|
312
314
|
# we push clone changes anyway, user can change and push again
|
313
315
|
context_params.add_context_to_params(module_name, :"component-module", module_id)
|
314
316
|
response = push(context_params, true)
|
315
|
-
|
316
|
-
|
317
|
+
|
318
|
+
if git_import
|
319
|
+
response[:module_id] = module_id
|
320
|
+
response.add_data_value!(:external_dependencies,external_dependencies) if external_dependencies
|
321
|
+
end
|
317
322
|
|
318
323
|
return response
|
319
324
|
end
|
@@ -709,7 +714,8 @@ TODO: might deprecate
|
|
709
714
|
end
|
710
715
|
|
711
716
|
# desc "COMPONENT-MODULE-NAME/ID push [-v VERSION] [-m COMMIT-MSG]", "Push changes from local copy of component module to server"
|
712
|
-
desc "COMPONENT-MODULE-NAME/ID push [-m COMMIT-MSG]", "Push changes from local copy of component module to server"
|
717
|
+
# desc "COMPONENT-MODULE-NAME/ID push [-m COMMIT-MSG]", "Push changes from local copy of component module to server"
|
718
|
+
desc "COMPONENT-MODULE-NAME/ID push", "Push changes from local copy of component module to server"
|
713
719
|
version_method_option
|
714
720
|
method_option "message",:aliases => "-m" ,
|
715
721
|
:type => :string,
|
@@ -732,7 +738,8 @@ TODO: might deprecate
|
|
732
738
|
push_clone_changes_aux(:component_module,component_module_id,version,options["message"]||DEFAULT_COMMIT_MSG,internal_trigger)
|
733
739
|
end
|
734
740
|
|
735
|
-
desc "COMPONENT-MODULE-NAME/ID push-dtkn [-n NAMESPACE] [-m COMMIT-MSG]", "Push changes from local copy of component module to remote repository (dtkn)."
|
741
|
+
# desc "COMPONENT-MODULE-NAME/ID push-dtkn [-n NAMESPACE] [-m COMMIT-MSG]", "Push changes from local copy of component module to remote repository (dtkn)."
|
742
|
+
desc "COMPONENT-MODULE-NAME/ID push-dtkn [-n NAMESPACE]", "Push changes from local copy of component module to remote repository (dtkn)."
|
736
743
|
method_option "message",:aliases => "-m" ,
|
737
744
|
:type => :string,
|
738
745
|
:banner => "COMMIT-MSG",
|
data/lib/commands/thor/node.rb
CHANGED
@@ -163,9 +163,15 @@ module DTK::Client
|
|
163
163
|
return response
|
164
164
|
end
|
165
165
|
|
166
|
-
desc "NODE-NAME/ID delete-component COMPONENT-ID", "Delete component from node"
|
166
|
+
desc "NODE-NAME/ID delete-component COMPONENT-ID [-y]", "Delete component from node"
|
167
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
167
168
|
def delete_component(context_params)
|
168
169
|
node_id,component_id = context_params.retrieve_arguments([:node_id!, :option_1!],method_argument_names)
|
170
|
+
|
171
|
+
unless options.force?
|
172
|
+
return unless Console.confirmation_prompt("Are you sure you want to delete component '#{component_id}'"+'?')
|
173
|
+
end
|
174
|
+
|
169
175
|
post_body = {
|
170
176
|
:node_id => node_id,
|
171
177
|
:component_id => component_id
|
@@ -35,7 +35,8 @@ module DTK::Client
|
|
35
35
|
return response
|
36
36
|
end
|
37
37
|
=end
|
38
|
-
desc "list --all -t [TARGET-NAME]", "List all node templates."
|
38
|
+
# desc "list --all -t [TARGET-NAME]", "List all node templates."
|
39
|
+
desc "list", "List all node templates."
|
39
40
|
method_option :all, :type => :boolean, :default => false
|
40
41
|
method_option "target_identifier",:aliases => "-t" ,
|
41
42
|
:type => :string,
|
@@ -61,7 +62,7 @@ module DTK::Client
|
|
61
62
|
}
|
62
63
|
post rest_url("node/image_upgrade"), post_body
|
63
64
|
end
|
64
|
-
|
65
|
+
=begin
|
65
66
|
#TODO: move to form desc "NODE-TEMPLATE-NAME/ID stage [INSTANCE-NAME]"
|
66
67
|
#will then have to reverse arguments
|
67
68
|
desc "stage NODE-TEMPLATE-NAME [INSTANCE-NAME]", "Stage node template in target."
|
@@ -81,8 +82,9 @@ module DTK::Client
|
|
81
82
|
@@invalidate_map << :node_template
|
82
83
|
@@invalidate_map << :node
|
83
84
|
|
84
|
-
|
85
|
+
response
|
85
86
|
end
|
87
|
+
=end
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
@@ -35,17 +35,26 @@ module DTK::Client
|
|
35
35
|
return Provider.valid_children().include?(name_of_sub_context.to_sym)
|
36
36
|
end
|
37
37
|
|
38
|
-
desc "create-provider PROVIDER-TYPE:PROVIDER-NAME --
|
38
|
+
desc "create-provider PROVIDER-TYPE:PROVIDER-NAME --keypair KEYPAIR --security-group SECURITY-GROUP [--no-bootstrap]", "Create provider"
|
39
39
|
method_option :keypair, :type => :string
|
40
|
-
method_option :access_key, :type => :string
|
41
|
-
method_option :secret_key, :type => :string
|
42
40
|
method_option :security_group, :type => :string
|
43
41
|
method_option :no_bootstrap, :type => :boolean, :default => false
|
44
42
|
def create_provider(context_params)
|
45
43
|
composed_provider_name = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
46
44
|
|
47
45
|
provider_type, provider_name = decompose_provider_type_and_name(composed_provider_name)
|
48
|
-
|
46
|
+
keypair, security_group = context_params.retrieve_thor_options([:keypair!, :security_group!], options)
|
47
|
+
|
48
|
+
result = DTK::Shell::InteractiveWizard::interactive_user_input(
|
49
|
+
{'IAAS Credentials' => { :type => :group, :options => [
|
50
|
+
{:key => {}},
|
51
|
+
{:secret => {}}
|
52
|
+
]}})
|
53
|
+
|
54
|
+
access_key, secret_key = result['IAAS Credentials'].values_at(:key, :secret)
|
55
|
+
|
56
|
+
# Remove sensitive readline history
|
57
|
+
OsUtil.pop_readline_history(2)
|
49
58
|
|
50
59
|
post_body = {
|
51
60
|
:iaas_properties => {
|
@@ -173,6 +173,13 @@ TODO: overlaps with different meaning
|
|
173
173
|
}, [:utils])
|
174
174
|
end
|
175
175
|
|
176
|
+
desc "SERVICE-NAME/ID destroy-and-reset-nodes [-y]", "Terminates all nodes, but keeps config state so they can be spun up from scratch."
|
177
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
178
|
+
def destroy_and_reset_nodes(context_params)
|
179
|
+
destroy_and_reset_nodes_aux(context_params)
|
180
|
+
end
|
181
|
+
|
182
|
+
|
176
183
|
desc "SERVICE-NAME/ID start [NODE-NAME]", "Starts all the service nodes. A single node can be selected."
|
177
184
|
def start(context_params)
|
178
185
|
start_aux(context_params)
|
@@ -188,7 +195,8 @@ TODO: overlaps with different meaning
|
|
188
195
|
def cancel_task(context_params)
|
189
196
|
cancel_task_aux(context_params)
|
190
197
|
end
|
191
|
-
|
198
|
+
=begin
|
199
|
+
#TODO: until we investigate DTK-1349
|
192
200
|
desc "rename SERVICE-NAME NEW-SERVICE-NAME","Change service name."
|
193
201
|
def rename(context_params)
|
194
202
|
assembly_name, new_assembly_name = context_params.retrieve_arguments([:option_1!,:option_2!],method_argument_names)
|
@@ -211,6 +219,7 @@ TODO: overlaps with different meaning
|
|
211
219
|
@@invalidate_map << :service
|
212
220
|
response
|
213
221
|
end
|
222
|
+
=end
|
214
223
|
|
215
224
|
#desc "ASSEMBLY-NAME/ID clear-tasks", "Clears the tasks that have been run already."
|
216
225
|
#def clear_tasks(context_params)
|
@@ -218,13 +227,14 @@ TODO: overlaps with different meaning
|
|
218
227
|
#end
|
219
228
|
|
220
229
|
desc "SERVICE-NAME/ID create-assembly SERVICE-MODULE-NAME ASSEMBLY-NAME", "Create a new assembly from this service instance in the designated service module."
|
221
|
-
def
|
230
|
+
def create_assembly(context_params)
|
222
231
|
assembly_id, service_module_name, assembly_template_name = context_params.retrieve_arguments([:service_id!,:option_1!,:option_2!],method_argument_names)
|
223
232
|
response = promote_assembly_aux(:create,assembly_id,service_module_name,assembly_template_name)
|
224
233
|
return response unless response.ok?
|
225
234
|
|
226
235
|
@@invalidate_map << :assembly
|
227
|
-
@@invalidate_map << :
|
236
|
+
@@invalidate_map << :service
|
237
|
+
|
228
238
|
Response::Ok.new()
|
229
239
|
end
|
230
240
|
|
@@ -237,8 +247,8 @@ TODO: overlaps with different meaning
|
|
237
247
|
converge_aux(context_params)
|
238
248
|
end
|
239
249
|
|
240
|
-
desc "SERVICE-NAME/ID push-assembly-updates [SERVICE-MODULE-NAME/ASSEMBLY-NAME]", "Push service instance to the designated assembly; default is parent assembly."
|
241
|
-
def
|
250
|
+
desc "SERVICE-NAME/ID push-assembly-updates [SERVICE-MODULE-NAME/ASSEMBLY-NAME]", "Push changes made to this service instance to the designated assembly; default is parent assembly."
|
251
|
+
def push_assembly_updates(context_params)
|
242
252
|
assembly_id, qualified_assembly_name = context_params.retrieve_arguments([:service_id!,:option_1],method_argument_names)
|
243
253
|
service_module_name, assembly_template_name =
|
244
254
|
if qualified_assembly_name
|
@@ -562,7 +572,7 @@ TODO: will put in dot release and will rename to 'extend'
|
|
562
572
|
# only supported at node-level
|
563
573
|
# using HIDE_FROM_BASE to hide this command from base context (dtk:/assembly>)
|
564
574
|
desc "HIDE_FROM_BASE add-component NODE-NAME COMPONENT", "Add a component to the service."
|
565
|
-
def
|
575
|
+
def add_component(context_params)
|
566
576
|
response = create_component_aux(context_params)
|
567
577
|
|
568
578
|
@@invalidate_map << :service
|
@@ -608,7 +618,6 @@ TODO: will put in dot release and will rename to 'extend'
|
|
608
618
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
609
619
|
def delete_component(context_params)
|
610
620
|
response = delete_component_aux(context_params)
|
611
|
-
return response unless response.ok?
|
612
621
|
|
613
622
|
@@invalidate_map << :service
|
614
623
|
@@invalidate_map << :service_node
|
@@ -72,7 +72,7 @@ module DTK::Client
|
|
72
72
|
["info","info","# Info for given assembly in current service module."],
|
73
73
|
["stage", "stage [INSTANCE-NAME] [-t TARGET-NAME/ID]", "# Stage assembly in target."],
|
74
74
|
# ["deploy","deploy [-v VERSION] [INSTANCE-NAME] [-t TARGET-NAME/ID] [-m COMMIT-MSG]", "# Stage and deploy assembly in target."],
|
75
|
-
["deploy","deploy [INSTANCE-NAME] [-t TARGET-NAME/ID] [-m COMMIT-MSG]", "# Stage and deploy assembly in target."],
|
75
|
+
# ["deploy","deploy [INSTANCE-NAME] [-t TARGET-NAME/ID] [-m COMMIT-MSG]", "# Stage and deploy assembly in target."],
|
76
76
|
["list-nodes","list-nodes", "# List all nodes for given assembly."],
|
77
77
|
["list-components","list-components", "# List all components for given assembly."]
|
78
78
|
]
|
@@ -586,7 +586,8 @@ module DTK::Client
|
|
586
586
|
PushCatalogs = ["origin", "dtkn"]
|
587
587
|
=end
|
588
588
|
|
589
|
-
desc "SERVICE-MODULE-NAME/ID push [-m COMMIT-MSG]", "Push changes from local copy to server (origin)."
|
589
|
+
# desc "SERVICE-MODULE-NAME/ID push [-m COMMIT-MSG]", "Push changes from local copy to server (origin)."
|
590
|
+
desc "SERVICE-MODULE-NAME/ID push", "Push changes from local copy to server."
|
590
591
|
method_option "message",:aliases => "-m" ,
|
591
592
|
:type => :string,
|
592
593
|
:banner => "COMMIT-MSG",
|
@@ -608,7 +609,8 @@ module DTK::Client
|
|
608
609
|
push_clone_changes_aux(:service_module,service_module_id,version,nil,internal_trigger)
|
609
610
|
end
|
610
611
|
|
611
|
-
desc "SERVICE-MODULE-NAME/ID push-dtkn [-n NAMESPACE] [-m COMMIT-MSG]", "Push changes from local copy of service module to remote repository (dtkn)."
|
612
|
+
# desc "SERVICE-MODULE-NAME/ID push-dtkn [-n NAMESPACE] [-m COMMIT-MSG]", "Push changes from local copy of service module to remote repository (dtkn)."
|
613
|
+
desc "SERVICE-MODULE-NAME/ID push-dtkn [-n NAMESPACE]", "Push changes from local copy of service module to remote repository (dtkn)."
|
612
614
|
method_option "message",:aliases => "-m" ,
|
613
615
|
:type => :string,
|
614
616
|
:banner => "COMMIT-MSG",
|
@@ -175,8 +175,8 @@ module DTK::Client
|
|
175
175
|
push_module_updates_aux(context_params)
|
176
176
|
end
|
177
177
|
|
178
|
-
desc "WORKSPACE-NAME/ID push-assembly-updates SERVICE-MODULE-NAME/ASSEMBLY-NAME", "Push
|
179
|
-
def
|
178
|
+
desc "WORKSPACE-NAME/ID push-assembly-updates SERVICE-MODULE-NAME/ASSEMBLY-NAME", "Push changes made to this workspace to the designated assembly."
|
179
|
+
def push_assembly_updates(context_params)
|
180
180
|
workspace_id, qualified_assembly_name = context_params.retrieve_arguments([:workspace_id!,:option_1!],method_argument_names)
|
181
181
|
if qualified_assembly_name =~ /(^[^\/]*)\/([^\/]*$)/
|
182
182
|
service_module_name, assembly_template_name = [$1,$2]
|
@@ -192,7 +192,7 @@ module DTK::Client
|
|
192
192
|
desc "WORKSPACE-NAME/ID create-assembly SERVICE-MODULE-NAME ASSEMBLY-NAME [-p]", "Create a new assembly from the workspace instance in the designated service module."
|
193
193
|
# The option -p will purge the workspace after assembly creation."
|
194
194
|
method_option :purge, :aliases => '-p', :type => :boolean, :default => false
|
195
|
-
def
|
195
|
+
def create_assembly(context_params)
|
196
196
|
workspace_id, service_module_name, assembly_template_name = context_params.retrieve_arguments([:workspace_id!,:option_1!,:option_2!],method_argument_names)
|
197
197
|
response = promote_assembly_aux(:create,workspace_id,service_module_name,assembly_template_name)
|
198
198
|
return response unless response.ok?
|
@@ -202,7 +202,8 @@ module DTK::Client
|
|
202
202
|
end
|
203
203
|
|
204
204
|
@@invalidate_map << :assembly
|
205
|
-
@@invalidate_map << :
|
205
|
+
@@invalidate_map << :service
|
206
|
+
|
206
207
|
Response::Ok.new()
|
207
208
|
end
|
208
209
|
|
@@ -266,7 +267,6 @@ module DTK::Client
|
|
266
267
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
267
268
|
def delete_component(context_params)
|
268
269
|
response = delete_component_aux(context_params)
|
269
|
-
return response unless response.ok?
|
270
270
|
|
271
271
|
@@invalidate_map << :service
|
272
272
|
@@invalidate_map << :service_node
|
@@ -396,6 +396,12 @@ module DTK::Client
|
|
396
396
|
purge_aux(context_params)
|
397
397
|
end
|
398
398
|
|
399
|
+
desc "WORKSPACE-NAME/ID destroy-and-reset-nodes [-y]", "Terminates all nodes, but keeps config state so they can be spun up from scratch."
|
400
|
+
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
401
|
+
def destroy_and_reset_nodes(context_params)
|
402
|
+
destroy_and_reset_nodes_aux(context_params)
|
403
|
+
end
|
404
|
+
|
399
405
|
desc "WORKSPACE-NAME/ID set-target TARGET-NAME/ID", "Set target associated with workspace."
|
400
406
|
def set_target(context_params)
|
401
407
|
set_target_aux(context_params)
|
data/lib/core.rb
CHANGED
@@ -82,6 +82,7 @@ def top_level_execute_core(entity_name, method_name, context_params=nil, options
|
|
82
82
|
validation_message += ", usage: #{usage_info}"
|
83
83
|
|
84
84
|
validation_message.gsub!("^^", '') if validation_message.include?("^^")
|
85
|
+
validation_message.gsub!("HIDE_FROM_BASE ", '') if validation_message.include?("HIDE_FROM_BASE")
|
85
86
|
end
|
86
87
|
|
87
88
|
DTK::Client::OsUtil.print(validation_message, :yellow)
|
@@ -115,14 +116,23 @@ def check_direct_access(params)
|
|
115
116
|
|
116
117
|
puts "Adding direct access for current user..."
|
117
118
|
# response = DTK::Client::Account.add_access(params[:ssh_key_path])
|
118
|
-
response = DTK::Client::Account.add_key(params[:ssh_key_path])
|
119
|
+
response, matched_pub_key, matched_username = DTK::Client::Account.add_key(params[:ssh_key_path])
|
119
120
|
|
120
|
-
if
|
121
|
-
DTK::Client::OsUtil.print("We were not able to add direct access for current user. In order to properly use dtk-shell you will have to add access manually ('dtk account add-ssh-key').\n", :yellow)
|
122
|
-
|
121
|
+
if !response.ok?
|
122
|
+
DTK::Client::OsUtil.print("We were not able to add direct access for current user, server error '#{response.error_message}'. In order to properly use dtk-shell you will have to add access manually ('dtk account add-ssh-key').\n", :yellow)
|
123
|
+
elsif matched_pub_key
|
124
|
+
# message will be displayed by add key # TODO: Refactor this flow
|
125
|
+
DTK::Client::OsUtil.print("Provided SSH PUB key has already been added.", :yellow)
|
126
|
+
FileUtils.touch(params[:file_path])
|
127
|
+
elsif matched_username
|
128
|
+
DTK::Client::OsUtil.print("User with provided name already exists.", :yellow)
|
129
|
+
else
|
130
|
+
DTK::Client::OsUtil.print("Your SSH PUB key has been successfully added.", :yellow)
|
131
|
+
FileUtils.touch(params[:file_path])
|
123
132
|
end
|
133
|
+
|
124
134
|
|
125
|
-
|
135
|
+
response
|
126
136
|
end
|
127
137
|
|
128
138
|
module DTK
|
data/lib/dtk-client/version.rb
CHANGED
@@ -24,9 +24,12 @@ module DTK
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Generic wizard which will return hash map based on metadata input
|
27
|
+
#
|
28
|
+
# Example provided bellow
|
29
|
+
#
|
27
30
|
def self.interactive_user_input(wizard_dsl, recursion_call = false)
|
28
31
|
results = {}
|
29
|
-
|
32
|
+
wizard_dsl = [wizard_dsl].flatten
|
30
33
|
begin
|
31
34
|
wizard_dsl.each do |meta_input|
|
32
35
|
input_name = meta_input.keys.first
|
@@ -56,7 +59,7 @@ module DTK
|
|
56
59
|
validation = (validation_range_start..metadata[:options].size).to_a
|
57
60
|
when :group
|
58
61
|
# recursion call to populate second level of hash params
|
59
|
-
puts " Enter '#{display_name}'
|
62
|
+
puts " Enter '#{display_name}': "
|
60
63
|
results[input_name] = self.interactive_user_input(metadata[:options], true)
|
61
64
|
next
|
62
65
|
end
|
data/lib/util/os_util.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
dtk_require_from_base('domain/response')
|
2
2
|
dtk_require_from_base('auxiliary')
|
3
3
|
require 'highline'
|
4
|
+
require 'readline'
|
4
5
|
|
5
6
|
module DTK
|
6
7
|
module Client
|
@@ -25,6 +26,14 @@ module DTK
|
|
25
26
|
is_windows? ? genv(:temp) : '/tmp'
|
26
27
|
end
|
27
28
|
|
29
|
+
|
30
|
+
def pop_readline_history(number_of_last_commands)
|
31
|
+
number_of_last_commands.downto(1) do
|
32
|
+
Readline::HISTORY.pop
|
33
|
+
end
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
28
37
|
def get_log_location
|
29
38
|
return "#{dtk_local_folder}"
|
30
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich PELAVIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|