dtk-client 0.11.7 → 0.11.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 +4 -4
- data/.gitignore +2 -2
- data/dtk-client.gemspec +2 -2
- data/lib/cli/command/account/add_to_group.rb +33 -0
- data/lib/cli/command/account/chmod.rb +33 -0
- data/lib/cli/command/account/create_namespace.rb +32 -0
- data/lib/cli/command/account/delete_namespace.rb +32 -0
- data/lib/cli/command/account/list_namespaces.rb +30 -0
- data/lib/cli/command/account/remove_from_group.rb +33 -0
- data/lib/cli/command/account.rb +14 -1
- data/lib/cli/command/module/delete_from_remote.rb +5 -3
- data/lib/cli/command/module/install.rb +242 -102
- data/lib/cli/command/module/list_remotes.rb +1 -1
- data/lib/cli/command/module/publish.rb +3 -2
- data/lib/cli/command/module/pull_dtkn.rb +2 -2
- data/lib/cli/command/module/push.rb +2 -1
- data/lib/cli/command/module/push_dtkn.rb +3 -2
- data/lib/cli/command/module/unpublish.rb +42 -0
- data/lib/cli/command/module/update.rb +33 -0
- data/lib/cli/command/module.rb +3 -1
- data/lib/cli/command/token.rb +9 -3
- data/lib/cli/context.rb +7 -5
- data/lib/cli/directory_parser/file_system.rb +76 -36
- data/lib/cli/processor/plugin/gli.rb +2 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/error/subclasses.rb +12 -0
- data/lib/client/git_repo/adapter/git_gem.rb +3 -1
- data/lib/client/operation/account/add_to_group.rb +29 -0
- data/lib/client/operation/account/chmod.rb +29 -0
- data/lib/client/operation/account/create_namespace.rb +29 -0
- data/lib/client/operation/account/delete_namespace.rb +29 -0
- data/lib/client/operation/account/list_namespaces.rb +29 -0
- data/lib/client/operation/account/remove_from_group.rb +29 -0
- data/lib/client/operation/account.rb +14 -1
- data/lib/client/operation/client_module_dir/git_repo/internal.rb +4 -22
- data/lib/client/operation/client_module_dir/git_repo.rb +5 -6
- data/lib/client/operation/client_module_dir/service_instance/internal/module_info.rb +67 -0
- data/lib/client/operation/client_module_dir/service_instance/internal.rb +106 -0
- data/lib/client/operation/client_module_dir/service_instance.rb +30 -0
- data/lib/client/operation/client_module_dir.rb +5 -0
- data/lib/client/operation/module/clone_module.rb +2 -2
- data/lib/client/operation/module/delete_from_remote.rb +7 -31
- data/lib/client/operation/module/install/dependent_modules/component_module.rb +1 -2
- data/lib/client/operation/module/install/dependent_modules/local_dependencies.rb +1 -1
- data/lib/client/operation/module/install/print_helper.rb +1 -1
- data/lib/client/operation/module/install.rb +25 -19
- data/lib/client/operation/module/install_from_catalog.rb +15 -29
- data/lib/client/operation/module/list_remotes.rb +4 -11
- data/lib/client/operation/module/publish.rb +17 -31
- data/lib/client/operation/module/pull_dtkn.rb +37 -28
- data/lib/client/operation/module/push.rb +69 -5
- data/lib/client/operation/module/push_dtkn.rb +25 -13
- data/lib/client/operation/module/stage.rb +3 -3
- data/lib/client/operation/module/unpublish.rb +60 -0
- data/lib/client/operation/module/update.rb +59 -0
- data/lib/client/operation/module.rb +23 -9
- data/lib/client/operation/service/clone_service.rb +3 -0
- data/lib/client/operation.rb +7 -0
- metadata +38 -5
@@ -67,7 +67,7 @@ module DTK::Client
|
|
67
67
|
|
68
68
|
def pull_dtkn(opts = {})
|
69
69
|
# TODO: DTK-2765: not sure if we need module to exist on server to do push-dtkn
|
70
|
-
unless module_version_exists?(@module_ref
|
70
|
+
unless module_version_exists?(@module_ref)
|
71
71
|
raise Error::Usage, "Module #{@module_ref.print_form} does not exist on server"
|
72
72
|
end
|
73
73
|
|
@@ -76,32 +76,41 @@ module DTK::Client
|
|
76
76
|
raise Error::Usage, "You are not allowed to pull module version '#{ref_version}'!" unless do_not_raise
|
77
77
|
end
|
78
78
|
|
79
|
-
error_msg = "To allow pull-dtkn to go through, invoke 'dtk push' to push the changes to server before invoking pull-dtkn again"
|
80
|
-
GitRepo.modified_with_diff?(@target_repo_dir, { :error_msg => error_msg, :command => 'pull-dtkn' })
|
81
|
-
|
82
|
-
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
79
|
+
# error_msg = "To allow pull-dtkn to go through, invoke 'dtk push' to push the changes to server before invoking pull-dtkn again"
|
80
|
+
# GitRepo.modified_with_diff?(@target_repo_dir, { :error_msg => error_msg, :command => 'pull-dtkn' })
|
81
|
+
|
82
|
+
module_info = {
|
83
|
+
name: module_ref.module_name,
|
84
|
+
namespace: module_ref.namespace,
|
85
|
+
version: ref_version,
|
86
|
+
repo_dir: target_repo_dir
|
87
|
+
}
|
88
|
+
DtkNetworkClient::Pull.run(module_info)
|
89
|
+
|
90
|
+
|
91
|
+
# query_string_hash = QueryStringHash.new(
|
92
|
+
# :module_name => @module_ref.module_name,
|
93
|
+
# :namespace => @module_ref.namespace,
|
94
|
+
# :rsa_pub_key => SSHUtil.rsa_pub_key_content,
|
95
|
+
# :version => @version
|
96
|
+
# )
|
97
|
+
# remote_module_info = rest_get "#{BaseRoute}/remote_module_info", query_string_hash
|
98
|
+
|
99
|
+
|
100
|
+
# unless dependent_modules.empty?
|
101
|
+
# begin
|
102
|
+
# Install::DependentModules.install(@module_ref, dependent_modules, :update_deps => opts[:update_deps], :no_update_deps => opts[:no_update_deps] , :mode => 'pull', :do_not_print => opts[:do_not_print])
|
103
|
+
# # Install::DependentModules.install(@module_ref, dependent_modules, :skip_prompt => false, :mode => 'pull')
|
104
|
+
# rescue Install::TerminateInstall
|
105
|
+
# @print_helper.print_terminated_pulling
|
106
|
+
# return nil
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
|
110
|
+
# @print_helper.print_continuation_pulling_base_module unless opts[:do_not_print]
|
111
|
+
# LoadSource.fetch_transform_and_merge(remote_module_info, self, :stage_and_commit_steps => true, :force => opts[:force], :use_theirs => true)
|
112
|
+
|
113
|
+
# nil
|
105
114
|
end
|
106
115
|
|
107
116
|
private
|
@@ -123,7 +132,7 @@ module DTK::Client
|
|
123
132
|
Install::ModuleRef.new(:namespace => dep_namespace, :module_name => dep_module_name, :version => dep_version, :is_base_module => is_base_module)
|
124
133
|
end
|
125
134
|
unless base_component_module_found
|
126
|
-
if module_version_exists?(@module_ref
|
135
|
+
if module_version_exists?(@module_ref)
|
127
136
|
ret << Install::ModuleRef.new(:namespace => @module_ref.namespace, :module_name => @module_ref.module_name, :version => @module_ref.version, :is_base_module => true)
|
128
137
|
end
|
129
138
|
end
|
@@ -20,15 +20,18 @@ module DTK::Client
|
|
20
20
|
class Push < self
|
21
21
|
def self.execute(args = Args.new)
|
22
22
|
wrap_operation(args) do |args|
|
23
|
-
module_ref
|
24
|
-
method
|
25
|
-
allow_version
|
23
|
+
module_ref = args.required(:module_ref)
|
24
|
+
method = args[:method] || "pushed"
|
25
|
+
allow_version = args[:allow_version]
|
26
|
+
base_dsl_file_obj = args.required(:base_dsl_file_obj)
|
27
|
+
update_lock_file = args[:update_lock_file]
|
28
|
+
context = args[:context]
|
26
29
|
|
27
30
|
unless client_dir_path = module_ref.client_dir_path
|
28
31
|
raise Error, "Not implemented yet; need to make sure module_ref.client_dir_path is set when client_dir_path given"
|
29
32
|
end
|
30
33
|
|
31
|
-
unless module_info = module_version_exists?(module_ref
|
34
|
+
unless module_info = module_version_exists?(module_ref)
|
32
35
|
raise Error::Usage, "DTK module '#{module_ref.print_form}' does not exist."
|
33
36
|
end
|
34
37
|
|
@@ -41,6 +44,65 @@ module DTK::Client
|
|
41
44
|
repo_url = module_info.required(:repo, :url)
|
42
45
|
repo_name = module_info.required(:repo, :name)
|
43
46
|
|
47
|
+
@file_obj = base_dsl_file_obj.raise_error_if_no_content
|
48
|
+
parsed_module = @file_obj.parse_content(:common_module_summary)
|
49
|
+
repoman_client_module_info = {
|
50
|
+
name: module_ref.module_name,
|
51
|
+
namespace: module_ref.namespace,
|
52
|
+
version: module_ref.version,
|
53
|
+
repo_dir: @file_obj.parent_dir
|
54
|
+
}
|
55
|
+
dependency_tree = DtkNetworkDependencyTree.get_or_create(repoman_client_module_info, { format: :hash, parsed_module: parsed_module, save_to_file: true, update_lock_file: update_lock_file })
|
56
|
+
|
57
|
+
# TODO: need to refactor to use the same code for push and install
|
58
|
+
dependency_tree.each do |dependency|
|
59
|
+
dep_module_ref = context.module_ref_object_from_options_or_context(module_ref: "#{dependency[:namespace]}/#{dependency[:name]}", version: dependency[:version])
|
60
|
+
if Operation::Module.module_version_exists?(dep_module_ref)
|
61
|
+
p_helper = Operation::Module::Install::PrintHelper.new(:module_ref => dep_module_ref, :source => :local)
|
62
|
+
p_helper.print_using_installed_dependent_module
|
63
|
+
else
|
64
|
+
client_installed_modules = nil
|
65
|
+
|
66
|
+
if dependency[:source]
|
67
|
+
client_installed_modules = [dependency]
|
68
|
+
else
|
69
|
+
install_response = Operation::Module.install_from_catalog(module_ref: dep_module_ref, version: dep_module_ref.version, type: :dependency)
|
70
|
+
client_installed_modules = (install_response && install_response.data[:installed_modules])
|
71
|
+
end
|
72
|
+
|
73
|
+
if client_installed_modules# = (install_response && install_response.data[:installed_modules])
|
74
|
+
install_from = dependency[:source] ? :local : :remote
|
75
|
+
opts_server_install = {
|
76
|
+
has_directory_param: false,
|
77
|
+
has_remote_repo: true,
|
78
|
+
# update_deps: self.update_deps?,
|
79
|
+
install_from: install_from
|
80
|
+
}
|
81
|
+
client_installed_modules.each do |installed_module|
|
82
|
+
directory_path = installed_module[:location] || installed_module[:source]
|
83
|
+
temp_module_ref = context.module_ref_object_from_options_or_context(directory_path: directory_path, version: installed_module[:version])
|
84
|
+
# use_or_install_on_server(module_ref, directory_path, opts)
|
85
|
+
if Operation::Module.module_version_exists?(temp_module_ref)
|
86
|
+
p_helper = Operation::Module::Install::PrintHelper.new(:module_ref => temp_module_ref, :source => :local)
|
87
|
+
p_helper.print_using_installed_dependent_module
|
88
|
+
else
|
89
|
+
temp_base_dsl_file_obj = CLI::Context.base_dsl_file_obj(dir_path: directory_path)
|
90
|
+
operation_args = {
|
91
|
+
:module_ref => temp_module_ref,
|
92
|
+
:base_dsl_file_obj => temp_base_dsl_file_obj,
|
93
|
+
:has_directory_param => opts_server_install[:has_directory_param],
|
94
|
+
:has_remote_repo => opts_server_install[:has_remote_repo],
|
95
|
+
:update_deps => opts_server_install[:update_dep],
|
96
|
+
:install_from => opts_server_install[:install_from]
|
97
|
+
}
|
98
|
+
Operation::Module.install(operation_args)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
# install_on_server(client_installed_modules, opts_server_install)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
44
106
|
git_repo_args = {
|
45
107
|
:repo_dir => module_ref.client_dir_path,
|
46
108
|
:repo_url => repo_url,
|
@@ -58,7 +120,9 @@ module DTK::Client
|
|
58
120
|
:commit_sha => git_repo_response.data(:head_sha)
|
59
121
|
)
|
60
122
|
|
61
|
-
response =
|
123
|
+
response = handle_error @file_obj.parent_dir do
|
124
|
+
rest_post("#{BaseRoute}/update_from_repo", post_body)
|
125
|
+
end
|
62
126
|
|
63
127
|
existing_diffs = nil
|
64
128
|
print = nil
|
@@ -21,13 +21,14 @@ 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)
|
24
|
+
def initialize(catalog, module_ref, directory_path, version, base_dsl_file_obj, update_lock_file)
|
25
25
|
@catalog = catalog
|
26
26
|
@module_ref = module_ref
|
27
27
|
@directory_path = directory_path
|
28
28
|
@target_repo_dir = directory_path || base_dsl_file_obj.parent_dir
|
29
29
|
@version = version || module_ref.version || 'master'
|
30
30
|
@base_dsl_file_obj = base_dsl_file_obj
|
31
|
+
@update_lock_file = update_lock_file
|
31
32
|
|
32
33
|
@module_ref.version ||= @version
|
33
34
|
end
|
@@ -39,13 +40,14 @@ module DTK::Client
|
|
39
40
|
version = args[:version]
|
40
41
|
directory_path = args[:directory_path]
|
41
42
|
base_dsl_file_obj = args[:base_dsl_file_obj]
|
42
|
-
|
43
|
+
update_lock_file = args[:update_lock_file]
|
44
|
+
new('dtkn', module_ref, directory_path, version, base_dsl_file_obj, update_lock_file).push_dtkn
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
48
|
def push_dtkn
|
47
49
|
# TODO: DTK-2765: not sure if we need module to exist on server to do push-dtkn
|
48
|
-
unless module_version_exists?(@module_ref
|
50
|
+
unless module_version_exists?(@module_ref)
|
49
51
|
raise Error::Usage, "Module #{@module_ref.print_form} does not exist on server"
|
50
52
|
end
|
51
53
|
|
@@ -53,18 +55,28 @@ module DTK::Client
|
|
53
55
|
raise Error::Usage, "You are not allowed to push module version '#{ref_version}'!" unless ref_version.eql?('master')
|
54
56
|
end
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
@file_obj = @base_dsl_file_obj.raise_error_if_no_content
|
59
|
+
parsed_module = @file_obj.parse_content(:common_module_summary)
|
60
|
+
# error_msg = "To allow push-dtkn to go through, invoke 'dtk push' to push the changes to server before invoking push-dtkn again"
|
61
|
+
# GitRepo.modified_with_diff?(target_repo_dir, { :error_msg => error_msg, :command => 'push-dtkn' })
|
58
62
|
|
59
|
-
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
|
65
|
-
|
63
|
+
module_info = {
|
64
|
+
name: module_ref.module_name,
|
65
|
+
namespace: module_ref.namespace,
|
66
|
+
version: ref_version,
|
67
|
+
repo_dir: target_repo_dir
|
68
|
+
}
|
69
|
+
DtkNetworkClient::Push.run(module_info, parsed_module: parsed_module, update_lock_file: @update_lock_file)
|
66
70
|
|
67
|
-
|
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
|
+
|
79
|
+
# ConvertSource.transform_and_commit(remote_module_info, self)
|
68
80
|
nil
|
69
81
|
end
|
70
82
|
|
@@ -49,12 +49,12 @@ module DTK::Client
|
|
49
49
|
|
50
50
|
clone_args = {
|
51
51
|
:module_ref => module_ref,
|
52
|
-
:
|
53
|
-
:
|
52
|
+
:base_module => response.required(:base_module),
|
53
|
+
:nested_modules => response.required(:nested_modules),
|
54
54
|
:service_instance => service_instance,
|
55
55
|
:remove_existing => remove_existing
|
56
56
|
}
|
57
|
-
message = ClientModuleDir::
|
57
|
+
message = ClientModuleDir::ServiceInstance.clone(clone_args)
|
58
58
|
target_dir = message.data(:target_repo_dir)
|
59
59
|
|
60
60
|
OsUtil.print_info("Service instance '#{service_instance}' has been created. In order to work with service instance, please navigate to: #{target_dir}")
|
@@ -0,0 +1,60 @@
|
|
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 Unpublish < self
|
21
|
+
attr_reader :module_ref
|
22
|
+
|
23
|
+
def initialize(catalog, module_ref)
|
24
|
+
@catalog = catalog
|
25
|
+
@module_ref = module_ref
|
26
|
+
end
|
27
|
+
private :initialize
|
28
|
+
|
29
|
+
def self.execute(args = Args.new)
|
30
|
+
wrap_operation(args) do |args|
|
31
|
+
module_ref = args.required(:module_ref)
|
32
|
+
new('dtkn', module_ref).unpublish(:skip_prompt => args[:skip_prompt], :force => args[:force])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def unpublish(opts = {})
|
37
|
+
version = module_ref.version
|
38
|
+
raise Error::Usage, "Version is required" unless version
|
39
|
+
|
40
|
+
unless opts[:skip_prompt]
|
41
|
+
module_ref_opts = { :namespace => module_ref.namespace }
|
42
|
+
module_ref_opts.merge!(:version => version)
|
43
|
+
return unless Console.prompt_yes_no("Are you sure you want to unpublish module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, module_ref_opts)}' from dtk network?", :add_options => true)
|
44
|
+
end
|
45
|
+
|
46
|
+
module_info = {
|
47
|
+
name: module_ref.module_name,
|
48
|
+
namespace: module_ref.namespace,
|
49
|
+
version: version
|
50
|
+
}
|
51
|
+
DtkNetworkClient::Unpublish.run(module_info)
|
52
|
+
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
@@ -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::Module
|
20
|
+
class Update < self
|
21
|
+
attr_reader :module_ref, :target_repo_dir, :version
|
22
|
+
def initialize(catalog, module_ref, directory_path)
|
23
|
+
@catalog = catalog
|
24
|
+
@module_ref = module_ref
|
25
|
+
@target_repo_dir = directory_path || module_ref.client_dir_path
|
26
|
+
@version = module_ref.version
|
27
|
+
end
|
28
|
+
private :initialize
|
29
|
+
|
30
|
+
def self.execute(args = Args.new)
|
31
|
+
wrap_operation(args) do |args|
|
32
|
+
module_ref = args.required(:module_ref)
|
33
|
+
base_dsl_file_obj = args.required(:base_dsl_file_obj)
|
34
|
+
directory_path = args[:directory_path]
|
35
|
+
new('dtkn', module_ref, directory_path).update({file_obj: base_dsl_file_obj})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def update(opts = {})
|
40
|
+
file_obj = opts[:file_obj]
|
41
|
+
parsed_module = file_obj.parse_content(:common_module_summary)
|
42
|
+
|
43
|
+
module_info = {
|
44
|
+
name: module_ref.module_name,
|
45
|
+
namespace: module_ref.namespace,
|
46
|
+
version: @version,
|
47
|
+
repo_dir: @target_repo_dir
|
48
|
+
}
|
49
|
+
|
50
|
+
response = DtkNetworkClient::Update.run(module_info, parsed_module: parsed_module)
|
51
|
+
OsUtil.print_info("Dependencies updated successfully")
|
52
|
+
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
@@ -31,11 +31,14 @@ module DTK::Client
|
|
31
31
|
:push,
|
32
32
|
:push_dtkn,
|
33
33
|
:stage,
|
34
|
-
:uninstall
|
34
|
+
:uninstall,
|
35
|
+
:unpublish
|
36
|
+
# :update
|
35
37
|
]
|
36
38
|
OPERATIONS.each { |operation| require_relative("module/#{operation}") }
|
37
39
|
|
38
|
-
BaseRoute
|
40
|
+
BaseRoute = 'modules'
|
41
|
+
MODULE_LOCK = 'dtk.module.lock'
|
39
42
|
|
40
43
|
extend ModuleServiceCommon::ClassMixin
|
41
44
|
|
@@ -43,14 +46,12 @@ module DTK::Client
|
|
43
46
|
|
44
47
|
# opts can have keys
|
45
48
|
# :remote_info - Boolean
|
46
|
-
# :type
|
47
49
|
# :rsa_pub_key
|
48
50
|
def module_version_exists?(module_ref, opts = {})
|
49
51
|
self.class.module_version_exists?(module_ref, opts)
|
50
52
|
end
|
51
53
|
def self.module_version_exists?(module_ref, opts = {})
|
52
|
-
|
53
|
-
query_string_hash = module_ref_query_string_hash(module_ref, module_type: type)
|
54
|
+
query_string_hash = module_ref_query_string_hash(module_ref)
|
54
55
|
|
55
56
|
if ret_remote_info = opts[:remote_info]
|
56
57
|
query_string_hash = query_string_hash.merge(:remote_info => ret_remote_info, :rsa_pub_key => opts[:rsa_pub_key])
|
@@ -64,10 +65,8 @@ module DTK::Client
|
|
64
65
|
PostBody.new(module_ref_hash(module_ref))
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
def self.module_ref_query_string_hash(module_ref, opts = {})
|
70
|
-
QueryStringHash.new(module_ref_hash(module_ref, opts))
|
68
|
+
def self.module_ref_query_string_hash(module_ref)
|
69
|
+
QueryStringHash.new(module_ref_hash(module_ref))
|
71
70
|
end
|
72
71
|
|
73
72
|
# opts can have keys:
|
@@ -82,6 +81,21 @@ module DTK::Client
|
|
82
81
|
}
|
83
82
|
end
|
84
83
|
|
84
|
+
def self.handle_error(base_path, &block)
|
85
|
+
begin
|
86
|
+
block.call
|
87
|
+
rescue Error::ServerNotOkResponse => ex
|
88
|
+
if response = ex.response
|
89
|
+
unless response.ok?
|
90
|
+
# If install fails, delete dtk.module.lock file
|
91
|
+
FileUtils.rm_rf("#{base_path}/#{MODULE_LOCK}")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
raise ex
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
85
99
|
end
|
86
100
|
end
|
87
101
|
end
|
@@ -27,6 +27,9 @@ module DTK::Client
|
|
27
27
|
raise Error::Usage, "DTK service '#{service_ref}' does not exist on server."
|
28
28
|
end
|
29
29
|
|
30
|
+
pp service_info
|
31
|
+
fail "TODO: DTK-3366: update to use ClientModuleDir::ServiceInstance.clone"
|
32
|
+
|
30
33
|
branch = service_info.required(:branch, :name)
|
31
34
|
repo_url = service_info.required(:repo, :url)
|
32
35
|
repo_name = service_info.required(:repo, :name)
|
data/lib/client/operation.rb
CHANGED
@@ -62,6 +62,13 @@ module DTK::Client
|
|
62
62
|
raise Error::ServerNotOkResponse.new(response)
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
require 'dtk_network_client'
|
67
|
+
class DtkNetworkClient < DTK::Network::Client::Command
|
68
|
+
end
|
69
|
+
|
70
|
+
class DtkNetworkDependencyTree < DTK::Network::Client::DependencyTree
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
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.11.
|
4
|
+
version: 0.11.8
|
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-04-02 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.11.
|
19
|
+
version: 0.11.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.11.
|
26
|
+
version: 0.11.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.1.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: dtk-network-client
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.0
|
125
139
|
description: Command line tool to interact with a DTK Server and DTK Service Catalog.
|
126
140
|
email: support@reactor8.com
|
127
141
|
executables:
|
@@ -151,9 +165,15 @@ files:
|
|
151
165
|
- lib/cli/command.rb
|
152
166
|
- lib/cli/command/account.rb
|
153
167
|
- lib/cli/command/account/add_ssh_key.rb
|
168
|
+
- lib/cli/command/account/add_to_group.rb
|
169
|
+
- lib/cli/command/account/chmod.rb
|
170
|
+
- lib/cli/command/account/create_namespace.rb
|
171
|
+
- lib/cli/command/account/delete_namespace.rb
|
154
172
|
- lib/cli/command/account/delete_ssh_key.rb
|
173
|
+
- lib/cli/command/account/list_namespaces.rb
|
155
174
|
- lib/cli/command/account/list_ssh_keys.rb
|
156
175
|
- lib/cli/command/account/register_catalog_user.rb
|
176
|
+
- lib/cli/command/account/remove_from_group.rb
|
157
177
|
- lib/cli/command/account/set_catalog_credentials.rb
|
158
178
|
- lib/cli/command/account/set_password.rb
|
159
179
|
- lib/cli/command/mixin.rb
|
@@ -170,6 +190,8 @@ files:
|
|
170
190
|
- lib/cli/command/module/push_dtkn.rb
|
171
191
|
- lib/cli/command/module/stage.rb
|
172
192
|
- lib/cli/command/module/uninstall.rb
|
193
|
+
- lib/cli/command/module/unpublish.rb
|
194
|
+
- lib/cli/command/module/update.rb
|
173
195
|
- lib/cli/command/options.rb
|
174
196
|
- lib/cli/command/service.rb
|
175
197
|
- lib/cli/command/service/cancel_task.rb
|
@@ -242,15 +264,24 @@ files:
|
|
242
264
|
- lib/client/operation.rb
|
243
265
|
- lib/client/operation/account.rb
|
244
266
|
- lib/client/operation/account/add_ssh_key.rb
|
267
|
+
- lib/client/operation/account/add_to_group.rb
|
268
|
+
- lib/client/operation/account/chmod.rb
|
269
|
+
- lib/client/operation/account/create_namespace.rb
|
270
|
+
- lib/client/operation/account/delete_namespace.rb
|
245
271
|
- lib/client/operation/account/delete_ssh_key.rb
|
272
|
+
- lib/client/operation/account/list_namespaces.rb
|
246
273
|
- lib/client/operation/account/list_ssh_keys.rb
|
247
274
|
- lib/client/operation/account/register_catalog_user.rb
|
275
|
+
- lib/client/operation/account/remove_from_group.rb
|
248
276
|
- lib/client/operation/account/set_catalog_credentials.rb
|
249
277
|
- lib/client/operation/account/set_password.rb
|
250
278
|
- lib/client/operation/client_module_dir.rb
|
251
279
|
- lib/client/operation/client_module_dir/git_repo.rb
|
252
280
|
- lib/client/operation/client_module_dir/git_repo/internal.rb
|
253
281
|
- lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb
|
282
|
+
- lib/client/operation/client_module_dir/service_instance.rb
|
283
|
+
- lib/client/operation/client_module_dir/service_instance/internal.rb
|
284
|
+
- lib/client/operation/client_module_dir/service_instance/internal/module_info.rb
|
254
285
|
- lib/client/operation/module.rb
|
255
286
|
- lib/client/operation/module/clone_module.rb
|
256
287
|
- lib/client/operation/module/delete_from_remote.rb
|
@@ -280,6 +311,8 @@ files:
|
|
280
311
|
- lib/client/operation/module/push_dtkn/convert_source/service_info.rb
|
281
312
|
- lib/client/operation/module/stage.rb
|
282
313
|
- lib/client/operation/module/uninstall.rb
|
314
|
+
- lib/client/operation/module/unpublish.rb
|
315
|
+
- lib/client/operation/module/update.rb
|
283
316
|
- lib/client/operation/module_service_common.rb
|
284
317
|
- lib/client/operation/service.rb
|
285
318
|
- lib/client/operation/service/cancel_task.rb
|
@@ -390,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
423
|
version: '0'
|
391
424
|
requirements: []
|
392
425
|
rubyforge_project:
|
393
|
-
rubygems_version: 2.4.
|
426
|
+
rubygems_version: 2.4.8
|
394
427
|
signing_key:
|
395
428
|
specification_version: 4
|
396
429
|
summary: DTK CLI client for DTK server interaction.
|