persistence-providers 0.0.3 → 0.0.3.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ac2828e10383c9590347d210c09ffd97640c80794cc0078290de10d8010685c
|
4
|
+
data.tar.gz: ef1e7376786ed2c13d7e2457351185285f385c1d99818ead0c5171d921d094e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d13cb086750ea5407ad6c9e932672031adbb9aee66c85d15043bd0af770ddeb6e605acf721d3bea50f534198cdd6ac58d95ff6313bf796e75751b3616b4f55ae
|
7
|
+
data.tar.gz: 61c45ed7d35a5f68beab292ee7f4830298b58060b83dc29e145340352195cb82095812c778a9df36c51f20356f1a0b6ce767f26168ff5138cd9ff20c389875d0
|
data/lib/state/component.rb
CHANGED
@@ -10,7 +10,7 @@ module DTK::State
|
|
10
10
|
@component_defs = parent.references.component_def
|
11
11
|
@component_def = get_component_def(opts)
|
12
12
|
|
13
|
-
@attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes])# convert_to_attribute_objects(component_content[:attributes])
|
13
|
+
@attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes] || {})# convert_to_attribute_objects(component_content[:attributes])
|
14
14
|
end
|
15
15
|
|
16
16
|
# opts can have keys
|
data/lib/state/component_def.rb
CHANGED
@@ -9,7 +9,7 @@ module DTK::State
|
|
9
9
|
@namespace = namespace
|
10
10
|
@executable_actions = content[:spec][:actions]
|
11
11
|
# @attributes = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes])
|
12
|
-
@attribute_type_info = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes])
|
12
|
+
@attribute_type_info = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes] || [])
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.get(namespace, name, opts = {})
|
@@ -1,16 +1,17 @@
|
|
1
1
|
module DTK::State
|
2
2
|
class WorkflowInstance
|
3
|
-
|
3
|
+
require_relative 'workflow_instance/attribute_type_info'
|
4
|
+
|
5
|
+
attr_reader :name, :namespace, :assembly, :workflow_template, :attributes, :workflow, :attribute_type_info
|
4
6
|
|
5
7
|
def initialize(namespace, name, crd_content)
|
6
8
|
@name = name
|
7
9
|
@namespace = namespace
|
8
|
-
# @crd_content = crd_content
|
9
|
-
# @references = crd_content.references
|
10
10
|
@assembly = crd_content.references.assembly
|
11
11
|
@workflow_template = crd_content.references.workflow
|
12
12
|
@attributes = crd_content.spec.attributes
|
13
13
|
@workflow = crd_content.spec.workflow
|
14
|
+
@attribute_type_info = AttributeTypeInfo.create_from_kube_obj(@attributes.to_h || {})
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.get(namespace, name, opts = {})
|
@@ -20,8 +21,7 @@ module DTK::State
|
|
20
21
|
|
21
22
|
def self.get_attributes(namespace, name, opts = {})
|
22
23
|
workflow_instance = get(namespace, name, opts)
|
23
|
-
|
24
|
-
workflow_instance.attributes.map{ |attr| attr.to_hash }
|
24
|
+
workflow_instance.attributes.to_h
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module DTK::State
|
3
|
+
class WorkflowInstance
|
4
|
+
class AttributeTypeInfo
|
5
|
+
|
6
|
+
attr_reader :name, :type, :value, :required, :dynamic, :encrypted, :temporal
|
7
|
+
|
8
|
+
def initialize(name, params)
|
9
|
+
@name = name.to_s
|
10
|
+
@type = params[:type]
|
11
|
+
@value = params[:value] || nil
|
12
|
+
@required = params[:required] || false
|
13
|
+
@dynamic = params[:dynamic] || false
|
14
|
+
@temporal = params[:temporal] || false
|
15
|
+
@encrypted = params[:encrypted] || false
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.create_from_kube_obj(kube_attributes)
|
19
|
+
attributes = []
|
20
|
+
kube_attributes.each do |name, content|
|
21
|
+
attributes.push(AttributeTypeInfo.new(name, content))
|
22
|
+
end
|
23
|
+
attributes
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
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.3
|
4
|
+
version: 0.0.3.1
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kubeclient
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/state/crd_component.rb
|
77
77
|
- lib/state/executable_action.rb
|
78
78
|
- lib/state/workflow_instance.rb
|
79
|
+
- lib/state/workflow_instance/attribute_type_info.rb
|
79
80
|
- persistence-providers.gemspec
|
80
81
|
- test-destroy-influxdb.rb
|
81
82
|
- test-influxdb.rb
|