dtk_crd_parser 0.0.31 → 0.0.32

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/crd_parser/action.rb +21 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 971db1e5d81997692d802e342b10ed199cde68c65820812b7b8bb19f8ced4399
4
- data.tar.gz: 8c4395a709959067d939555c4796f76e15531ffe454a2f2bbacaab7025765a65
3
+ metadata.gz: 33ac8fea9f55bc708016ff38659ce404d387e7f87da921a45eed82b49f6ea940
4
+ data.tar.gz: b38d4c1ec9721ff06afd5ad927887367aa275ddc6ea85be4cad099ac38280b94
5
5
  SHA512:
6
- metadata.gz: 124a41517b031495cdf09c4c6713d8e68d91fab34317dd775c590e332355cf0903e59295b47dc08fbb4c04a0d513c732d2a128daa1f159faf314a1a709a972c1
7
- data.tar.gz: 491929946a777669367736e7296093b4478086d02de22c84e50339494897e510ba7be1aa175e4af66fc7c0971a6aa81d7371415adc8bf59d6456b3c32f96e193
6
+ metadata.gz: 2b90c9880f97264aee97b9f8128ebe6220dd8921f021f34952f45bd4feb415f6a1aa5274d189ad906c626533cdc8b7e9c9f50388928c1f1799fe90ab089b865c
7
+ data.tar.gz: 5ce5c6993501a0e497a0d21d1717e39f44f8b050e323d086285c6c35778a7c8d4d9e470c09d5f156372803c03cd04ff3660482e114eee8ae7daaeee1064daf7b
@@ -2,20 +2,16 @@ module DTK::CrdParser
2
2
  class Action < BaseClass
3
3
 
4
4
  def initialize(name, id, component)
5
- Logger.new('/proc/1/fd/1').info "INITIALIZE"
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 action_instance[:id]
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][:subtasks][action_instance[:id].to_sym]
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
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.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - DTK