dtk_crd_parser 0.0.155 → 0.0.156
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 467f780a2297cfee69677b17950a64dea62f028d12fbadcdcd4385d0e40f6def
|
4
|
+
data.tar.gz: a1e1755f4a78d542db97fb36c9ba94f77b877018e9288437373293d49384fbe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
data/lib/crd_parser/component.rb
CHANGED
@@ -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
|
-
|
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
|
|