dtk_crd_parser 0.0.31 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crd_parser/action.rb +21 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33ac8fea9f55bc708016ff38659ce404d387e7f87da921a45eed82b49f6ea940
|
4
|
+
data.tar.gz: b38d4c1ec9721ff06afd5ad927887367aa275ddc6ea85be4cad099ac38280b94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b90c9880f97264aee97b9f8128ebe6220dd8921f021f34952f45bd4feb415f6a1aa5274d189ad906c626533cdc8b7e9c9f50388928c1f1799fe90ab089b865c
|
7
|
+
data.tar.gz: 5ce5c6993501a0e497a0d21d1717e39f44f8b050e323d086285c6c35778a7c8d4d9e470c09d5f156372803c03cd04ff3660482e114eee8ae7daaeee1064daf7b
|
data/lib/crd_parser/action.rb
CHANGED
@@ -2,20 +2,16 @@ module DTK::CrdParser
|
|
2
2
|
class Action < BaseClass
|
3
3
|
|
4
4
|
def initialize(name, id, component)
|
5
|
-
|
6
|
-
|
7
|
-
@name = name #
|
8
|
-
@component = component #this wil point to the corresponding component
|
5
|
+
@name = name #
|
6
|
+
@component = component #this wil point to the corresponding component
|
9
7
|
@id = id #action subtask id
|
10
8
|
end
|
11
9
|
|
12
10
|
def self.create_from_kube(client, component_instance, action_instance)
|
13
|
-
Logger.new('/proc/1/fd/1').info "GET ACTION"
|
14
11
|
action_obj = client.get_action(action_instance[:name], action_instance[:namespace])
|
15
|
-
Logger.new('/proc/1/fd/1').info
|
16
|
-
Logger.new('/proc/1/fd/1').info action_instance[:id].to_sym
|
12
|
+
Logger.new('/proc/1/fd/1').info "FIND ACTION"
|
17
13
|
|
18
|
-
component_name = action_obj[:spec][:action][:
|
14
|
+
component_name = find_action(action_instance[:id], action_obj[:spec][:action])[:name]
|
19
15
|
Logger.new('/proc/1/fd/1').info component_name
|
20
16
|
|
21
17
|
component = Component.create_from_kube(client, component_instance, component_name)
|
@@ -26,6 +22,23 @@ module DTK::CrdParser
|
|
26
22
|
|
27
23
|
protected
|
28
24
|
|
25
|
+
@action = nil
|
26
|
+
def find_action(id, actionObject)
|
27
|
+
return @action if @actionExists
|
28
|
+
iterator = 0
|
29
|
+
while (!@actionExists && iterator < actionObject[:subtasks].length)
|
30
|
+
@action = actionObject[:subtasks][iterator]
|
31
|
+
Logger.new('/proc/1/fd/1').info @action
|
32
|
+
|
33
|
+
if @action.id.to_s == id.to_s
|
34
|
+
@actionExists = true
|
35
|
+
return @action
|
36
|
+
elsif @action[:subtasks]
|
37
|
+
return find_action(id, @action)
|
38
|
+
end
|
39
|
+
iterator+=1
|
40
|
+
end
|
41
|
+
end
|
29
42
|
attr_reader :name, :component, :id
|
30
43
|
|
31
44
|
end
|