dtk-client 0.12.2 → 0.12.3
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/install.rb +10 -1
- data/lib/cli/command/service/set_attribute.rb +6 -2
- data/lib/cli/command/token.rb +1 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/operation/module/install_from_catalog.rb +4 -0
- data/lib/client/operation/module/push.rb +3 -0
- data/lib/client/operation/service/set_attribute.rb +10 -1
- data/lib/client/util.rb +1 -0
- data/lib/client/util/security_util.rb +31 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce708c08b83b191a7a19bfe1616eb930a9245b6ddfce6fbebe97ab536feff9eb
|
4
|
+
data.tar.gz: 423bea8f930d5cf107cbcf794b9678d7aaa3440163091f4b59cd896bc29bea5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63beb7bd18dfcbe9e94ef455a3ef71dea3cf86efb19a12a978bca07100706abcfa3af825cb6beaa343fcf77dd031eddc148fe849e1548c07375f8efe8d376a38
|
7
|
+
data.tar.gz: 5493f43e020d443251eb00843c3f90fdfdeb2d9717ea3f4879e69a7e51bb954bc5f7d0bf79ba2631502953144680779cefb0a16842866fd0332fc21e0f344bdd
|
data/dtk-client.gemspec
CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'hirb', '0.7.3'
|
26
26
|
spec.add_dependency 'mime-types', '~> 2.99.3'
|
27
27
|
spec.add_dependency 'dtk-dsl', '~> 1.1.4'
|
28
|
-
spec.add_dependency 'dtk-network-client', '1.0.
|
28
|
+
spec.add_dependency 'dtk-network-client', '1.0.5'
|
29
29
|
end
|
@@ -151,7 +151,16 @@ module DTK::Client
|
|
151
151
|
repo_dir: file_obj.parent_dir
|
152
152
|
}
|
153
153
|
parsed_module = file_obj.parse_content(:common_module_summary)
|
154
|
-
|
154
|
+
|
155
|
+
# response = Operation::Module.rest_get "modules/get_modules_versions_with_dependencies"
|
156
|
+
# server_dependencies = response.data || []
|
157
|
+
|
158
|
+
dependency_tree = Operation::DtkNetworkDependencyTree.get_or_create(module_info, {
|
159
|
+
format: :hash,
|
160
|
+
parsed_module: parsed_module,
|
161
|
+
save_to_file: true,
|
162
|
+
update_lock_file: @update_lock_file
|
163
|
+
})
|
155
164
|
|
156
165
|
dependency_tree.each do |dependency|
|
157
166
|
dep_module_ref = module_ref_object_from_options_or_context(module_ref: "#{dependency[:namespace]}/#{dependency[:name]}", version: dependency[:version])
|
@@ -23,6 +23,7 @@ module DTK::Client; module CLI
|
|
23
23
|
c.arg Token::Arg.attribute_value, :optional => true
|
24
24
|
command_body c, 'set-attribute', 'Set attribute value(s).' do |sc|
|
25
25
|
sc.switch Token.u
|
26
|
+
sc.switch Token.encrypt
|
26
27
|
sc.flag Token.directory_path
|
27
28
|
sc.flag Token.param_file
|
28
29
|
sc.action do |_global_options, options, args|
|
@@ -53,7 +54,7 @@ module DTK::Client; module CLI
|
|
53
54
|
args[1] || raise(Error::Usage, "Either argument VALUE or -f option must be given to specify a value")
|
54
55
|
end
|
55
56
|
end
|
56
|
-
helper.set_single_attribute(attribute_name, attribute_value)
|
57
|
+
helper.set_single_attribute(attribute_name, attribute_value, encrypt: options[:encrypt])
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
@@ -65,10 +66,13 @@ module DTK::Client; module CLI
|
|
65
66
|
@service_instance_dir = service_instance_dir
|
66
67
|
end
|
67
68
|
|
68
|
-
|
69
|
+
# opts can haev keys
|
70
|
+
# :encrypt
|
71
|
+
def set_single_attribute(attribute_name, attribute_value, opts = {})
|
69
72
|
Operation::Service.set_attribute(
|
70
73
|
:attribute_name => attribute_name,
|
71
74
|
:attribute_value => attribute_value,
|
75
|
+
:encrypt => opts[:encrypt],
|
72
76
|
:service_instance => self.service_instance,
|
73
77
|
:service_instance_dir => self.service_instance_dir
|
74
78
|
)
|
data/lib/cli/command/token.rb
CHANGED
@@ -73,6 +73,7 @@ module DTK::Client
|
|
73
73
|
:unlink => Switch.new([:u, :unlink], 'unlink'),
|
74
74
|
:dependencies => Switch.new(:deps, 'Dependencies'),
|
75
75
|
:u => Switch.new([:u, :unset], 'Unset attribute'),
|
76
|
+
:encrypt => Switch.new(:encrypt, 'Encrypt attribute value'),
|
76
77
|
:recursive => Switch.new(:r, 'Recursive'),
|
77
78
|
: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'),
|
78
79
|
:skip_server => Switch.new('skip-server', 'Do not install module on server'),
|
data/lib/cli/version.rb
CHANGED
@@ -52,6 +52,10 @@ module DTK::Client
|
|
52
52
|
explicit_path: @directory_path,
|
53
53
|
repo_dir: @directory_path || @target_repo_dir
|
54
54
|
}
|
55
|
+
|
56
|
+
# response = rest_get "modules/get_modules_versions_with_dependencies"
|
57
|
+
# server_dependencies = response.data || []
|
58
|
+
|
55
59
|
installed_modules = DtkNetworkClient::Install.run(module_info, type: @type, download_if_fail: @download_if_fail )
|
56
60
|
|
57
61
|
{ :installed_modules => installed_modules }
|
@@ -53,6 +53,9 @@ module DTK::Client
|
|
53
53
|
repo_dir: @file_obj.parent_dir
|
54
54
|
}
|
55
55
|
|
56
|
+
# response = Operation::Module.rest_get "modules/get_modules_versions_with_dependencies"
|
57
|
+
# server_dependencies = response.data || []
|
58
|
+
|
56
59
|
repoman_client_opts = {
|
57
60
|
format: :hash,
|
58
61
|
save_to_file: true,
|
@@ -23,7 +23,16 @@ module DTK::Client
|
|
23
23
|
service_instance = args.required(:service_instance)
|
24
24
|
attribute_name = args[:attribute_name]
|
25
25
|
attribute_value = args[:attribute_value]
|
26
|
-
|
26
|
+
encrypt = args[:encrypt]
|
27
|
+
if encrypt
|
28
|
+
hash = {
|
29
|
+
:name => "encryption_public_key"
|
30
|
+
}
|
31
|
+
response = rest_get "#{BaseRoute}/#{service_instance}/get_attribute", QueryStringHash.new(hash)
|
32
|
+
raise Error::Usage, "There is no encryption_public_key attribute in this component, or its' value is not set." if response.data.empty?
|
33
|
+
public_key = response.data
|
34
|
+
attribute_value = DTK::Client::SecurityUtil.encrypt(public_key, attribute_value)
|
35
|
+
end
|
27
36
|
query_string_hash = QueryStringHash.new(
|
28
37
|
:pattern? => attribute_name,
|
29
38
|
:value? => attribute_value
|
data/lib/client/util.rb
CHANGED
@@ -19,6 +19,7 @@ module DTK
|
|
19
19
|
require_relative('util/auxiliary')
|
20
20
|
# auxiliary must be loaded first
|
21
21
|
require_relative('util/os_util')
|
22
|
+
require_relative('util/security_util')
|
22
23
|
require_relative('util/ssh_util')
|
23
24
|
require_relative('util/console')
|
24
25
|
require_relative('util/dtk_path')
|
@@ -0,0 +1,31 @@
|
|
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
|
+
|
19
|
+
module DTK::Client
|
20
|
+
class SecurityUtil
|
21
|
+
require 'openssl'
|
22
|
+
require 'base64'
|
23
|
+
def self.encrypt(public_key_string, attribute_value)
|
24
|
+
key = OpenSSL::PKey::RSA.new(::Base64.decode64(public_key_string))
|
25
|
+
encrypted = key.public_encrypt(attribute_value)
|
26
|
+
encoded = ::Base64.encode64(encrypted)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dtk-common-core
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.0.
|
131
|
+
version: 1.0.5
|
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.5
|
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:
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- lib/client/util/post_body.rb
|
402
402
|
- lib/client/util/query_string_hash.rb
|
403
403
|
- lib/client/util/remote_dependency.rb
|
404
|
+
- lib/client/util/security_util.rb
|
404
405
|
- lib/client/util/ssh_util.rb
|
405
406
|
- lib/client/util/validation.rb
|
406
407
|
- lib/dtk_cli.rb
|