dtk-client 0.12.3 → 0.12.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce708c08b83b191a7a19bfe1616eb930a9245b6ddfce6fbebe97ab536feff9eb
4
- data.tar.gz: 423bea8f930d5cf107cbcf794b9678d7aaa3440163091f4b59cd896bc29bea5c
3
+ metadata.gz: 2d6e01820600b6104abd6570dd290f76f3b5f07e20e95a253ea754a9d6a6bd51
4
+ data.tar.gz: 8c56a1e9dc48c1ff6e51f5db7b2aaf5dddca9e657bd9214a3edbf2caf386ece9
5
5
  SHA512:
6
- metadata.gz: 63beb7bd18dfcbe9e94ef455a3ef71dea3cf86efb19a12a978bca07100706abcfa3af825cb6beaa343fcf77dd031eddc148fe849e1548c07375f8efe8d376a38
7
- data.tar.gz: 5493f43e020d443251eb00843c3f90fdfdeb2d9717ea3f4879e69a7e51bb954bc5f7d0bf79ba2631502953144680779cefb0a16842866fd0332fc21e0f344bdd
6
+ metadata.gz: 1936303d086ef2a97dcc9cad4bcc771ac75b4b01f60f81f54c5f3a570b4590f9094c162ddaaba09acc3779a4cbae5a7f47cf2f91d52338a8de727be57d71ac7b
7
+ data.tar.gz: ce033a299a700a6b2254a361c432f1ad76dabba28b0c221d33fb94a294490a3aaced7a16308108595e09507ef0a5e21dd89dcb2a915e225939a93a6599f61b8d
@@ -19,12 +19,13 @@ module DTK::Client; module CLI
19
19
  module Command
20
20
  module Service
21
21
  subcommand_def 'list-attributes' do |c|
22
+ c.arg Token::Arg.attribute_name, :optional => true
22
23
  command_body c, 'attributes', 'List attributes associated with service instance.' do |sc|
23
24
  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'
24
25
  # sc.flag Token.node, :desc => 'Filter attributes by node'
25
26
  sc.flag Token.format
26
- # sc.flag Token.component, :desc => 'Filter attributes by component'
27
- sc.switch Token.all, :desc => 'List component and node level attributes with top level ones'
27
+ sc.flag Token.component, :desc => 'Filter attributes by component'
28
+
28
29
  sc.switch Token.links, :desc => 'Display attribute links'
29
30
 
30
31
  sc.action do |_global_options, options, _args|
@@ -34,9 +35,9 @@ module DTK::Client; module CLI
34
35
  :service_instance => service_instance,
35
36
  :links => options[:links],
36
37
  # :node => options[:node],
37
- # :component => options[:component],
38
- :all => options[:all],
39
- :format => options[:format]
38
+ :component => options[:component],
39
+ :format => options[:format],
40
+ :attribute_name => _args[0]
40
41
  }
41
42
  Operation::Service.list_attributes(args)
42
43
  end
@@ -43,7 +43,7 @@ module DTK::Client
43
43
  :version => Flag.new(:v, 'VERSION', 'Version'),
44
44
  :type => Flag.new(:type, 'TYPE', 'Type'),
45
45
  :node => Flag.new(:n, 'NODE', 'Node'),
46
- :component => Flag.new(:c, 'COMPONENT', 'Component'),
46
+ :component => Flag.new([:c, :component], 'COMPONENT', 'Component'),
47
47
  :remote_user => Flag.new(:u, 'REMOTE-USER', 'Remote user'),
48
48
  :identity_file => Flag.new(:i, 'PATH-TO-PEM', 'Path to pem file'),
49
49
  :mode => Flag.new(:mode, 'MODE', 'Mode'),
@@ -18,7 +18,7 @@
18
18
  module DTK
19
19
  module Client
20
20
  module CLI
21
- VERSION="0.12.3"
21
+ VERSION="0.12.4"
22
22
  end
23
23
  end
24
24
  end
@@ -23,17 +23,21 @@ module DTK::Client
23
23
  service_instance = args.required(:service_instance)
24
24
  links = args[:links]
25
25
  # node = args[:node]
26
- # component = args[:component]
27
- all = args[:all]
26
+ name = args[:attribute_name]
27
+ component = args[:component]
28
28
  format = args[:format] || 'table'
29
29
  format.downcase!
30
30
 
31
+ if component && name
32
+ raise Error::Usage, "Command options ATTRIBUTE NAME and --component cannot be used at the same time."
33
+ end
34
+
31
35
  query_string_hash = QueryStringHash.new(
32
36
  :links? => links,
33
37
  # :node_id? => node,
34
- :all => all,
35
- # :filter_component? => component,
36
- :format => format
38
+ :filter_component? => component,
39
+ :format => format,
40
+ :attribute_name => name
37
41
  )
38
42
 
39
43
  response = rest_get("#{BaseRoute}/#{service_instance}/attributes", query_string_hash)
@@ -26,11 +26,26 @@ module DTK::Client
26
26
  encrypt = args[:encrypt]
27
27
  if encrypt
28
28
  hash = {
29
- :name => "encryption_public_key"
29
+ :name => attribute_name.split('/').last,
30
+ :component => attribute_name.split('/').first
30
31
  }
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
32
+ attribute_to_set = rest_get "#{BaseRoute}/#{service_instance}/get_attribute", QueryStringHash.new(hash)
33
+
34
+ if attribute_to_set.data.empty?
35
+ raise Error::Usage, "There is no attribute named #{attribute_name}."
36
+ end
37
+
38
+ hash = {
39
+ :name => "encryption_public_key",
40
+ :component => attribute_to_set.data["nested_component"]["display_name"]
41
+ }
42
+ public_key_attribute = rest_get "#{BaseRoute}/#{service_instance}/get_attribute", QueryStringHash.new(hash)
43
+
44
+ if public_key_attribute.data.empty? || !(public_key_attribute.data["value_asserted"] || public_key_attribute.data["value_derived"])
45
+ raise Error::Usage, "There is no encryption_public_key attribute in component '#{attribute_to_set.data["nested_component"]["display_name"]}', or its' value is not set."
46
+ end
47
+
48
+ public_key = public_key_attribute.data["value_asserted"] || public_key_attribute.data["value_derived"]
34
49
  attribute_value = DTK::Client::SecurityUtil.encrypt(public_key, attribute_value)
35
50
  end
36
51
  query_string_hash = QueryStringHash.new(
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.3
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reactor8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-08 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dtk-common-core