persistence-providers 0.0.2.3 → 0.0.2.4
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 +4 -4
- data/lib/persistence_providers.rb +1 -0
- data/lib/state/component.rb +8 -8
- data/lib/state/crd_component.rb +3 -3
- data/lib/state/workflow_instance.rb +27 -0
- data/persistence-providers.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660dab58980e91237fcf7f0d6ce5bb54a7ce6dd7e9fa3cebc7863a7313007bba
|
4
|
+
data.tar.gz: 2c88433473a7bcf024a18819d8027f2ff21dfabb3ccb98db5093ed42f7e6747d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0081a8eb82ab1c9aa999c8dbf34ac4b54835e712f51a9bcc8ba7d2b17579f6334b9bb25f0faf1d9831c7bc551367f6dfd9f87c4cdfe8eec6f5af137204ec95d0'
|
7
|
+
data.tar.gz: 772e78be6305a28ff88719dbd9bc8d4d40c5f7a20687cfe87c2a983e01399760715e805532487c84a76099d64b633d5626fe8fd67845db0bfba7f2f0297052da
|
data/lib/state/component.rb
CHANGED
@@ -2,12 +2,12 @@ module DTK::State
|
|
2
2
|
class Component
|
3
3
|
require_relative 'component/attribute'
|
4
4
|
|
5
|
-
attr_reader :name, :parent, :
|
5
|
+
attr_reader :name, :parent, :component_def
|
6
6
|
|
7
7
|
def initialize(name, component_content, parent, opts = {})
|
8
8
|
@name = name
|
9
9
|
# @parent = parent
|
10
|
-
@
|
10
|
+
@component_defs = parent.references.component_def
|
11
11
|
@component_def = get_component_def(opts)
|
12
12
|
|
13
13
|
@attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes])# convert_to_attribute_objects(component_content[:attributes])
|
@@ -56,16 +56,16 @@ module DTK::State
|
|
56
56
|
|
57
57
|
def get_component_def(opts = {})
|
58
58
|
destructured_component = destructure_component_full_name
|
59
|
-
|
60
|
-
|
59
|
+
component_def = @component_defs.find { |component_def| component_def[:name] == destructured_component[:component_def_name] }
|
60
|
+
# module_ref = @module_refs.find { |module_ref| module_ref[:name] == destructured_component[:module_name] }
|
61
|
+
ComponentDef.get(component_def[:namespace], destructured_component[:component_def_name], opts)
|
61
62
|
end
|
62
63
|
|
63
64
|
def destructure_component_full_name
|
64
|
-
regex = /(.*)
|
65
|
-
|
65
|
+
regex = /(.*)\[(.*)\]/
|
66
|
+
component_def_name, component_name = @name.match(regex).captures
|
66
67
|
{
|
67
|
-
|
68
|
-
component_def_name: "#{module_name}-#{component_def_name}",
|
68
|
+
component_def_name: "#{component_def_name}",
|
69
69
|
component_name: component_name
|
70
70
|
}
|
71
71
|
end
|
data/lib/state/crd_component.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module DTK::State
|
2
2
|
class CrdComponent
|
3
|
-
attr_reader :name, :namespace, :crd_content, :components, :
|
3
|
+
attr_reader :name, :namespace, :crd_content, :components, :references
|
4
4
|
|
5
5
|
def initialize(namespace, name, crd_content)
|
6
6
|
@name = name
|
7
7
|
@namespace = namespace
|
8
8
|
@crd_content = crd_content
|
9
|
+
@references = crd_content.references
|
9
10
|
@components = crd_content[:spec][:components]
|
10
|
-
@module_refs = crd_content[:references][:module_refs]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.get(namespace, name, opts = {})
|
14
14
|
# crd_component = ::DTK::CrdClient.instance.kubeclient.get_component(name, namespace)
|
15
|
-
crd_component = ::DTK::CrdClient.get_kubeclient(opts).
|
15
|
+
crd_component = ::DTK::CrdClient.get_kubeclient(opts).get_assembly(name, namespace)
|
16
16
|
CrdComponent.new(namespace, name, crd_component)
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module DTK::State
|
2
|
+
class WorkflowInstance
|
3
|
+
attr_reader :name, :namespace, :assembly, :workflow_template, :attributes, :workflow
|
4
|
+
|
5
|
+
def initialize(namespace, name, crd_content)
|
6
|
+
@name = name
|
7
|
+
@namespace = namespace
|
8
|
+
# @crd_content = crd_content
|
9
|
+
# @references = crd_content.references
|
10
|
+
@assembly = crd_content.references.assembly
|
11
|
+
@workflow_template = crd_content.references.workflow
|
12
|
+
@attributes = crd_content.spec.attributes
|
13
|
+
@workflow = crd_content.spec.workflow
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.get(namespace, name, opts = {})
|
17
|
+
workflow_instance = ::DTK::CrdClient.get_kubeclient(opts).get_workflow_instance(name, namespace)
|
18
|
+
WorkflowInstance.new(namespace, name, workflow_instance)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_attributes(namespace, name, opts = {})
|
22
|
+
workflow_instance = get(namespace, name, opts)
|
23
|
+
# workflow_instance.attributes.to_h
|
24
|
+
workflow_instance.attributes.map{ |attr| attr.to_hash }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistence-providers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kubeclient
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/state/component_def/attribute_type_info.rb
|
76
76
|
- lib/state/crd_component.rb
|
77
77
|
- lib/state/executable_action.rb
|
78
|
+
- lib/state/workflow_instance.rb
|
78
79
|
- persistence-providers.gemspec
|
79
80
|
- test-destroy-influxdb.rb
|
80
81
|
- test-influxdb.rb
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
|
-
rubygems_version: 3.0.
|
102
|
+
rubygems_version: 3.0.6
|
102
103
|
signing_key:
|
103
104
|
specification_version: 4
|
104
105
|
summary: Persistence providers plugin
|