dtk_crd_parser 0.0.155 → 0.0.156

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: aff9402bfe8223f3a551e79137e097e2248040603cd2c22d57a59768deac63b7
4
- data.tar.gz: 10b0282003ae2af0b69af3e902fbbe23b5ca9dbd8b7a120e5fb56efbc428bad2
3
+ metadata.gz: 467f780a2297cfee69677b17950a64dea62f028d12fbadcdcd4385d0e40f6def
4
+ data.tar.gz: a1e1755f4a78d542db97fb36c9ba94f77b877018e9288437373293d49384fbe1
5
5
  SHA512:
6
- metadata.gz: 364dd70b869f42ada7d4cab6fd8922f4798c25d2b522f9cd53222ee443c68d6c743357ad5b8582bee9da456c11c6e93d568fee5f3c6a274e7999ccc85d542d9f
7
- data.tar.gz: 7fff179807c6d8dbc6b21559250abf9f5322a54fe01ab2db446be922edd24632b6fd0197e52033e5d3217000697a62f5ead072cc1764bac782794d1baff096ba
6
+ metadata.gz: 5661d32ed68b8d71aaf2d210362c74f98ec8d569636e09834ecceae2304c39ab45cc7f1a80d51afa0f3a1a3db9a472e23bd7229ceee5c45af270ff3b3b88641f
7
+ data.tar.gz: a7a0861b2b33222b5d78f7513ed806f507e0788bb140bf594d165114cda8b8469683c178aaad9e41e33ec510ee5f66b58a8828f1cfc1b6ffda2dd732ca05a050
data/lib/crd_parser.rb CHANGED
@@ -11,17 +11,11 @@ module DTK
11
11
  #component instance has a name and a namespace {name: xxx, namespace: yyy}
12
12
  #client is kube client
13
13
  #component name is, for example, network-aws::vpc[vpc1]
14
- component = Component.create_from_kube(client, component_instance, component_name)
15
- Logger.new('/proc/1/fd/1').error "IN PARSER #{component}"
16
- component
14
+ Component.create_from_kube(client, component_instance, component_name)
17
15
  end
18
16
 
19
17
  def self.parse_crd_to_actions(client, component_instance, component_name)
20
- Logger.new('/proc/1/fd/1').error "actions IN PARSER "
21
-
22
- action = Action.ndxExecutableActions(client, component_instance, component_name)
23
- Logger.new('/proc/1/fd/1').error "action is IN PARSER #{action}"
24
- action
18
+ Action.ndxExecutableActions(client, component_instance, component_name)
25
19
  end
26
20
 
27
21
  private
@@ -14,10 +14,7 @@ module DTK::CrdParser
14
14
 
15
15
  def self.create_from_kube(client, component_instance, component_name)
16
16
  component_obj = Component.create_from_kube(client, component_instance, component_name)
17
- Logger.new('/proc/1/fd/1').info "INITIALIZED COMPONENT iN PARSER ACTIONS "
18
- Logger.new('/proc/1/fd/1').info component_obj
19
17
  actions = component_obj.component_def.executable_actions
20
- Logger.new('/proc/1/fd/1').info "Actions IN PARSER: #{actions}"
21
18
  executable_actions = Hash.new
22
19
  if actions
23
20
  actions.to_hash.each do |name, action|
@@ -30,8 +27,6 @@ module DTK::CrdParser
30
27
  executable_actions[name.to_sym] = ExecutableAction.new(params)
31
28
  end
32
29
  end
33
- Logger.new('/proc/1/fd/1').info "exec act IN PARSER: #{executable_actions}"
34
-
35
30
  executable_actions
36
31
  end
37
32
 
@@ -15,7 +15,7 @@ module DTK::CrdParser
15
15
  nodeName, actionComponent = actionComponent.match(/(.*)\/(.*)/).captures if isOnSpecificNode(actionComponent)
16
16
  compModule, compName, attributeName, action = actionComponent.match(regex).captures if actionComponent.match(regex)
17
17
  action = (action && !action.empty?) ? action.to_sym : nil
18
-
18
+
19
19
  if(compModule.nil? || compName.nil? || attributeName.nil?)
20
20
  raise "Could not resolve component module, name or attribute name for component: #{actionComponent}"
21
21
  end
@@ -29,6 +29,14 @@ module DTK::CrdParser
29
29
  attributes.push Attribute.create_from_kube(attribute_name, attribute_value, {encrypted: encrypted || false})
30
30
  end
31
31
  end
32
+ Logger.new('/proc/1/fd/1').error "PARSER: Mapping.."
33
+
34
+ other_attrs = component_def.attribute_type_info.map {|attribute| attributes.any? {|h| h.name == attribute.name } }
35
+ Logger.new('/proc/1/fd/1').error other_attrs
36
+ other_attrs.each do |attribute|
37
+ attributes.push Attribute.create_from_kube(attribute.name, "", {encrypted: attribute.encrypted || false})
38
+ end
39
+ Logger.new('/proc/1/fd/1').error attributes
32
40
  Component.new(component_name, component_def, attributes)
33
41
  end
34
42
 
@@ -28,12 +28,7 @@ module DTK::CrdParser
28
28
  resourceVersion = componentMetadata[:resourceVersion]
29
29
 
30
30
  componentDefSpec = componentDef[:spec] || {}
31
- # if destructured_component[:action] && componentDefSpec[:actions]
32
- # componentDefAction = componentDefSpec[:actions].to_h[destructured_component[:action].to_sym]
33
- # componentDefAction = Hash.new
34
- # else
35
- componentDefAction = componentDefSpec[:actions]
36
- # end
31
+ componentDefAction = componentDefSpec[:actions]
37
32
  componentDefAttributes = []
38
33
  (componentDefSpec[:attributes] || []).each do |attribute|
39
34
  componentDefAttributes.push AttributeTypeInfo.resolveAttr(attribute)
@@ -44,7 +39,7 @@ module DTK::CrdParser
44
39
  namespace: namespace,
45
40
  resourceVersion: resourceVersion
46
41
  }
47
-
42
+
48
43
  ComponentDef.new(metadata, componentDefAction, componentDefAttributes)
49
44
  end
50
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk_crd_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.155
4
+ version: 0.0.156
5
5
  platform: ruby
6
6
  authors:
7
7
  - DTK