dtk-client 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dtk-client.gemspec +1 -1
- data/lib/cli/command/module/stage.rb +59 -0
- data/lib/cli/command/module.rb +1 -1
- data/lib/cli/command/service/converge.rb +5 -3
- data/lib/cli/command/service/delete.rb +8 -8
- data/lib/cli/command/service/stage.rb +10 -6
- data/lib/cli/command/service/uninstall.rb +2 -2
- data/lib/cli/command/service.rb +0 -1
- data/lib/cli/context/type/module.rb +11 -3
- data/lib/cli/context/type/service.rb +12 -1
- data/lib/cli/context/type/top.rb +4 -1
- data/lib/cli/runner.rb +11 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/git_repo/adapter/git_gem.rb +1 -1
- data/lib/client/git_repo.rb +11 -1
- data/lib/client/operation/client_module_dir/git_repo.rb +16 -0
- data/lib/client/operation/module/clone_module.rb +8 -2
- data/lib/client/operation/module/install/external_module.rb +17 -8
- data/lib/client/operation/module/install.rb +5 -1
- data/lib/client/operation/module/install_from_catalog.rb +1 -1
- data/lib/client/operation/module/stage.rb +64 -0
- data/lib/client/operation/module/uninstall.rb +7 -2
- data/lib/client/operation/module.rb +1 -1
- data/lib/client/operation/service/converge.rb +3 -0
- data/lib/client/operation/service/delete.rb +4 -1
- data/lib/client/operation/service/pull.rb +1 -1
- data/lib/client/operation/service/stage.rb +6 -3
- data/lib/client/operation/service/uninstall.rb +3 -1
- data/lib/client/operation/service.rb +0 -1
- metadata +14 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d12c019fd00d94a4be0b393fc9ee0f9f3355095
|
4
|
+
data.tar.gz: ab0b919677570741e387a4ed4ca0e01479c2607d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08c9897c885fc0af755288124c43746e0edaa6477856ae649c7b576faf282772d2a04231327d96190ca479885447c1df96dbeb6da6a8709dbe6e69c23cacd708
|
7
|
+
data.tar.gz: e9c8de28290402661d9db61cbbef3574abeb02f32f5a64a6b50a2e1cdd4453ff1ac1dc80e313ee730851867803ee6c9bf5198ff47828547a5c70986e356dc188
|
data/dtk-client.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
|
20
|
-
spec.add_dependency 'dtk-common-core','0.10.
|
20
|
+
spec.add_dependency 'dtk-common-core','0.10.1'
|
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'
|
@@ -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
|
+
module CLI::Command
|
20
|
+
module Module
|
21
|
+
subcommand_def 'stage' do |c|
|
22
|
+
c.arg Token::Arg.assembly_name, :optional => true
|
23
|
+
command_body c, :stage, 'Create a new service instance to refer to staged infrastructure that then can be deployed' do |sc|
|
24
|
+
sc.flag Token.directory_path, :desc => 'Path to module directory where assembly is being staged from; not needed if in the module directory'
|
25
|
+
sc.flag Token.service_name, :desc => 'If specified, name to use for new service instance; otherwise service instance name is auto-generated'
|
26
|
+
sc.flag Token.parent_service_instance
|
27
|
+
sc.switch Token.force
|
28
|
+
sc.switch Token.target
|
29
|
+
# on useful for testing in dev mode
|
30
|
+
# sc.switch Token.purge, :desc => 'Overwrite any content that presently exists in the service instance directory to be created'
|
31
|
+
# sc.flag Token.version
|
32
|
+
sc.action do |_global_options, options, args|
|
33
|
+
module_ref = module_ref_in_options_or_context(options)
|
34
|
+
assembly_name = args[0]
|
35
|
+
version = options[:version] || module_ref.version
|
36
|
+
service_name = options[:service_name]
|
37
|
+
force = options[:f]
|
38
|
+
directory_path = options[:directory_path]
|
39
|
+
|
40
|
+
Validation.validate_name(service_name) if service_name
|
41
|
+
|
42
|
+
args = {
|
43
|
+
:module_ref => module_ref,
|
44
|
+
:assembly_name => assembly_name,
|
45
|
+
:service_name => service_name,
|
46
|
+
:version => version,
|
47
|
+
:target_service => options[:parent_service_instance],
|
48
|
+
:remove_existing => options[:purge],
|
49
|
+
:is_target => options[:target],
|
50
|
+
:force => force,
|
51
|
+
:directory_path => directory_path
|
52
|
+
}
|
53
|
+
Operation::Module.stage(args)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/cli/command/module.rb
CHANGED
@@ -21,7 +21,7 @@ module DTK::Client
|
|
21
21
|
module Module
|
22
22
|
include Command::Mixin
|
23
23
|
|
24
|
-
ALL_SUBCOMMANDS = ['install', 'list', 'list-assemblies', 'push', 'uninstall', 'clone', 'list-remotes']
|
24
|
+
ALL_SUBCOMMANDS = ['install', 'list', 'list-assemblies', 'push', 'uninstall', 'clone', 'list-remotes', 'stage']
|
25
25
|
command_def :desc => 'Subcommands for interacting with DTK modules'
|
26
26
|
ALL_SUBCOMMANDS.each { |subcommand| require_relative("module/#{subcommand.gsub(/-/,'_')}") }
|
27
27
|
end
|
@@ -21,12 +21,14 @@ module DTK::Client; module CLI
|
|
21
21
|
subcommand_def 'converge' do |c|
|
22
22
|
command_body c, :converge, "Converge service instance" do |sc|
|
23
23
|
sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory; not needed if executed in the service instance directory'
|
24
|
-
|
24
|
+
sc.switch Token.force
|
25
25
|
sc.action do |_global_options, options, _args|
|
26
26
|
service_instance = service_instance_in_options_or_context(options)
|
27
|
-
|
27
|
+
force = options[:f]
|
28
28
|
args = {
|
29
|
-
:service_instance => service_instance
|
29
|
+
:service_instance => service_instance,
|
30
|
+
:force => force,
|
31
|
+
:directory_path => options[:directory_path]
|
30
32
|
}
|
31
33
|
Operation::Service.converge(args)
|
32
34
|
end
|
@@ -22,22 +22,22 @@ module DTK::Client; module CLI
|
|
22
22
|
command_body c, :delete, 'Destroys the running infrastructure associated with the service instance' 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
24
|
sc.switch Token.skip_prompt, :desc => 'Skip prompt that checks if user wants to delete the service instance'
|
25
|
-
sc.switch Token.recursive
|
25
|
+
sc.switch Token.recursive, :desc => 'Delete all service instances staged into specified target'
|
26
|
+
sc.switch Token.force, :desc => 'Ignore changes and destroy the running service instance'
|
26
27
|
# sc.switch Token.purge, :desc => 'Delete the service instance directory on the client'
|
27
28
|
sc.action do |_global_options, options, args|
|
28
|
-
directory_path
|
29
|
-
purge
|
30
|
-
recursive
|
31
|
-
|
32
|
-
# raise Error::Usage, "If use option '#{option_ref(:purge)}' then need to call from outside directory and use option '#{option_ref(:directory_path)}'"
|
33
|
-
# end
|
29
|
+
directory_path = options[:directory_path]
|
30
|
+
purge = options[:purge]
|
31
|
+
recursive = options[:recursive]
|
32
|
+
force = options[:force]
|
34
33
|
service_instance = service_instance_in_options_or_context(options)
|
35
34
|
|
36
35
|
args = {
|
37
36
|
:service_instance => service_instance,
|
38
37
|
:skip_prompt => options[:skip_prompt],
|
39
38
|
:directory_path => directory_path,
|
40
|
-
:recursive => recursive
|
39
|
+
:recursive => recursive,
|
40
|
+
:force => force
|
41
41
|
}
|
42
42
|
Operation::Service.delete(args)
|
43
43
|
end
|
@@ -24,16 +24,18 @@ module DTK::Client
|
|
24
24
|
sc.flag Token.directory_path, :desc => 'Path to module directory where assembly is being staged from; not needed if in the module directory'
|
25
25
|
sc.flag Token.service_name, :desc => 'If specified, name to use for new service instance; otherwise service instance name is auto-generated'
|
26
26
|
sc.flag Token.parent_service_instance
|
27
|
-
|
27
|
+
sc.switch Token.force
|
28
28
|
sc.switch Token.target
|
29
29
|
# on useful for testing in dev mode
|
30
30
|
# sc.switch Token.purge, :desc => 'Overwrite any content that presently exists in the service instance directory to be created'
|
31
31
|
# sc.flag Token.version
|
32
32
|
sc.action do |_global_options, options, args|
|
33
|
-
module_ref
|
34
|
-
assembly_name
|
35
|
-
version
|
36
|
-
service_name
|
33
|
+
module_ref = module_ref_in_options_or_context(options)
|
34
|
+
assembly_name = args[0]
|
35
|
+
version = options[:version] || module_ref.version
|
36
|
+
service_name = options[:service_name]
|
37
|
+
force = options[:f]
|
38
|
+
directory_path = options[:directory_path]
|
37
39
|
|
38
40
|
Validation.validate_name(service_name) if service_name
|
39
41
|
|
@@ -44,7 +46,9 @@ module DTK::Client
|
|
44
46
|
:version => version,
|
45
47
|
:target_service => options[:parent_service_instance],
|
46
48
|
:remove_existing => options[:purge],
|
47
|
-
:is_target => options[:target]
|
49
|
+
:is_target => options[:target],
|
50
|
+
:force => force,
|
51
|
+
:directory_path => directory_path
|
48
52
|
}
|
49
53
|
Operation::Service.stage(args)
|
50
54
|
end
|
@@ -23,8 +23,8 @@ module DTK::Client; module CLI
|
|
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
24
|
sc.switch Token.skip_prompt, :desc => 'Skip prompt that checks if user wants to delete the service instance'
|
25
25
|
sc.switch Token.purge, :desc => 'Delete the service instance directory on the client'
|
26
|
-
sc.switch Token.force
|
27
|
-
sc.switch Token.recursive
|
26
|
+
sc.switch Token.force, :desc => 'Removes service instance with all nodes and modules'
|
27
|
+
sc.switch Token.recursive, :desc => 'Delete dependent service instances'
|
28
28
|
sc.action do |_global_options, options, args|
|
29
29
|
directory_path = options[:directory_path]
|
30
30
|
purge = options[:purge]
|
data/lib/cli/command/service.rb
CHANGED
@@ -22,10 +22,18 @@ module DTK::Client; module CLI
|
|
22
22
|
include Command::Module
|
23
23
|
include Command::Service
|
24
24
|
|
25
|
+
COMMAND_DEFS = [:service, :module]
|
26
|
+
|
25
27
|
def add_command_defs!
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
COMMAND_DEFS.each {|cmd| add_command(cmd)}
|
29
|
+
end
|
30
|
+
|
31
|
+
def context_type
|
32
|
+
'module'
|
33
|
+
end
|
34
|
+
|
35
|
+
def allowed_commands_defs
|
36
|
+
COMMAND_DEFS.map { |cmd| cmd.to_s }
|
29
37
|
end
|
30
38
|
|
31
39
|
end
|
@@ -20,9 +20,20 @@ module DTK::Client::CLI
|
|
20
20
|
module Type
|
21
21
|
class Service < Context
|
22
22
|
include Command::Service
|
23
|
+
include Command::Module
|
24
|
+
|
25
|
+
COMMAND_DEFS = [:service, :module]
|
23
26
|
|
24
27
|
def add_command_defs!
|
25
|
-
|
28
|
+
COMMAND_DEFS.each {|cmd| add_command(cmd)}
|
29
|
+
end
|
30
|
+
|
31
|
+
def context_type
|
32
|
+
'service'
|
33
|
+
end
|
34
|
+
|
35
|
+
def allowed_commands_defs
|
36
|
+
COMMAND_DEFS.map { |cmd| cmd.to_s }
|
26
37
|
end
|
27
38
|
end
|
28
39
|
end
|
data/lib/cli/context/type/top.rb
CHANGED
data/lib/cli/runner.rb
CHANGED
@@ -35,6 +35,7 @@ module DTK::Client
|
|
35
35
|
DTKNAccess.resolve_direct_access(config_existed)
|
36
36
|
|
37
37
|
context = Context.determine_context
|
38
|
+
add_missing_context(argv, context)
|
38
39
|
if response_obj = context.run_and_return_response_object(argv)
|
39
40
|
# render_response will raise Error in case of error response
|
40
41
|
render_response(response_obj)
|
@@ -53,6 +54,16 @@ module DTK::Client
|
|
53
54
|
Response::ErrorHandler.raise_if_error(response_obj)
|
54
55
|
response_obj.render_data
|
55
56
|
end
|
57
|
+
|
58
|
+
def self.add_missing_context(argv, context)
|
59
|
+
add_context = true
|
60
|
+
|
61
|
+
if context_type = context.context_type
|
62
|
+
allowed_commands = context.allowed_commands_defs
|
63
|
+
allowed_commands.each {|cmd| add_context = false if argv.include?(cmd)}
|
64
|
+
argv.unshift(context_type) if add_context
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
data/lib/cli/version.rb
CHANGED
data/lib/client/git_repo.rb
CHANGED
@@ -46,7 +46,17 @@ module DTK::Client
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
def self.modified?(dir)
|
50
|
+
repo_dir = {
|
51
|
+
:path => dir,
|
52
|
+
:branch => Git.open(dir).branches.local
|
53
|
+
}
|
54
|
+
message = DTK::Client::Operation::ClientModuleDir::GitRepo.modified(repo_dir)
|
55
|
+
if message.data(:modified)
|
56
|
+
raise Error::Usage, "Please push or revert changes."
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
50
60
|
def add_remote(name, url)
|
51
61
|
@git_adapter.add_remote(name, url)
|
52
62
|
end
|
@@ -68,6 +68,12 @@ module DTK::Client
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
def self.modified(args)
|
72
|
+
wrap_operation(args) do |args|
|
73
|
+
response_data_hash(:modified => Internal.modified(args))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
71
77
|
def self.init_and_push_from_existing_repo(args)
|
72
78
|
wrap_operation(args) do |args|
|
73
79
|
repo_dir = args.required(:repo_dir)
|
@@ -194,6 +200,16 @@ module DTK::Client
|
|
194
200
|
head_sha
|
195
201
|
end
|
196
202
|
|
203
|
+
def self.modified(args)
|
204
|
+
repo_url = args.required(:path)
|
205
|
+
branch = args.required(:branch)
|
206
|
+
repo = git_repo.new(repo_url, :branch => branch)
|
207
|
+
|
208
|
+
changed = repo.changed?
|
209
|
+
repo.print_status if changed
|
210
|
+
changed
|
211
|
+
end
|
212
|
+
|
197
213
|
def self.create_add_remote_and_push(repo_dir, repo_url, remote_branch)
|
198
214
|
repo = git_repo.new(repo_dir)
|
199
215
|
add_remote_and_push(repo, repo_url, remote_branch)
|
@@ -23,8 +23,14 @@ module DTK::Client
|
|
23
23
|
module_ref = args.required(:module_ref)
|
24
24
|
module_name = args.required(:module_name)
|
25
25
|
target_directory = args[:target_directory]
|
26
|
+
|
27
|
+
opts = {
|
28
|
+
:namespace => module_ref.namespace,
|
29
|
+
:version => module_ref.version
|
30
|
+
}
|
31
|
+
|
26
32
|
unless module_info = module_exists?(module_ref, :type => :common_module)
|
27
|
-
raise Error::Usage, "DTK module '#{module_ref.
|
33
|
+
raise Error::Usage, "DTK module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, opts)}' does not exist on server."
|
28
34
|
end
|
29
35
|
|
30
36
|
branch = module_info.required(:branch, :name)
|
@@ -41,7 +47,7 @@ module DTK::Client
|
|
41
47
|
}
|
42
48
|
|
43
49
|
ret = ClientModuleDir::GitRepo.clone_module_repo(clone_args)
|
44
|
-
OsUtil.print_info("DTK module '#{module_ref.
|
50
|
+
OsUtil.print_info("DTK module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, opts)}' has been successfully cloned into '#{ret.required(:target_repo_dir)}'")
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
@@ -18,12 +18,12 @@
|
|
18
18
|
module DTK::Client
|
19
19
|
class Operation::Module::Install
|
20
20
|
class ExternalModule < self
|
21
|
-
BaseRoute
|
21
|
+
BaseRoute = "modules"
|
22
|
+
@update_all = false
|
23
|
+
@update_none = false
|
22
24
|
|
23
25
|
def self.install_dependent_modules(module_refs, opts = {})
|
24
|
-
|
25
|
-
@update_all = opts[:skip_prompt]
|
26
|
-
@update_none = false
|
26
|
+
@update_all = opts[:skip_prompt] if opts[:skip_prompt]
|
27
27
|
@print_dependency_newline = false
|
28
28
|
|
29
29
|
module_refs.each do |module_ref|
|
@@ -93,9 +93,13 @@ module DTK::Client
|
|
93
93
|
module_name = component_module.module_name
|
94
94
|
version = component_module.version
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
print_opts = {
|
97
|
+
:module_name => module_name,
|
98
|
+
:namespace => namespace,
|
99
|
+
:version => version
|
100
|
+
}
|
101
|
+
|
102
|
+
import_msg = "#{opts[:indent]}Importing module '#{DTK::Common::PrettyPrintForm.module_ref(module_name, print_opts)}' ..."
|
99
103
|
|
100
104
|
# Using print to avoid adding cr at the end.
|
101
105
|
print "\n" if opts[:add_newline]
|
@@ -186,7 +190,12 @@ module DTK::Client
|
|
186
190
|
print "\n"
|
187
191
|
@print_dependency_newline = false
|
188
192
|
end
|
189
|
-
|
193
|
+
|
194
|
+
opts = {
|
195
|
+
:namespace => module_ref.namespace,
|
196
|
+
:version => module_ref.version
|
197
|
+
}
|
198
|
+
OsUtil.print("#{opts[:indent]}Using module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, opts)}'")
|
190
199
|
end
|
191
200
|
|
192
201
|
end
|
@@ -45,10 +45,14 @@ module DTK::Client
|
|
45
45
|
unless dependent_modules.empty?
|
46
46
|
OsUtil.print_info('Auto-importing dependencies')
|
47
47
|
ExternalModule.install_dependent_modules(dependent_modules, opts)
|
48
|
-
OsUtil.print_info("Successfully imported '#{@base_module_ref.namespace}:#{@base_module_ref.module_name}' version #{@base_module_ref.version}")
|
49
48
|
end
|
50
49
|
|
50
|
+
opts = {
|
51
|
+
:namespace => @base_module_ref.namespace,
|
52
|
+
:version => @base_module_ref.version
|
53
|
+
}
|
51
54
|
CommonModule.install(@base_module_ref, @file_obj)
|
55
|
+
OsUtil.print_info("Successfully imported '#{DTK::Common::PrettyPrintForm.module_ref(@base_module_ref.module_name, opts)}'")
|
52
56
|
nil
|
53
57
|
end
|
54
58
|
|
@@ -24,7 +24,7 @@ module DTK::Client
|
|
24
24
|
version = args[:version]
|
25
25
|
directory_path = args[:directory_path]
|
26
26
|
|
27
|
-
# will create different classes for different catalog
|
27
|
+
# will create different classes for different catalog types when we add support for them
|
28
28
|
new('dtkn', module_ref, directory_path, version).install
|
29
29
|
end
|
30
30
|
end
|
@@ -0,0 +1,64 @@
|
|
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::Module
|
20
|
+
class Stage < self
|
21
|
+
def self.execute(args = Args.new)
|
22
|
+
wrap_operation(args) do |args|
|
23
|
+
module_ref = args.required(:module_ref)
|
24
|
+
remove_existing = args[:remove_existing]
|
25
|
+
service_name = args[:service_name]
|
26
|
+
force = args[:force]
|
27
|
+
directory_path = args[:directory_path]
|
28
|
+
|
29
|
+
post_body = PostBody.new(
|
30
|
+
:namespace => module_ref.namespace,
|
31
|
+
:module_name => module_ref.module_name,
|
32
|
+
:assembly_name? => args.required(:assembly_name),
|
33
|
+
:version? => args[:version],
|
34
|
+
:target_service? => args[:target_service],
|
35
|
+
:is_target? => args[:is_target]
|
36
|
+
)
|
37
|
+
|
38
|
+
DTK::Client::GitRepo.modified?(directory_path || OsUtil.current_dir) unless force
|
39
|
+
service_name ||= rest_post("#{BaseRoute}/generate_service_name", post_body).data
|
40
|
+
base_path = ClientModuleDir.ret_base_path(:service, service_name)
|
41
|
+
|
42
|
+
raise Error::Usage, "Directory '#{base_path}' is not empty; it must be deleted or removed before retrying the command" if ClientModuleDir.local_dir_exists?(:service, service_name)
|
43
|
+
|
44
|
+
post_body.merge!(:service_name => service_name)
|
45
|
+
response = rest_post("#{BaseRoute}/stage", post_body)
|
46
|
+
|
47
|
+
service_instance = response.required(:service, :name)
|
48
|
+
|
49
|
+
clone_args = {
|
50
|
+
:module_ref => module_ref,
|
51
|
+
:repo_url => response.required(:repo, :url),
|
52
|
+
:branch => response.required(:branch, :name),
|
53
|
+
:service_instance => service_instance,
|
54
|
+
:remove_existing => remove_existing
|
55
|
+
}
|
56
|
+
message = ClientModuleDir::GitRepo.clone_service_repo(clone_args)
|
57
|
+
target_dir = message.data(:target_repo_dir)
|
58
|
+
|
59
|
+
OsUtil.print_info("Service instance '#{service_instance}' has been created. In order to work with service instance, please navigate to: #{target_dir}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -21,9 +21,14 @@ module DTK::Client
|
|
21
21
|
def self.execute(args = Args.new)
|
22
22
|
wrap_operation(args) do |args|
|
23
23
|
module_ref = args.required(:module_ref)
|
24
|
+
|
25
|
+
opts = {
|
26
|
+
:namespace => module_ref.namespace,
|
27
|
+
:version => module_ref.version
|
28
|
+
}
|
24
29
|
|
25
30
|
unless args[:skip_prompt]
|
26
|
-
return false unless Console.prompt_yes_no("Are you sure you want to uninstall module '#{module_ref.
|
31
|
+
return false unless Console.prompt_yes_no("Are you sure you want to uninstall module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, opts)}' from the server?", :add_options => true)
|
27
32
|
end
|
28
33
|
|
29
34
|
post_body = PostBody.new(
|
@@ -32,7 +37,7 @@ module DTK::Client
|
|
32
37
|
:version? => module_ref.version
|
33
38
|
)
|
34
39
|
rest_post("#{BaseRoute}/delete", post_body)
|
35
|
-
OsUtil.print_info("DTK module '#{module_ref.
|
40
|
+
OsUtil.print_info("DTK module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, opts)}' has been deleted successfully.")
|
36
41
|
nil
|
37
42
|
end
|
38
43
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
module DTK::Client
|
19
19
|
class Operation
|
20
20
|
class Module < self
|
21
|
-
OPERATIONS = [:install, :list, :list_assemblies, :list_remotes, :push, :uninstall, :clone_module, :install_from_catalog]
|
21
|
+
OPERATIONS = [:install, :list, :list_assemblies, :list_remotes, :push, :uninstall, :clone_module, :install_from_catalog, :stage]
|
22
22
|
OPERATIONS.each { |operation| require_relative("module/#{operation}") }
|
23
23
|
|
24
24
|
BaseRoute = 'modules'
|
@@ -21,11 +21,14 @@ module DTK::Client
|
|
21
21
|
def self.execute(args = Args.new)
|
22
22
|
wrap_operation(args) do |args|
|
23
23
|
service_instance = args.required(:service_instance)
|
24
|
+
force = args[:force]
|
25
|
+
directory_path = args[:directory_path]
|
24
26
|
|
25
27
|
post_body = PostBody.new(
|
26
28
|
:service_instance => service_instance
|
27
29
|
)
|
28
30
|
|
31
|
+
DTK::Client::GitRepo.modified?(directory_path || OsUtil.current_dir) unless force
|
29
32
|
violations = find_violations(service_instance)
|
30
33
|
return violations if violations
|
31
34
|
|
@@ -22,18 +22,21 @@ module DTK::Client
|
|
22
22
|
wrap_operation(args) do |args|
|
23
23
|
service_instance = args.required(:service_instance)
|
24
24
|
recursive = args.required(:recursive)
|
25
|
+
force = args[:force]
|
26
|
+
directory_path = args[:directory_path]
|
25
27
|
|
26
28
|
unless args[:skip_prompt]
|
27
29
|
return false unless Console.prompt_yes_no("Are you sure you want to delete the content of service instance '#{service_instance}' ?", :add_options => true)
|
28
30
|
end
|
29
31
|
|
32
|
+
DTK::Client::GitRepo.modified?(directory_path || OsUtil.current_dir) unless force
|
30
33
|
post_body = PostBody.new(
|
31
34
|
:service_instance => service_instance,
|
32
35
|
:recursive? => recursive
|
33
36
|
)
|
34
37
|
rest_post("#{BaseRoute}/delete", post_body)
|
35
38
|
|
36
|
-
OsUtil.print_info("
|
39
|
+
OsUtil.print_info("Delete procedure started. For more information use 'dtk task-status'.")
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
@@ -23,6 +23,8 @@ module DTK::Client
|
|
23
23
|
module_ref = args.required(:module_ref)
|
24
24
|
remove_existing = args[:remove_existing]
|
25
25
|
service_name = args[:service_name]
|
26
|
+
force = args[:force]
|
27
|
+
directory_path = args[:directory_path]
|
26
28
|
|
27
29
|
post_body = PostBody.new(
|
28
30
|
:namespace => module_ref.namespace,
|
@@ -33,11 +35,12 @@ module DTK::Client
|
|
33
35
|
:is_target? => args[:is_target]
|
34
36
|
)
|
35
37
|
|
38
|
+
DTK::Client::GitRepo.modified?(directory_path || OsUtil.current_dir) unless force
|
36
39
|
service_name ||= rest_post("#{BaseRoute}/generate_service_name", post_body).data
|
37
|
-
|
38
|
-
|
39
|
-
raise Error::Usage, "Directory '#{path}' is not empty; it must be deleted or removed before retrying the command" if ClientModuleDir.local_dir_exists?(:service, service_name)
|
40
|
+
base_path = ClientModuleDir.ret_base_path(:service, service_name)
|
40
41
|
|
42
|
+
raise Error::Usage, "Directory '#{base_path}' is not empty; it must be deleted or removed before retrying the command" if ClientModuleDir.local_dir_exists?(:service, service_name)
|
43
|
+
|
41
44
|
post_body.merge!(:service_name => service_name)
|
42
45
|
response = rest_post("#{BaseRoute}/create", post_body)
|
43
46
|
|
@@ -22,6 +22,7 @@ module DTK::Client
|
|
22
22
|
wrap_operation(args) do |args|
|
23
23
|
service_instance = args.required(:service_instance)
|
24
24
|
recursive = args.required(:recursive)
|
25
|
+
force = args.required(:force)
|
25
26
|
|
26
27
|
unless args[:skip_prompt]
|
27
28
|
return false unless Console.prompt_yes_no("Are you sure you want to uninstall the infrastructure associated with '#{service_instance}' and delete this service instance from the server?", :add_options => true)
|
@@ -29,7 +30,8 @@ module DTK::Client
|
|
29
30
|
|
30
31
|
post_body = PostBody.new(
|
31
32
|
:service_instance => service_instance,
|
32
|
-
:recursive? => recursive
|
33
|
+
:recursive? => recursive,
|
34
|
+
:force => force
|
33
35
|
)
|
34
36
|
rest_post("#{BaseRoute}/uninstall", post_body)
|
35
37
|
|
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.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dtk-common-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.10.
|
19
|
+
version: 0.10.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.10.
|
26
|
+
version: 0.10.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
name: mime-types
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 2.99.3
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 2.99.3
|
111
111
|
- !ruby/object:Gem::Dependency
|
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.0.0
|
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.0.0
|
125
125
|
description: Command line tool to interact with a DTK Server and DTK Service Catalog.
|
@@ -129,7 +129,7 @@ executables:
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
-
|
132
|
+
- .gitignore
|
133
133
|
- Gemfile
|
134
134
|
- README.md
|
135
135
|
- Rakefile
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/cli/command/module/list_assemblies.rb
|
154
154
|
- lib/cli/command/module/list_remotes.rb
|
155
155
|
- lib/cli/command/module/push.rb
|
156
|
+
- lib/cli/command/module/stage.rb
|
156
157
|
- lib/cli/command/module/uninstall.rb
|
157
158
|
- lib/cli/command/options.rb
|
158
159
|
- lib/cli/command/service.rb
|
@@ -231,6 +232,7 @@ files:
|
|
231
232
|
- lib/client/operation/module/list_assemblies.rb
|
232
233
|
- lib/client/operation/module/list_remotes.rb
|
233
234
|
- lib/client/operation/module/push.rb
|
235
|
+
- lib/client/operation/module/stage.rb
|
234
236
|
- lib/client/operation/module/uninstall.rb
|
235
237
|
- lib/client/operation/module_service_common.rb
|
236
238
|
- lib/client/operation/service.rb
|
@@ -320,17 +322,17 @@ require_paths:
|
|
320
322
|
- lib
|
321
323
|
required_ruby_version: !ruby/object:Gem::Requirement
|
322
324
|
requirements:
|
323
|
-
- -
|
325
|
+
- - '>='
|
324
326
|
- !ruby/object:Gem::Version
|
325
327
|
version: 1.9.3
|
326
328
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
329
|
requirements:
|
328
|
-
- -
|
330
|
+
- - '>='
|
329
331
|
- !ruby/object:Gem::Version
|
330
332
|
version: '0'
|
331
333
|
requirements: []
|
332
334
|
rubyforge_project:
|
333
|
-
rubygems_version: 2.
|
335
|
+
rubygems_version: 2.0.14.1
|
334
336
|
signing_key:
|
335
337
|
specification_version: 4
|
336
338
|
summary: DTK CLI client for DTK server interaction.
|