dtk_crd_parser 0.0.7 → 0.0.8

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: 5d0309ac23e6ca4847904b53f7d860762c37a8f94a4565397ec4531f774e8c51
4
- data.tar.gz: 91020989ee1a4aec74da301e3dbd219c64e2693e8c5978c3c3aa6b5a8f848e57
3
+ metadata.gz: 40f46b80f3129571814edba062020aae105a08c81392b6e9750bb5226fa5e825
4
+ data.tar.gz: f6631ba731f2ce8a197b10090744bacb4d40710197c08d2d6fc6a32068037325
5
5
  SHA512:
6
- metadata.gz: f1e594d92d800cf134186e8baaadd83e98be2b38759611aba02d88e2698749cb7a59a5de0e2273db05bbfd4ed88fed16c8a7c9524ef77f6e6dcf315a92d0d543
7
- data.tar.gz: f7dab823bc516c2f593275fd1be8b19c3c7dcbe4b98c829a124f5a5e1b62bcbb6508f090903890590e2f6660559aa81acc68b1d34cb76ff2582af86d7dbbae0f
6
+ metadata.gz: 42f25b2597121d3afbc40aa3a8f94708dd4cd2541bc587ba4864001916688253f873eba992905d0384f77714a60c91367e379f299310faf0cfe0baad8bfcbe25
7
+ data.tar.gz: 329cb709c46b15158fdd768e34aa9e8608673d0ed1c707c34afd8ecb2e43303c429a938ca2a4dac93721dbeb5fb73f3f86be91fdf49aaff200e9cede9f8e390d
data/lib/crd_parser.rb CHANGED
@@ -9,7 +9,10 @@ module DTK
9
9
  #component instance has a name and a namespace
10
10
  #client is kube client
11
11
  #component name is, for example, network-aws::vpc[vpc1]
12
- Component.create_from_kube(client, component_instance, component_name)
12
+ puts 'Parsing crd...'
13
+ comp = Component.create_from_kube(client, component_instance, component_name)
14
+ puts comp
15
+ comp
13
16
  end
14
17
  end
15
18
  end
@@ -35,7 +35,7 @@ module DTK::CrdParser
35
35
  compModule, compName, attributeName, action = actionComponent.match(regex).captures if actionComponent.match(regex)
36
36
  action = (action && !action.empty?) ? action.to_sym : :create
37
37
  if(compModule.nil? || compName.nil? || attributeName.nil?)
38
- raise `Could not resolve component module, name or attribute name for component: #{actionComponent}`
38
+ raise "Could not resolve component module, name or attribute name for component: #{actionComponent}"
39
39
  end
40
40
  {
41
41
  moduleName: compModule,
@@ -10,19 +10,27 @@ module DTK::CrdParser
10
10
  end
11
11
 
12
12
  def self.create_from_kube(client, component_instance, component_name)
13
+ puts 'Component instance object :'
13
14
  component_instance_obj = client.get_component(component_instance[:name], component_instance[:namespace])
15
+ puts component_instance_obj
14
16
  component_def = ComponentDef.create_from_kube(client, component_instance_obj, component_name)
17
+ puts 'Component def:'
18
+ puts component_def
15
19
  component_attributes = getComponentAttributes(component_name, component_instance_obj[:spec][:components])
20
+ puts component_attributes
16
21
  attributes = []
17
22
  component_attributes.each do |attr|
18
23
  attributes.push Attribute.create_from_kube(attr)
19
24
  end
25
+ puts 'Attributes are:'
26
+ puts attributes
20
27
  Component.new(component_name, component_def, attributes)
21
28
  end
22
29
 
23
30
  protected
24
31
 
25
32
  def self.getComponentAttributes(fullComponentName, components)
33
+ puts 'Get component attributes'
26
34
  fullComponentName.gsub!('_', '-')
27
35
  component = components.each do |component|
28
36
  componentObj = component[fullComponentName]
@@ -63,17 +63,12 @@ module DTK::CrdParser
63
63
  regex = /(.*)::(.*)\[(.*)\].?(.*)/
64
64
  # if component on node group node, get full name first
65
65
  # i.e ec2::node[ng-1]/(node-utility::ssh-access[ubuntu])
66
- puts 'Action component is: '
67
- puts actionComponent
68
- puts isOnSpecificNode(actionComponent)
69
66
  nodeName, actionComponent = actionComponent.match(/(.*)\/(.*)/).captures if isOnSpecificNode(actionComponent)
70
- puts 'captures: '
71
- puts actionComponent.match(regex)
72
67
  compModule, compName, attributeName, action = actionComponent.match(regex).captures if actionComponent.match(regex)
73
68
  action = (action && !action.empty?) ? action.to_sym : :create
74
69
 
75
70
  if(compModule.nil? || compName.nil? || attributeName.nil?)
76
- raise `Could not resolve component module, name or attribute name for component: #{actionComponent}`
71
+ raise "Could not resolve component module, name or attribute name for component: #{actionComponent}"
77
72
  end
78
73
  {
79
74
  moduleName: compModule,
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - DTK