dtk-client 0.11.6 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/cli/command/module/install.rb +33 -4
- data/lib/cli/command/service/exec.rb +11 -5
- data/lib/cli/command/service/exec_sync.rb +7 -1
- data/lib/cli/command/token.rb +2 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/operation/service/exec.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41bddc4ef8eb1c096ffee27ace98b4c5e1d17f4e
|
4
|
+
data.tar.gz: ac98dfb1857f1b916ed182072bff7278d7669901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b379952dd59a5bb7d87ed06e5be921b23d7e0ae2e706eb5c559d4ea440ab425739524d025a49f55b83279886d2ac695829afe57aae2db169cb34cf7074d6caa
|
7
|
+
data.tar.gz: a0ce708ca651d169175fabf00be1d4de5a1d31b81aeed5b45f4309797fff3852b47f09420eebe94f9b1749ae40a62d188b07446d0162ffe6c149dbace15cb03b
|
data/.gitignore
CHANGED
@@ -46,9 +46,10 @@ module DTK::Client
|
|
46
46
|
remote_module_info = nil
|
47
47
|
|
48
48
|
unless version
|
49
|
-
remote_module_info = get_remote_module_info(module_ref)
|
50
|
-
|
51
|
-
|
49
|
+
if remote_module_info = get_remote_module_info(module_ref)
|
50
|
+
version = remote_module_info.required(:version)
|
51
|
+
module_ref.version = version
|
52
|
+
end
|
52
53
|
end
|
53
54
|
|
54
55
|
if Operation::Module.module_version_exists?(module_ref, :type => :common_module)
|
@@ -86,6 +87,14 @@ module DTK::Client
|
|
86
87
|
:module_ref => module_ref,
|
87
88
|
:target_directory => Operation::ClientModuleDir.create_module_dir_from_path(directory_path || OsUtil.current_dir)
|
88
89
|
}
|
90
|
+
|
91
|
+
unless version
|
92
|
+
if server_version = get_last_version_from_server(module_ref)
|
93
|
+
version = server_version
|
94
|
+
module_ref.version = version
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
89
98
|
repo_dir_info = Operation::Module.clone_module(arg).data
|
90
99
|
repo_dir = repo_dir_info[:target_repo_dir]
|
91
100
|
|
@@ -121,8 +130,28 @@ module DTK::Client
|
|
121
130
|
:rsa_pub_key => SSHUtil.rsa_pub_key_content,
|
122
131
|
:version? => nil
|
123
132
|
)
|
133
|
+
begin
|
134
|
+
Operation::Module.rest_get("#{Operation::Module::BaseRoute}/remote_module_info", query_string_hash)
|
135
|
+
rescue Error::ServerNotOkResponse => e
|
136
|
+
# do not raise if version not specified and module does not exist on repoman but exist on server; clone module from server instead
|
137
|
+
return
|
138
|
+
end
|
139
|
+
end
|
124
140
|
|
125
|
-
|
141
|
+
def get_last_version_from_server(module_ref)
|
142
|
+
query_string_hash = QueryStringHash.new(
|
143
|
+
:module_name => module_ref.module_name,
|
144
|
+
:namespace => module_ref.namespace
|
145
|
+
)
|
146
|
+
response = Operation::Module.rest_get("#{Operation::Module::BaseRoute}/versions", query_string_hash)
|
147
|
+
versions = response.required(:versions)
|
148
|
+
|
149
|
+
if versions.size > 1
|
150
|
+
versions.delete('master')
|
151
|
+
versions.sort.last.strip
|
152
|
+
else
|
153
|
+
versions.first.strip
|
154
|
+
end
|
126
155
|
end
|
127
156
|
end
|
128
157
|
end
|
@@ -23,14 +23,18 @@ module DTK::Client
|
|
23
23
|
c.arg Token::Arg.action_params, :optional => true
|
24
24
|
command_body c, :exec, 'Execute action asynchronously' do |sc|
|
25
25
|
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'
|
26
|
+
sc.flag Token.attempts, :desc => "Number of attempts"
|
27
|
+
sc.flag Token.sleep, :desc => "Number of sleep in seconds"
|
28
|
+
|
26
29
|
sc.switch Token.breakpoint
|
27
30
|
sc.action do |_global_options, options, args|
|
28
31
|
|
29
|
-
service_instance = service_instance_in_options_or_context(options)
|
30
|
-
|
31
|
-
|
32
|
-
action_params = args[1]
|
32
|
+
service_instance = service_instance_in_options_or_context(options)
|
33
|
+
action = args[0]
|
34
|
+
action_params = args[1]
|
33
35
|
directory_path = options[:d] || @base_dsl_file_obj.parent_dir
|
36
|
+
attempts = options['attempts']
|
37
|
+
sleep = options['sleep']
|
34
38
|
|
35
39
|
args = {
|
36
40
|
:service_instance => service_instance,
|
@@ -38,7 +42,9 @@ module DTK::Client
|
|
38
42
|
:action_params => action_params,
|
39
43
|
:breakpoint => options['breakpoint'],
|
40
44
|
:directory_path => directory_path,
|
41
|
-
:command => 'exec'
|
45
|
+
:command => 'exec',
|
46
|
+
:attempts => attempts,
|
47
|
+
:sleep => sleep
|
42
48
|
}
|
43
49
|
|
44
50
|
response = Operation::Service.exec(args)
|
@@ -23,6 +23,8 @@ module DTK::Client
|
|
23
23
|
c.arg Token::Arg.action_params, :optional => true
|
24
24
|
command_body c, 'exec-sync', 'Execute action synchronously' do |sc|
|
25
25
|
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'
|
26
|
+
sc.flag Token.attempts, :desc => "Number of attempts"
|
27
|
+
sc.flag Token.sleep, :desc => "Number of sleep in seconds"
|
26
28
|
sc.switch Token.breakpoint
|
27
29
|
sc.action do |_global_options, options, args|
|
28
30
|
service_instance = service_instance_in_options_or_context(options)
|
@@ -30,6 +32,8 @@ module DTK::Client
|
|
30
32
|
action = args[0]
|
31
33
|
action_params = args[1]
|
32
34
|
directory_path = options[:d] || @base_dsl_file_obj.parent_dir
|
35
|
+
attempts = options['attempts']
|
36
|
+
sleep = options['sleep']
|
33
37
|
|
34
38
|
args = {
|
35
39
|
:service_instance => service_instance,
|
@@ -37,7 +41,9 @@ module DTK::Client
|
|
37
41
|
:action_params => action_params,
|
38
42
|
:breakpoint => options['breakpoint'],
|
39
43
|
:directory_path => directory_path,
|
40
|
-
:command => 'exec-sync'
|
44
|
+
:command => 'exec-sync',
|
45
|
+
:attempts => attempts,
|
46
|
+
:sleep => sleep
|
41
47
|
}
|
42
48
|
response = Operation::Service.exec(args)
|
43
49
|
|
data/lib/cli/command/token.rb
CHANGED
@@ -50,6 +50,8 @@ module DTK::Client
|
|
50
50
|
:uninstall_name => Flag.new(:name, 'NAME', 'Module name to uninstall'),
|
51
51
|
:link_name => Flag.new([:l, :link_name], 'link-name', 'Specify link name'),
|
52
52
|
:format => Flag.new(:format, 'FORMAT', 'Choose in which format to display data (ex. TABLE, YAML)'),
|
53
|
+
:sleep => Flag.new(:sleep, '', ''),
|
54
|
+
:attempts => Flag.new(:attempts, '', ''),
|
53
55
|
|
54
56
|
# switches
|
55
57
|
# Switch constructor args order: key, desc, opts={}
|
data/lib/cli/version.rb
CHANGED
@@ -25,7 +25,8 @@ module DTK::Client
|
|
25
25
|
action_params = args[:action_params]
|
26
26
|
directory_path = args[:directory_path]
|
27
27
|
breakpoint = args[:breakpoint]
|
28
|
-
|
28
|
+
attempts = args[:attempts] || ""
|
29
|
+
sleep = args[:sleep] || ""
|
29
30
|
# parse params and return format { 'p_name1' => 'p_value1' , 'p_name2' => 'p_value2' }
|
30
31
|
task_params = parse_params?(action_params)||{}
|
31
32
|
|
@@ -52,6 +53,7 @@ module DTK::Client
|
|
52
53
|
:task_params? => task_params
|
53
54
|
)
|
54
55
|
post_body.merge!(:breakpoint => breakpoint) if breakpoint
|
56
|
+
post_body.merge!(:attempts => attempts, :sleep => sleep) if attempts || sleep
|
55
57
|
encoded_action = URI.encode_www_form_component("#{action}")
|
56
58
|
response = rest_post("#{BaseRoute}/#{service_instance}/#{encoded_action}", post_body)
|
57
59
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dtk-common-core
|
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
390
|
version: '0'
|
391
391
|
requirements: []
|
392
392
|
rubyforge_project:
|
393
|
-
rubygems_version: 2.
|
393
|
+
rubygems_version: 2.4.1
|
394
394
|
signing_key:
|
395
395
|
specification_version: 4
|
396
396
|
summary: DTK CLI client for DTK server interaction.
|