dtk-client 0.12.0.1 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/dtk-client.gemspec +3 -3
- data/lib/cli/command/module/pull_dtkn.rb +1 -1
- data/lib/cli/command/module/push_dtkn.rb +10 -1
- data/lib/cli/command/module/uninstall.rb +3 -3
- data/lib/cli/command/service.rb +4 -3
- data/lib/cli/command/service/add_component.rb +42 -0
- data/lib/cli/command/service/{link.rb → add_link.rb} +2 -2
- data/lib/cli/command/service/delete.rb +5 -3
- data/lib/cli/command/service/describe.rb +3 -1
- data/lib/cli/command/service/ssh.rb +9 -4
- data/lib/cli/command/service/uninstall.rb +3 -3
- data/lib/cli/command/token.rb +7 -3
- data/lib/cli/runner/dtkn_access.rb +20 -19
- data/lib/cli/version.rb +1 -1
- data/lib/client/configurator.rb +15 -0
- data/lib/client/error.rb +6 -6
- data/lib/client/operation.rb +6 -1
- data/lib/client/operation/account/delete_ssh_key.rb +2 -0
- data/lib/client/operation/client_module_dir/git_repo/internal.rb +1 -1
- data/lib/client/operation/client_module_dir/service_instance.rb +19 -0
- data/lib/client/operation/client_module_dir/service_instance/internal.rb +51 -0
- data/lib/client/operation/module/clone_module.rb +5 -3
- data/lib/client/operation/module/pull_dtkn.rb +6 -2
- data/lib/client/operation/module/push.rb +13 -4
- data/lib/client/operation/module/push_dtkn.rb +53 -16
- data/lib/client/operation/service.rb +3 -2
- data/lib/client/operation/service/add_component.rb +59 -0
- data/lib/client/operation/service/{link.rb → add_link.rb} +0 -0
- data/lib/client/operation/service/commit_and_push.rb +3 -0
- data/lib/client/operation/service/converge.rb +8 -2
- data/lib/client/operation/service/delete.rb +9 -2
- data/lib/client/operation/service/describe.rb +14 -1
- data/lib/client/operation/service/exec.rb +7 -3
- data/lib/client/operation/service/ssh.rb +16 -2
- data/lib/client/operation/service/task_status.rb +8 -1
- data/lib/client/operation/service/uninstall.rb +13 -0
- data/lib/client/util/validation.rb +2 -2
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dd3532222d39184fd4e4b3dabe6089082d66997065b60710dac9315669f0bdb1
|
4
|
+
data.tar.gz: 1a596bb53b1fa93c2dfc24a792836a5377fac27947acbaeea54bf069a45dce5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6be78d166a7b90eddd422a3e39fc2f5cc12ac382a896c5bf6813bc9c85ddfbb8aaac111a6e963eb4bcad14c0d7c2ff569122d204194d8721ef17bcaf9b56a5e1
|
7
|
+
data.tar.gz: 1fad3c04de2c251f96f84a3ba729e1713024d9bdb0891c6ab2b6c8bc0eb25ae3247c0aee258933c4b9ba4aa0daf72d35e026b94db5b949427a804c640cc37c17
|
data/.gitignore
CHANGED
data/dtk-client.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'gli', '2.13.4'
|
22
22
|
spec.add_dependency 'highline', '1.7.8'
|
23
23
|
spec.add_dependency 'colorize', '0.7.7'
|
24
|
-
spec.add_dependency 'git', '1.
|
24
|
+
spec.add_dependency 'git', '~> 1.4.0'
|
25
25
|
spec.add_dependency 'hirb', '0.7.3'
|
26
26
|
spec.add_dependency 'mime-types', '~> 2.99.3'
|
27
|
-
spec.add_dependency 'dtk-dsl', '1.1.4'
|
28
|
-
spec.add_dependency 'dtk-network-client', '1.0.
|
27
|
+
spec.add_dependency 'dtk-dsl', '~> 1.1.4'
|
28
|
+
spec.add_dependency 'dtk-network-client', '1.0.3'
|
29
29
|
end
|
@@ -35,7 +35,7 @@ module DTK::Client
|
|
35
35
|
:update_deps => options[:update_deps]
|
36
36
|
}
|
37
37
|
Operation::Module.pull_dtkn(operation_args)
|
38
|
-
|
38
|
+
Operation::Module.push(operation_args.merge(:method => "pulled", context: self))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -22,9 +22,18 @@ module DTK::Client
|
|
22
22
|
command_body c, 'push-dtkn', 'Push content from client module directory to dtk network' do |sc|
|
23
23
|
sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing updates to push; not need if in the module directory'
|
24
24
|
sc.switch Token.update_lock
|
25
|
+
sc.switch Token.force
|
26
|
+
|
25
27
|
sc.action do |_global_options, options, _args|
|
26
28
|
module_ref = module_ref_object_from_options_or_context(options)
|
27
|
-
|
29
|
+
operation_args = {
|
30
|
+
:module_ref => module_ref,
|
31
|
+
:base_dsl_file_obj => @base_dsl_file_obj,
|
32
|
+
:directory_path => options[:directory_path],
|
33
|
+
:update_lock_file => options['update-lock'],
|
34
|
+
:force => options[:f]
|
35
|
+
}
|
36
|
+
Operation::Module.push_dtkn(operation_args)
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
@@ -24,14 +24,14 @@ module DTK::Client
|
|
24
24
|
sc.switch Token.skip_prompt, :desc => 'Skip prompt that checks if user wants to uninstall module from server'
|
25
25
|
sc.flag Token.directory_path
|
26
26
|
sc.flag Token.version
|
27
|
-
sc.flag Token.
|
27
|
+
sc.flag Token.uninstall_module_name
|
28
28
|
sc.switch Token.force
|
29
29
|
sc.action do |_global_options, options, args|
|
30
30
|
version = options[:version]
|
31
31
|
force = options["force"]
|
32
32
|
|
33
33
|
module_refs_opts = {:ignore_parsing_errors => true}
|
34
|
-
if options[:
|
34
|
+
if options[:uninstall_module_name].nil?
|
35
35
|
module_ref =
|
36
36
|
if module_name = args[0]
|
37
37
|
module_ref_object_from_options_or_context?({:module_ref => module_name, :version => (version)}, module_refs_opts)
|
@@ -44,7 +44,7 @@ module DTK::Client
|
|
44
44
|
|
45
45
|
raise Error::Usage, "You can use version only with 'namespace/name' provided" if version && module_name.nil?
|
46
46
|
|
47
|
-
Operation::Module.uninstall(:module_ref => module_ref, :force => force, :skip_prompt => options[:skip_prompt], :name => options[:
|
47
|
+
Operation::Module.uninstall(:module_ref => module_ref, :force => force, :skip_prompt => options[:skip_prompt], :name => options[:uninstall_module_name] || module_name, :version => version)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
data/lib/cli/command/service.rb
CHANGED
@@ -31,7 +31,7 @@ module DTK::Client
|
|
31
31
|
'eject',
|
32
32
|
'exec',
|
33
33
|
'exec-sync',
|
34
|
-
'link',
|
34
|
+
'add-link',
|
35
35
|
'list',
|
36
36
|
'list-actions',
|
37
37
|
'list-attributes',
|
@@ -52,8 +52,9 @@ module DTK::Client
|
|
52
52
|
|
53
53
|
'task-status',
|
54
54
|
'uninstall',
|
55
|
-
'describe'
|
56
|
-
# 'add'
|
55
|
+
'describe',
|
56
|
+
# 'add',
|
57
|
+
'add-component'
|
57
58
|
]
|
58
59
|
|
59
60
|
command_def :desc => 'Subcommands for creating and interacting with DTK service instances'
|
@@ -0,0 +1,42 @@
|
|
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; module CLI
|
19
|
+
module Command
|
20
|
+
module Service
|
21
|
+
subcommand_def 'add-component' do |c|
|
22
|
+
c.arg Token::Arg.component_ref
|
23
|
+
command_body c, 'add-component', 'Add component to service instance' do |sc|
|
24
|
+
sc.flag Token.version
|
25
|
+
sc.flag Token.namespace
|
26
|
+
sc.flag Token.parent
|
27
|
+
sc.action do |_global_options, options, args|
|
28
|
+
args = {
|
29
|
+
service_instance: service_instance_in_options_or_context(options),
|
30
|
+
component_ref: args[0],
|
31
|
+
version: options[:v],
|
32
|
+
namespace: options[:n],
|
33
|
+
parent_node: options[:p],
|
34
|
+
service_instance_dir: @base_dsl_file_obj.parent_dir
|
35
|
+
}
|
36
|
+
Operation::Service.add_component(args)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end; end
|
@@ -18,11 +18,11 @@
|
|
18
18
|
module DTK::Client; module CLI
|
19
19
|
module Command
|
20
20
|
module Service
|
21
|
-
subcommand_def 'link' do |c|
|
21
|
+
subcommand_def 'add-link' do |c|
|
22
22
|
c.arg Token::Arg.base_cmp
|
23
23
|
c.arg Token::Arg.deps_on_cmp
|
24
24
|
c.arg Token::Arg.service, :optional => true
|
25
|
-
command_body c, 'link', 'List component links in the service instance.' do |sc|
|
25
|
+
command_body c, 'add-link', 'List component links in the service instance.' do |sc|
|
26
26
|
sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory containing updates to pull; not need if in the service instance directory'
|
27
27
|
sc.switch Token.unlink
|
28
28
|
|
@@ -20,6 +20,7 @@ module DTK::Client; module CLI
|
|
20
20
|
module Service
|
21
21
|
subcommand_def 'delete' do |c|
|
22
22
|
command_body c, :delete, 'Destroys the running infrastructure associated with the service instance' do |sc|
|
23
|
+
sc.flag Token.delete_service_name
|
23
24
|
sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory associated; not needed if executed in service instance directory'
|
24
25
|
# sc.flag Token.path, :desc => "Delete specific part of service instance. Supported paths are 'dependencies/[name]', 'components/[name]', 'actions/[name]'"
|
25
26
|
|
@@ -31,16 +32,17 @@ module DTK::Client; module CLI
|
|
31
32
|
directory_path = options[:directory_path]
|
32
33
|
recursive = options[:recursive]
|
33
34
|
force = options[:f]
|
34
|
-
|
35
|
-
|
35
|
+
name = options[:delete_service_name]
|
36
|
+
service_instance = name ? name : service_instance_in_options_or_context(options)
|
37
|
+
|
36
38
|
args = {
|
37
39
|
:service_instance => service_instance,
|
38
40
|
:skip_prompt => options[:skip_prompt],
|
39
|
-
:directory_path => directory_path || base_dsl_file_obj.parent_dir,
|
40
41
|
:recursive => recursive,
|
41
42
|
:force => force,
|
42
43
|
# :path => options[:path]
|
43
44
|
}
|
45
|
+
args[:directory_path] = directory_path || base_dsl_file_obj.parent_dir unless name
|
44
46
|
Operation::Service.delete(args)
|
45
47
|
end
|
46
48
|
end
|
@@ -21,10 +21,12 @@ module DTK::Client; module CLI
|
|
21
21
|
subcommand_def 'describe' do |c|
|
22
22
|
command_body c, 'describe', 'Describe service instance content' do |sc|
|
23
23
|
sc.flag Token.path, :desc => "supported paths are 'dependencies', 'components/[name]', 'actions/[name]' "
|
24
|
+
sc.switch Token.show_steps, :desc => 'Show steps that will be executed when action is executed'
|
24
25
|
sc.action do |_global_options, options, _args|
|
25
26
|
args = {
|
26
27
|
service_instance: service_instance_in_options_or_context(options),
|
27
|
-
path: options[:path]
|
28
|
+
path: options[:path],
|
29
|
+
show_steps: options['show-steps']
|
28
30
|
}
|
29
31
|
Operation::Service.describe(args)
|
30
32
|
end
|
@@ -19,17 +19,22 @@ module DTK::Client
|
|
19
19
|
module CLI::Command
|
20
20
|
module Service
|
21
21
|
subcommand_def 'ssh' do |c|
|
22
|
-
c.arg Token::Arg.node_name
|
22
|
+
c.arg Token::Arg.node_name, :optional => true
|
23
23
|
command_body c, :ssh, 'SSH into service instance node.' do |sc|
|
24
24
|
sc.flag Token.remote_user
|
25
25
|
sc.flag Token.identity_file, :desc => 'Identity file used for connection, if not provided default is used'
|
26
26
|
|
27
27
|
sc.action do |_global_options, options, args|
|
28
|
-
|
28
|
+
node_name = args[0]
|
29
|
+
if args[0] && args[0].include?('/')
|
30
|
+
service_name, node_name = args[0].split('/')
|
31
|
+
end
|
32
|
+
|
33
|
+
service_name ||= service_instance_in_options_or_context(options)
|
29
34
|
|
30
35
|
args = {
|
31
|
-
:service_instance =>
|
32
|
-
:node_name =>
|
36
|
+
:service_instance => service_name,
|
37
|
+
:node_name => node_name,
|
33
38
|
:remote_user => options[:remote_user],
|
34
39
|
:identity_file => options[:identity_file]
|
35
40
|
}
|
@@ -21,7 +21,7 @@ module DTK::Client; module CLI
|
|
21
21
|
subcommand_def 'uninstall' do |c|
|
22
22
|
command_body c, :uninstall, 'Uninstalls the service instance from the server' do |sc|
|
23
23
|
sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory associated; not needed if executed in service instance directory'
|
24
|
-
sc.flag Token.
|
24
|
+
sc.flag Token.uninstall_service_name
|
25
25
|
sc.switch Token.skip_prompt, :desc => 'Skip prompt that checks if user wants to delete the service instance'
|
26
26
|
sc.switch Token.purge, :desc => 'Delete the service instance directory on the client'
|
27
27
|
sc.switch Token.recursive, :desc => 'Delete dependent service instances'
|
@@ -31,7 +31,7 @@ module DTK::Client; module CLI
|
|
31
31
|
purge = options[:purge]
|
32
32
|
force = options[:f]
|
33
33
|
recursive = options[:recursive]
|
34
|
-
name = options[:
|
34
|
+
name = options[:uninstall_service_name]
|
35
35
|
|
36
36
|
if purge && (!directory_path || (directory_path == @base_dsl_file_obj.parent_dir?))
|
37
37
|
raise Error::Usage, "If use option '#{option_ref(:purge)}' then need to call from outside directory and use option '#{option_ref(:directory_path)}'"
|
@@ -46,11 +46,11 @@ module DTK::Client; module CLI
|
|
46
46
|
args = {
|
47
47
|
:service_instance => service_instance,
|
48
48
|
:skip_prompt => options[:skip_prompt],
|
49
|
-
:directory_path => directory_path,
|
50
49
|
:purge => purge,
|
51
50
|
:recursive => recursive,
|
52
51
|
:force => force
|
53
52
|
}
|
53
|
+
args[:directory_path] = directory_path || base_dsl_file_obj.parent_dir unless name
|
54
54
|
Operation::Service.uninstall(args)
|
55
55
|
end
|
56
56
|
end
|
data/lib/cli/command/token.rb
CHANGED
@@ -47,12 +47,15 @@ module DTK::Client
|
|
47
47
|
:identity_file => Flag.new(:i, 'PATH-TO-PEM', 'Path to pem file'),
|
48
48
|
:mode => Flag.new(:mode, 'MODE', 'Mode'),
|
49
49
|
:namespace => Flag.new(:n, 'NAMESPACE', 'Namespace'),
|
50
|
-
:
|
50
|
+
:uninstall_module_name => Flag.new(:name, 'NAME', 'Module name to uninstall'),
|
51
|
+
:uninstall_service_name => Flag.new(:name, 'NAME', 'Service instance name to uninstall'),
|
52
|
+
:delete_service_name => Flag.new(:name, 'NAME', 'Service instance name to delete'),
|
51
53
|
:link_name => Flag.new([:l, :link_name], 'link-name', 'Specify link name'),
|
52
54
|
:format => Flag.new(:format, 'FORMAT', 'Choose in which format to display data (ex. TABLE, YAML)'),
|
53
55
|
:sleep => Flag.new(:sleep, '', ''),
|
54
56
|
:attempts => Flag.new(:attempts, '', ''),
|
55
57
|
:path => Flag.new(:path, 'PATH', 'Path'),
|
58
|
+
:parent => Flag.new([:p, :parent], 'PARENT', ''),
|
56
59
|
|
57
60
|
# switches
|
58
61
|
# Switch constructor args order: key, desc, opts={}
|
@@ -72,13 +75,14 @@ module DTK::Client
|
|
72
75
|
:recursive => Switch.new(:r, 'Recursive'),
|
73
76
|
:update_deps => Switch.new('update-deps', "Skip prompt and update all dependencies or skip prompt and don't update all dependencies (on master)", :negatable => true, :default_value => 'prompt'),
|
74
77
|
:skip_server => Switch.new('skip-server', 'Do not install module on server'),
|
75
|
-
:update_lock => Switch.new([:u, 'update-lock'], 'Update lock file with new dependencies')
|
78
|
+
:update_lock => Switch.new([:u, 'update-lock'], 'Update lock file with new dependencies'),
|
79
|
+
:show_steps => Switch.new('show-steps', 'Show steps')
|
76
80
|
}
|
77
81
|
|
78
82
|
ARG_TOKENS = {
|
79
83
|
:assembly_name => 'ASSEMBLY-NAME',
|
80
84
|
:service_instance => flag_token(:service_instance).arg_name,
|
81
|
-
:node_name => 'NODE',
|
85
|
+
:node_name => '[[REMOTE_SERVICE-NAME/]NODE]',
|
82
86
|
:action => '[NODE/NODE-GROUP/]ACTION',
|
83
87
|
:action_params => 'ACTION-PARAMS',
|
84
88
|
:workspace_name => 'WORKSPACE-NAME',
|
@@ -26,26 +26,27 @@ module DTK::Client; module CLI
|
|
26
26
|
|
27
27
|
OsUtil.print_info('Processing ...') if config_existed
|
28
28
|
# check to see if catalog credentials are set
|
29
|
-
conn = Session.get_connection
|
30
|
-
response = conn.post 'account/check_catalog_credentials'
|
29
|
+
# conn = Session.get_connection
|
30
|
+
# response = conn.post 'account/check_catalog_credentials'
|
31
31
|
|
32
|
-
# set catalog credentails
|
33
|
-
if response.ok? && !response.data(:catalog_credentials_set)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
32
|
+
# # set catalog credentails
|
33
|
+
# if response.ok? && !response.data(:catalog_credentials_set)
|
34
|
+
# # setting up catalog credentials
|
35
|
+
# catalog_creds = Configurator.ask_catalog_credentials
|
36
|
+
# unless catalog_creds.empty?
|
37
|
+
# post_body = {
|
38
|
+
# :username => catalog_creds[:username],
|
39
|
+
# :password => catalog_creds[:password],
|
40
|
+
# :validate => true
|
41
|
+
# }
|
42
|
+
# response = conn.post 'account/set_catalog_credentials', post_body
|
43
|
+
# unless response.ok?
|
44
|
+
# error_message = response.error_message.gsub(/\.[ ]*$/,'')
|
45
|
+
# OsUtil.print_error("#{error_message}. You will have to set catalog credentials manually ('dtk account set-catalog-credentials').")
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
|
49
50
|
add_key_opts = {
|
50
51
|
:first_registration => true,
|
51
52
|
:name => "#{Session.connection_username}-client"
|
data/lib/cli/version.rb
CHANGED
data/lib/client/configurator.rb
CHANGED
@@ -110,6 +110,21 @@ module DTK::Client
|
|
110
110
|
|
111
111
|
true
|
112
112
|
end
|
113
|
+
|
114
|
+
def self.remove_current_user_from_direct_access
|
115
|
+
remove_user_from_direct_access(client_username)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.remove_user_from_direct_access(username)
|
119
|
+
File.open('.temp_direct_access', 'w') do |output_file|
|
120
|
+
File.foreach(DIRECT_ACCESS) do |line|
|
121
|
+
output_file.puts line unless line.strip.eql?(username)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
FileUtils.mv('.temp_direct_access', DIRECT_ACCESS)
|
126
|
+
true
|
127
|
+
end
|
113
128
|
|
114
129
|
def self.client_username
|
115
130
|
parse_key_value_file(CRED_FILE)[:username]
|
data/lib/client/error.rb
CHANGED
@@ -53,13 +53,13 @@ module DTK::Client
|
|
53
53
|
NO_BACKTRACE = :no_backtarce
|
54
54
|
|
55
55
|
def backtrace?
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
if @backtrace
|
57
|
+
@backtrace unless @backtrace == NO_BACKTRACE
|
58
|
+
else
|
59
|
+
backtrace
|
60
|
+
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def self.raise_if_error_info(response, opts = {})
|
64
64
|
# check for errors in response
|
65
65
|
error = response.error_info?(opts)
|
data/lib/client/operation.rb
CHANGED
@@ -59,7 +59,12 @@ module DTK::Client
|
|
59
59
|
if response.ok?
|
60
60
|
response
|
61
61
|
else
|
62
|
-
|
62
|
+
# if errors = response['errors']
|
63
|
+
# error_message = errors.first['message']
|
64
|
+
# raise Error::Server.new(error_message)
|
65
|
+
# else
|
66
|
+
raise Error::ServerNotOkResponse.new(response)
|
67
|
+
# end
|
63
68
|
end
|
64
69
|
end
|
65
70
|
|
@@ -34,6 +34,8 @@ module DTK::Client
|
|
34
34
|
OsUtil.print("Warning: We were not able to unregister your key with remote catalog! #{response.data(:repoman_registration_error)}", :yellow)
|
35
35
|
end
|
36
36
|
|
37
|
+
Configurator.remove_current_user_from_direct_access
|
38
|
+
|
37
39
|
OsUtil.print("SSH key '#{name}' removed successfully!", :yellow)
|
38
40
|
end
|
39
41
|
end
|
@@ -313,7 +313,7 @@ module DTK::Client
|
|
313
313
|
|
314
314
|
def self.checkout_branch_on_service_instance(service_instance, branch, &body)
|
315
315
|
repo = git_repo.new(ret_base_path(:service, service_instance), :branch => branch)
|
316
|
-
|
316
|
+
checkout_branch(repo, branch, {}, &body)
|
317
317
|
end
|
318
318
|
|
319
319
|
CHECKOUT_LOCK = Mutex.new
|
@@ -31,6 +31,25 @@ module DTK::Client
|
|
31
31
|
response_data_hash(:nested_modules => Internal.commit_and_push_nested_modules(args))
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
def self.clone_nested_modules(args)
|
36
|
+
wrap_operation(args) do |args|
|
37
|
+
response_data_hash(:target_repo_dir => Internal.clone_nested_modules(args))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.modified_service_instance_or_nested_modules?(args)
|
42
|
+
wrap_operation(args) do |args|
|
43
|
+
response_data_hash(:modified => Internal.modified_service_instance_or_nested_modules?(args))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.remove_nested_module_dirs(args)
|
48
|
+
wrap_operation(args) do |args|
|
49
|
+
response_data_hash(:deleted_nested_modules => Internal.remove_nested_module_dirs(args))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
34
53
|
end
|
35
54
|
end
|
36
55
|
end
|
@@ -35,6 +35,16 @@ module DTK::Client
|
|
35
35
|
new(args).clone
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.clone_nested_modules(args)
|
39
|
+
new(args).clone_nested_modules
|
40
|
+
end
|
41
|
+
|
42
|
+
def clone_nested_modules
|
43
|
+
@target_repo_dir = self.repo_dir
|
44
|
+
@nested_module_base = self.class.find_nested_modules_dir(self.repo_dir)
|
45
|
+
self.nested_modules.each { |nested_module| clone_nested_module(nested_module) }
|
46
|
+
end
|
47
|
+
|
38
48
|
def clone
|
39
49
|
@target_repo_dir = clone_base_module
|
40
50
|
@nested_module_base = make_nested_module_base
|
@@ -61,6 +71,37 @@ module DTK::Client
|
|
61
71
|
nested_modules_with_sha
|
62
72
|
end
|
63
73
|
|
74
|
+
def self.modified_service_instance_or_nested_modules?(args)
|
75
|
+
service_instance_dir = args.required(:dir)
|
76
|
+
command = args.required(:command)
|
77
|
+
error_msg = args.required(:error_msg)
|
78
|
+
|
79
|
+
is_modified?(service_instance_dir, command, error_msg)
|
80
|
+
|
81
|
+
nested_modules_dir = find_nested_modules_dir(service_instance_dir)
|
82
|
+
nested_modules = Dir.glob("#{nested_modules_dir}/*")
|
83
|
+
|
84
|
+
nested_modules.each do |nested_module|
|
85
|
+
nested_module_name = nested_module.split('/').last
|
86
|
+
nested_error_msg = "There are uncommitted changes in nested module '#{nested_module_name}'! #{error_msg}"
|
87
|
+
is_modified?(nested_module, command, nested_error_msg)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.remove_nested_module_dirs(args)
|
92
|
+
service_instance = args[:service_instance]
|
93
|
+
service_instance_dir = args[:service_instance_dir] || ret_base_path(:service, service_instance)
|
94
|
+
|
95
|
+
nested_modules_dir = find_nested_modules_dir(service_instance_dir)
|
96
|
+
nested_modules = Dir.glob("#{nested_modules_dir}/*")
|
97
|
+
|
98
|
+
args[:nested_modules_to_delete].each do |nested_module|
|
99
|
+
module_to_delete_path = "#{nested_modules_dir}/#{nested_module['display_name']}"
|
100
|
+
FileUtils.remove_dir(module_to_delete_path) if nested_modules.include? module_to_delete_path
|
101
|
+
end
|
102
|
+
args[:nested_modules_to_delete]
|
103
|
+
end
|
104
|
+
|
64
105
|
protected
|
65
106
|
|
66
107
|
attr_reader :base_module, :nested_modules, :service_instance, :remove_existing, :repo_dir
|
@@ -121,6 +162,16 @@ module DTK::Client
|
|
121
162
|
def self.possible_nested_module_base_dirs
|
122
163
|
@possible_nested_module_base_dirs ||= ::DTK::DSL::DirectoryType::ServiceInstance::NestedModule.possible_paths
|
123
164
|
end
|
165
|
+
|
166
|
+
def self.is_modified?(path, command, error_msg)
|
167
|
+
repo_dir = {
|
168
|
+
:path => path,
|
169
|
+
:branch => Git.open(path).branches.local,
|
170
|
+
:command => command
|
171
|
+
}
|
172
|
+
message = ClientModuleDir::GitRepo.modified_with_diff(repo_dir)
|
173
|
+
raise Error::Usage, error_msg if message.data(:modified)
|
174
|
+
end
|
124
175
|
|
125
176
|
end
|
126
177
|
end
|
@@ -64,10 +64,10 @@ module DTK::Client
|
|
64
64
|
|
65
65
|
# OsUtil.print_info("DTK module '#{@module_ref.pretty_print}' has been successfully cloned into '#{ret.required(:target_repo_dir)}'")
|
66
66
|
target_repo_dir = ret.required(:target_repo_dir)
|
67
|
-
pull_service_info = check_if_pull_needed
|
67
|
+
# pull_service_info = check_if_pull_needed
|
68
68
|
{
|
69
|
-
target_repo_dir: target_repo_dir
|
70
|
-
pull_service_info: pull_service_info
|
69
|
+
target_repo_dir: target_repo_dir
|
70
|
+
# pull_service_info: pull_service_info
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
@@ -97,6 +97,8 @@ module DTK::Client
|
|
97
97
|
remote_module_info = rest_get "#{BaseRoute}/remote_module_info", query_string_hash
|
98
98
|
rescue DTK::Client::Error::ServerNotOkResponse => e
|
99
99
|
# ignore if remote does not exist
|
100
|
+
rescue DTK::Client::Error::Server => error
|
101
|
+
# ignore if remote does not exist
|
100
102
|
end
|
101
103
|
|
102
104
|
if remote_module_info && remote_module_info.data(:service_info)
|
@@ -85,8 +85,12 @@ module DTK::Client
|
|
85
85
|
version: ref_version,
|
86
86
|
repo_dir: target_repo_dir
|
87
87
|
}
|
88
|
-
|
89
|
-
|
88
|
+
begin
|
89
|
+
DtkNetworkClient::Pull.run(module_info, opts)
|
90
|
+
rescue Git::GitExecuteError => e
|
91
|
+
exc = e.to_s << "\nUse '--force' flag to overwrite your changes"
|
92
|
+
raise (e.to_s.include? 'merge') ? exc : e.to_s
|
93
|
+
end
|
90
94
|
|
91
95
|
# query_string_hash = QueryStringHash.new(
|
92
96
|
# :module_name => @module_ref.module_name,
|
@@ -52,7 +52,14 @@ module DTK::Client
|
|
52
52
|
version: module_ref.version,
|
53
53
|
repo_dir: @file_obj.parent_dir
|
54
54
|
}
|
55
|
-
|
55
|
+
|
56
|
+
repoman_client_opts = {
|
57
|
+
format: :hash,
|
58
|
+
save_to_file: true,
|
59
|
+
update_lock_file: update_lock_file
|
60
|
+
}
|
61
|
+
repoman_client_opts.merge!(parsed_module: parsed_module) unless method.eql?('pulled')
|
62
|
+
dependency_tree = DtkNetworkDependencyTree.get_or_create(repoman_client_module_info, repoman_client_opts)
|
56
63
|
|
57
64
|
# TODO: need to refactor to use the same code for push and install
|
58
65
|
dependency_tree.each do |dependency|
|
@@ -120,9 +127,11 @@ module DTK::Client
|
|
120
127
|
:commit_sha => git_repo_response.data(:head_sha)
|
121
128
|
)
|
122
129
|
|
123
|
-
response = handle_error @file_obj.parent_dir do
|
124
|
-
|
125
|
-
end
|
130
|
+
# response = handle_error @file_obj.parent_dir do
|
131
|
+
# rest_post("#{BaseRoute}/update_from_repo", post_body)
|
132
|
+
# end
|
133
|
+
|
134
|
+
response = rest_post("#{BaseRoute}/update_from_repo", post_body)
|
126
135
|
|
127
136
|
existing_diffs = nil
|
128
137
|
print = nil
|
@@ -21,7 +21,7 @@ module DTK::Client
|
|
21
21
|
require_relative('push_dtkn/convert_source')
|
22
22
|
|
23
23
|
attr_reader :version, :module_ref, :target_repo_dir, :base_dsl_file_obj
|
24
|
-
def initialize(catalog, module_ref, directory_path, version, base_dsl_file_obj, update_lock_file)
|
24
|
+
def initialize(catalog, module_ref, directory_path, version, base_dsl_file_obj, update_lock_file, force)
|
25
25
|
@catalog = catalog
|
26
26
|
@module_ref = module_ref
|
27
27
|
@directory_path = directory_path
|
@@ -29,7 +29,7 @@ module DTK::Client
|
|
29
29
|
@version = version || module_ref.version || 'master'
|
30
30
|
@base_dsl_file_obj = base_dsl_file_obj
|
31
31
|
@update_lock_file = update_lock_file
|
32
|
-
|
32
|
+
@force = force
|
33
33
|
@module_ref.version ||= @version
|
34
34
|
end
|
35
35
|
private :initialize
|
@@ -41,10 +41,11 @@ module DTK::Client
|
|
41
41
|
directory_path = args[:directory_path]
|
42
42
|
base_dsl_file_obj = args[:base_dsl_file_obj]
|
43
43
|
update_lock_file = args[:update_lock_file]
|
44
|
-
|
44
|
+
force = args[:force]
|
45
|
+
new('dtkn', module_ref, directory_path, version, base_dsl_file_obj, update_lock_file, force).push_dtkn
|
45
46
|
end
|
46
47
|
end
|
47
|
-
|
48
|
+
|
48
49
|
def push_dtkn
|
49
50
|
# TODO: DTK-2765: not sure if we need module to exist on server to do push-dtkn
|
50
51
|
unless module_version_exists?(@module_ref)
|
@@ -57,8 +58,9 @@ module DTK::Client
|
|
57
58
|
|
58
59
|
@file_obj = @base_dsl_file_obj.raise_error_if_no_content
|
59
60
|
parsed_module = @file_obj.parse_content(:common_module_summary)
|
60
|
-
|
61
|
-
|
61
|
+
|
62
|
+
error_msg = "To allow push-dtkn to go through, invoke 'dtk push' to push the changes to server before invoking push-dtkn again"
|
63
|
+
GitRepo.modified_with_diff?(target_repo_dir, { :error_msg => error_msg, :command => 'push-dtkn' })
|
62
64
|
|
63
65
|
module_info = {
|
64
66
|
name: module_ref.module_name,
|
@@ -66,20 +68,55 @@ module DTK::Client
|
|
66
68
|
version: ref_version,
|
67
69
|
repo_dir: target_repo_dir
|
68
70
|
}
|
69
|
-
DtkNetworkClient::Push.run(module_info, parsed_module: parsed_module, update_lock_file: @update_lock_file)
|
70
|
-
|
71
|
-
# query_string_hash = QueryStringHash.new(
|
72
|
-
# :module_name => @module_ref.module_name,
|
73
|
-
# :namespace => @module_ref.namespace,
|
74
|
-
# :rsa_pub_key => SSHUtil.rsa_pub_key_content,
|
75
|
-
# :version => @version
|
76
|
-
# )
|
77
|
-
# remote_module_info = rest_get "#{BaseRoute}/remote_module_info", query_string_hash
|
78
71
|
|
79
|
-
|
72
|
+
diffs = DtkNetworkClient::Push.run(module_info, parsed_module: parsed_module, update_lock_file: @update_lock_file, force: @force)
|
73
|
+
output_diffs diffs
|
80
74
|
nil
|
81
75
|
end
|
82
76
|
|
77
|
+
def output_diffs(diffs)
|
78
|
+
|
79
|
+
file_states = [:added, :deleted, :modified, :renamed, :changed]
|
80
|
+
file_state_arrays = [added = [], deleted = [], modified = [], renamed = [], changed = []]
|
81
|
+
|
82
|
+
diffs.each do |k, val|
|
83
|
+
case val
|
84
|
+
when "A"
|
85
|
+
file_state_arrays[0].push(k)
|
86
|
+
when "D"
|
87
|
+
file_state_arrays[1].push(k)
|
88
|
+
when "M"
|
89
|
+
file_state_arrays[2].push(k)
|
90
|
+
when "R100"
|
91
|
+
file_state_arrays[3].push(k)
|
92
|
+
else
|
93
|
+
file_state_arrays[4].push(k)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
return OsUtil.print_info("No Diffs to be pushed.") if state_arrays_empty?(file_state_arrays)
|
98
|
+
|
99
|
+
OsUtil.print_info("\nDiffs that were pushed:")
|
100
|
+
file_state_arrays.each do | state_array |
|
101
|
+
unless state_array.empty?
|
102
|
+
file_state = file_states[file_state_arrays.index(state_array)].to_s
|
103
|
+
print_diff_array state_array, file_state
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
def state_arrays_empty?(file_state_arrays)
|
110
|
+
file_state_arrays.each do | state_array |
|
111
|
+
return false unless state_array.empty?
|
112
|
+
end
|
113
|
+
return true
|
114
|
+
end
|
115
|
+
|
116
|
+
def print_diff_array(diff_array, file_state)
|
117
|
+
print "files_#{file_state}:\n"
|
118
|
+
diff_array.each { |d| print "- path: #{d}\n" }
|
119
|
+
end
|
83
120
|
end
|
84
121
|
end
|
85
122
|
end
|
@@ -29,7 +29,7 @@ module DTK::Client
|
|
29
29
|
:edit,
|
30
30
|
:eject,
|
31
31
|
:exec,
|
32
|
-
:
|
32
|
+
:add_link,
|
33
33
|
:list,
|
34
34
|
:list_actions,
|
35
35
|
:list_attributes,
|
@@ -48,7 +48,8 @@ module DTK::Client
|
|
48
48
|
:task_status,
|
49
49
|
:uninstall,
|
50
50
|
:describe,
|
51
|
-
:add
|
51
|
+
:add,
|
52
|
+
:add_component
|
52
53
|
]
|
53
54
|
OPERATIONS.each { |operation| require_relative("service/#{operation}") }
|
54
55
|
|
@@ -0,0 +1,59 @@
|
|
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 Operation::Service
|
20
|
+
class AddComponent < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
service_instance = args.required(:service_instance)
|
24
|
+
component_ref = args.required(:component_ref)
|
25
|
+
version = args[:version]
|
26
|
+
namespace = args[:namespace]
|
27
|
+
parent_node = args[:parent_node]
|
28
|
+
service_instance_dir = args[:service_instance_dir]
|
29
|
+
|
30
|
+
query_string_hash = QueryStringHash.new(service_instance: service_instance, component_ref: component_ref, version: version, namespace: namespace, parent_node: parent_node)
|
31
|
+
response = rest_post "#{BaseRoute}/add_component", query_string_hash
|
32
|
+
|
33
|
+
nested_modules = response.required(:nested_modules)
|
34
|
+
if nested_modules && !nested_modules.empty?
|
35
|
+
clone_args = {
|
36
|
+
:base_module => response.required(:base_module),
|
37
|
+
:nested_modules => nested_modules,
|
38
|
+
:service_instance => service_instance,
|
39
|
+
:remove_existing => true,
|
40
|
+
:repo_dir => service_instance_dir
|
41
|
+
}
|
42
|
+
ClientModuleDir::ServiceInstance.clone_nested_modules(clone_args)
|
43
|
+
end
|
44
|
+
|
45
|
+
repo_info_args = Args.new(
|
46
|
+
:service_instance => service_instance,
|
47
|
+
:commit_message => "Updating changes to service instance '#{service_instance}'",
|
48
|
+
:branch => response.required(:base_module, :branch, :name),
|
49
|
+
:repo_url => response.required(:base_module, :repo, :url),
|
50
|
+
:service_instance_dir => service_instance_dir
|
51
|
+
)
|
52
|
+
ClientModuleDir::GitRepo.pull_from_service_repo(repo_info_args)
|
53
|
+
|
54
|
+
OsUtil.print_info("Component '#{component_ref}' has been successfully added to service instance '#{service_instance}'")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
File without changes
|
@@ -63,6 +63,9 @@ module DTK::Client
|
|
63
63
|
print_msgs_of_type(:info_msgs, response)
|
64
64
|
|
65
65
|
ClientModuleDir::GitRepo.pull_from_service_repo(repo_info_args) if response.data(:repo_updated)
|
66
|
+
if nested_module_args[:nested_modules_to_delete] = response.data['module_refs_to_delete']
|
67
|
+
ClientModuleDir::ServiceInstance.remove_nested_module_dirs(nested_module_args)
|
68
|
+
end
|
66
69
|
process_backup_files(repo_info_args, response.data(:backup_files))
|
67
70
|
process_semantic_diffs(response.data(:semantic_diffs))
|
68
71
|
nil
|
@@ -28,8 +28,14 @@ module DTK::Client
|
|
28
28
|
:service_instance => service_instance
|
29
29
|
)
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
unless force
|
32
|
+
modified_args = Args.new(
|
33
|
+
:dir => module_dir,
|
34
|
+
:error_msg => "To allow converge to go through, invoke 'dtk push' to push the changes to server before invoking converge again",
|
35
|
+
:command => 'converge'
|
36
|
+
)
|
37
|
+
ClientModuleDir::ServiceInstance.modified_service_instance_or_nested_modules?(modified_args)
|
38
|
+
end
|
33
39
|
|
34
40
|
rest_post("#{BaseRoute}/#{service_instance}/converge", post_body)
|
35
41
|
end
|
@@ -32,8 +32,15 @@ module DTK::Client
|
|
32
32
|
return false unless Console.prompt_yes_no("Are you sure you want to delete the content of service instance '#{@service_instance}' ?", :add_options => true)
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
if !force && directory_path
|
36
|
+
modified_args = Args.new(
|
37
|
+
:dir => directory_path,
|
38
|
+
:error_msg => "To allow delete to go through, invoke 'dtk push' to push the changes to server before invoking delete again",
|
39
|
+
:command => 'delete'
|
40
|
+
)
|
41
|
+
ClientModuleDir::ServiceInstance.modified_service_instance_or_nested_modules?(modified_args)
|
42
|
+
end
|
43
|
+
|
37
44
|
post_body = PostBody.new(
|
38
45
|
:service_instance => @service_instance,
|
39
46
|
:recursive? => recursive
|
@@ -22,12 +22,25 @@ module DTK::Client
|
|
22
22
|
wrap_operation(args) do |args|
|
23
23
|
service_instance = args.required(:service_instance)
|
24
24
|
path = args[:path]
|
25
|
+
show_steps = args[:show_steps]
|
25
26
|
query_string_hash = QueryStringHash.new
|
26
27
|
|
28
|
+
raise Error, 'Option --show-steps can only be used with actions path' if show_steps && !actions_path_valid?(path)
|
29
|
+
|
27
30
|
query_string_hash.merge!(path: path) if path
|
28
|
-
|
31
|
+
query_string_hash.merge!(show_steps: show_steps) if show_steps
|
32
|
+
response = rest_get "#{BaseRoute}/#{service_instance}/describe", query_string_hash
|
33
|
+
|
34
|
+
response.set_render_as_table! if show_steps
|
35
|
+
response
|
29
36
|
end
|
30
37
|
end
|
38
|
+
|
39
|
+
def self.actions_path_valid?(path)
|
40
|
+
prefix, suffix = (path||'').split('/')
|
41
|
+
prefix.eql? 'actions'
|
42
|
+
end
|
43
|
+
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -45,9 +45,13 @@ module DTK::Client
|
|
45
45
|
node, action = $1, $2
|
46
46
|
task_params.merge!("node" => node)
|
47
47
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
|
49
|
+
modified_args = Args.new(
|
50
|
+
:dir => directory_path,
|
51
|
+
:error_msg => "To allow #{args[:command]} to go through, invoke 'dtk push' to push the changes to server before invoking #{args[:command]} again",
|
52
|
+
:command => 'exec'
|
53
|
+
)
|
54
|
+
ClientModuleDir::ServiceInstance.modified_service_instance_or_nested_modules?(modified_args)
|
51
55
|
|
52
56
|
post_body = PostBody.new(
|
53
57
|
:task_params? => task_params
|
@@ -56,8 +56,22 @@ module DTK::Client
|
|
56
56
|
info_hash = {}
|
57
57
|
|
58
58
|
response = rest_get("#{BaseRoute}/#{service_instance}/nodes")
|
59
|
-
|
60
|
-
|
59
|
+
|
60
|
+
if node_name.nil?
|
61
|
+
if response.data.nil?
|
62
|
+
raise Error::Usage, "Service instance does not contain any nodes"
|
63
|
+
end
|
64
|
+
|
65
|
+
if response.data.size == 1
|
66
|
+
node_info = response.data.first
|
67
|
+
else
|
68
|
+
node_names = response.data.map { |node| node['display_name'] }
|
69
|
+
raise Error::Usage, "The service instance '#{service_instance}' has more than one node. Please use 'dtk service ssh' command with a node name. Legal names are: #{node_names.join(', ')}"
|
70
|
+
end
|
71
|
+
else
|
72
|
+
unless node_info = response.data.find{ |node| node_name == node['display_name'] }
|
73
|
+
raise Error::Usage, "The node '#{node_name}' does not exist"
|
74
|
+
end
|
61
75
|
end
|
62
76
|
|
63
77
|
if dns_address = node_info['dns_address']
|
@@ -47,6 +47,12 @@ module DTK::Client
|
|
47
47
|
DEFAULT_MODE = :snapshot
|
48
48
|
LEGAL_MODES = [:refresh, :snapshot, :stream]
|
49
49
|
def self.task_status_with_mode(mode, service_instance, opts = {})
|
50
|
+
Dir.glob("*", File::FNM_DOTMATCH).each do |f|
|
51
|
+
if match = /^(.task_id_)(\d*)/.match(f)
|
52
|
+
opts[:task_id] = match[2] if match[2]
|
53
|
+
break
|
54
|
+
end
|
55
|
+
end
|
50
56
|
case mode
|
51
57
|
when :refresh
|
52
58
|
RefreshMode.new(mode, service_instance).task_status(opts)
|
@@ -67,7 +73,8 @@ module DTK::Client
|
|
67
73
|
QueryStringHash.new(
|
68
74
|
:form? => opts[:form],
|
69
75
|
:wait_for? => opts[:wait_for],
|
70
|
-
:summarize_node_groups? => opts[:summarize]
|
76
|
+
:summarize_node_groups? => opts[:summarize],
|
77
|
+
:task_id? => opts[:task_id]
|
71
78
|
)
|
72
79
|
end
|
73
80
|
|
@@ -27,6 +27,15 @@ module DTK::Client
|
|
27
27
|
node = []
|
28
28
|
msg = "Are you sure you want to uninstall the infrastructure associated with '#{service_instance}' and delete this service instance from the server?"
|
29
29
|
|
30
|
+
if !force && path
|
31
|
+
modified_args = Args.new(
|
32
|
+
:dir => path || @module_ref.client_dir_path,
|
33
|
+
:error_msg => "To allow uninstall to go through, invoke 'dtk push' to push the changes to server before invoking uninstall again",
|
34
|
+
:command => 'uninstall'
|
35
|
+
)
|
36
|
+
ClientModuleDir::ServiceInstance.modified_service_instance_or_nested_modules?(modified_args)
|
37
|
+
end
|
38
|
+
|
30
39
|
if force
|
31
40
|
msg.prepend("Note: this will not terminate aws instances, you will have to do that manually!\n")
|
32
41
|
end
|
@@ -46,6 +55,10 @@ module DTK::Client
|
|
46
55
|
ClientModuleDir.rm_f(path) if args[:purge]
|
47
56
|
|
48
57
|
if message = response.data(:message) || "DTK service '#{service_instance}' has been uninstalled successfully."
|
58
|
+
Dir.glob("*", File::FNM_DOTMATCH).each do |f|
|
59
|
+
ClientModuleDir.rm_f(f) if f.include? '.task_id_'
|
60
|
+
end
|
61
|
+
ClientModuleDir.create_file_with_content(".task_id_#{response.data(:task_id)}", '') if response.data(:task_id)
|
49
62
|
OsUtil.print_info(message)
|
50
63
|
end
|
51
64
|
end
|
@@ -35,10 +35,10 @@ module DTK::Client
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def self.valid_name?(name)
|
38
|
-
name.to_s.match(/\A[\
|
38
|
+
name.to_s.match(/\A[[a-z]\-\.\_\d]+\z/)
|
39
39
|
end
|
40
40
|
|
41
|
-
VALID_NAME_CHARACTERS = ['letters', 'numbers', '-', '_', '.']
|
41
|
+
VALID_NAME_CHARACTERS = ['lowercase letters', 'numbers', '-', '_', '.']
|
42
42
|
def self.valid_characters
|
43
43
|
VALID_NAME_CHARACTERS.join("', '")
|
44
44
|
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.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dtk-common-core
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: git
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.4.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: hirb
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
name: dtk-dsl
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.1.4
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.1.4
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.0.
|
131
|
+
version: 1.0.3
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.0.
|
138
|
+
version: 1.0.3
|
139
139
|
description: Command line tool to interact with a DTK Server and DTK Service Catalog.
|
140
140
|
email: support@reactor8.com
|
141
141
|
executables:
|
@@ -195,6 +195,8 @@ files:
|
|
195
195
|
- lib/cli/command/options.rb
|
196
196
|
- lib/cli/command/service.rb
|
197
197
|
- lib/cli/command/service/add.rb
|
198
|
+
- lib/cli/command/service/add_component.rb
|
199
|
+
- lib/cli/command/service/add_link.rb
|
198
200
|
- lib/cli/command/service/cancel_task.rb
|
199
201
|
- lib/cli/command/service/clone.rb
|
200
202
|
- lib/cli/command/service/converge.rb
|
@@ -206,7 +208,6 @@ files:
|
|
206
208
|
- lib/cli/command/service/eject.rb
|
207
209
|
- lib/cli/command/service/exec.rb
|
208
210
|
- lib/cli/command/service/exec_sync.rb
|
209
|
-
- lib/cli/command/service/link.rb
|
210
211
|
- lib/cli/command/service/list.rb
|
211
212
|
- lib/cli/command/service/list_actions.rb
|
212
213
|
- lib/cli/command/service/list_attributes.rb
|
@@ -318,6 +319,8 @@ files:
|
|
318
319
|
- lib/client/operation/module_service_common.rb
|
319
320
|
- lib/client/operation/service.rb
|
320
321
|
- lib/client/operation/service/add.rb
|
322
|
+
- lib/client/operation/service/add_component.rb
|
323
|
+
- lib/client/operation/service/add_link.rb
|
321
324
|
- lib/client/operation/service/cancel_task.rb
|
322
325
|
- lib/client/operation/service/clone_service.rb
|
323
326
|
- lib/client/operation/service/commit_and_push.rb
|
@@ -329,7 +332,6 @@ files:
|
|
329
332
|
- lib/client/operation/service/edit.rb
|
330
333
|
- lib/client/operation/service/eject.rb
|
331
334
|
- lib/client/operation/service/exec.rb
|
332
|
-
- lib/client/operation/service/link.rb
|
333
335
|
- lib/client/operation/service/list.rb
|
334
336
|
- lib/client/operation/service/list_actions.rb
|
335
337
|
- lib/client/operation/service/list_attributes.rb
|
@@ -428,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
428
430
|
version: '0'
|
429
431
|
requirements: []
|
430
432
|
rubyforge_project:
|
431
|
-
rubygems_version: 2.
|
433
|
+
rubygems_version: 2.7.8
|
432
434
|
signing_key:
|
433
435
|
specification_version: 4
|
434
436
|
summary: DTK CLI client for DTK server interaction.
|