dtk_crd_parser 0.0.119 → 0.0.120

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: '09f76186279f724068a8af9cc40ea26911f9ec21f2693e6d4832f182054826c3'
4
- data.tar.gz: 02b20b98f5e8fba5896a0340d9a11d30e7238f7100eb599cb5714b4901c7c5d5
3
+ metadata.gz: 3e640e4368d77e243f6ac3a6708bd973ee577ee776c6b696463eedab261c7a58
4
+ data.tar.gz: bfcc94d9e7109279d9cf9bdd36c0e33630ae0dfd26c08e327312ed4f161e1974
5
5
  SHA512:
6
- metadata.gz: 235167ca40dc072d872e186b97abdd339845d538e33616cac5dddd1f0890d5758f6f6bec3ae1a3e77c795494f3489f593e074f150dd933c632501ac351c442f2
7
- data.tar.gz: 4f1275153aeff5045bba2dbe8d7f6324cd59e7ed7f26ad330f525c799dcc6f9f27e5587f38fbd6c670daaff835f3a0195a22ff209b5cdb73a0dfc613d66f7609
6
+ metadata.gz: 6fb83a5e7fc5a0b4ddc85d0a47273f299a5894327734ef9e61e5d7bbe0ce63ab810668bd8c82c8342facbe4dfc21e1b5d1fc61ea3325adbb5921f0227145634e
7
+ data.tar.gz: 5d7a6885f15dd4776d51dcfd6fdf11319d2ae00db076b9dc8ddb982b08bc0b8cbf58ddafa73df261c299c904347dbe7781ec9056b8d33237aa3feb385d9c97c3
@@ -3,6 +3,26 @@ module DTK::CrdParser
3
3
  module Helper
4
4
  module ClassAndInstanceMixin
5
5
  # Helper functions want to have available in all classes
6
+
7
+ def self.destructureActionComponent(actionComponent)
8
+ # regex to match component: module::name[attrName].action
9
+ regex = /(.*)::(.*)\[(.*)\].?(.*)/
10
+ # if component on node group node, get full name first
11
+ # i.e ec2::node[ng-1]/(node-utility::ssh-access[ubuntu])
12
+ nodeName, actionComponent = actionComponent.match(/(.*)\/(.*)/).captures if isOnSpecificNode(actionComponent)
13
+ compModule, compName, attributeName, action = actionComponent.match(regex).captures if actionComponent.match(regex)
14
+ action = (action && !action.empty?) ? action.to_sym : nil
15
+
16
+ if(compModule.nil? || compName.nil? || attributeName.nil?)
17
+ raise "Could not resolve component module, name or attribute name for component: #{actionComponent}"
18
+ end
19
+ {
20
+ moduleName: compModule,
21
+ componentName: compName,
22
+ attributeName: attributeName,
23
+ action: action
24
+ }
25
+ end
6
26
 
7
27
  def fail_if_nil(value, property_name)
8
28
  fail Error::Usage, "Property #{property_name} should not be nil" unless value
@@ -19,8 +19,10 @@ module DTK::CrdParser
19
19
  component_instance_obj = client.get_component(component_instance[:name], component_instance[:namespace])
20
20
  component_def = ComponentDef.create_from_kube(client, component_instance_obj, component_name)
21
21
  component_attributes = getComponentAttributes(component_name, component_instance_obj[:spec][:components])
22
- component_attributes
22
+ name_value = self.destructureActionComponent(component_name)[:attributeName]
23
+ Logger.new('/proc/1/fd/1').info "Name value: #{name_value}"
23
24
  attributes = []
25
+ attributes.push(Attribute.create_from_kube("name", name_value))
24
26
  if component_attributes
25
27
  (component_attributes.to_hash || []).each do |attribute_name, attribute_value|
26
28
  attribute_type_info = (component_def.attribute_type_info
@@ -64,25 +64,6 @@ module DTK::CrdParser
64
64
  actionComponent.include? "/"
65
65
  end
66
66
 
67
- def self.destructureActionComponent(actionComponent)
68
- # regex to match component: module::name[attrName].action
69
- regex = /(.*)::(.*)\[(.*)\].?(.*)/
70
- # if component on node group node, get full name first
71
- # i.e ec2::node[ng-1]/(node-utility::ssh-access[ubuntu])
72
- nodeName, actionComponent = actionComponent.match(/(.*)\/(.*)/).captures if isOnSpecificNode(actionComponent)
73
- compModule, compName, attributeName, action = actionComponent.match(regex).captures if actionComponent.match(regex)
74
- action = (action && !action.empty?) ? action.to_sym : nil
75
-
76
- if(compModule.nil? || compName.nil? || attributeName.nil?)
77
- raise "Could not resolve component module, name or attribute name for component: #{actionComponent}"
78
- end
79
- {
80
- moduleName: compModule,
81
- componentName: compName,
82
- attributeName: attributeName,
83
- action: action
84
- }
85
- end
86
67
  protected
87
68
  def self.metadata(componentDef)
88
69
  componentDef[:metadata]
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.119
4
+ version: 0.0.120
5
5
  platform: ruby
6
6
  authors:
7
7
  - DTK