persistence-providers 0.0.1 → 0.0.2
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: a953df0805cd56776854b2ecc2536bd65168a09134cac2a9e19370800e2d08bf
|
4
|
+
data.tar.gz: cd8693b064bcc866ebdbbe870b258da63c4cf26ead0a844d7c6481b63f64dd37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a13cae6f9c26a52e2408e5c7f630ea85a2aab48da505b8ff35a89966a3004103ecf815bd37e618f61532e758f5576359e1a8074fe29be0010ed7e0c0a1a307b
|
7
|
+
data.tar.gz: 9059eeec1a431c6460e820afa1be83ee5a365b8df82980c528dd0397ca716d96571b4d92d0d0dd486ba4a39d3d12eda5763546929cd7341e73c5fa10ca0aee9f
|
@@ -3,6 +3,7 @@ require 'resolv-replace'
|
|
3
3
|
module DTK::State
|
4
4
|
class Component::Attribute::Influxdb
|
5
5
|
class Client
|
6
|
+
INFLUXDB_SECRET_DIR = '/app/influxdb/'
|
6
7
|
def initialize(database)
|
7
8
|
@database = database
|
8
9
|
@connection_parameters = return_connection_parameters
|
@@ -32,12 +33,16 @@ module DTK::State
|
|
32
33
|
private
|
33
34
|
|
34
35
|
def return_connection_parameters
|
35
|
-
|
36
|
-
|
36
|
+
params = {}
|
37
|
+
Dir.children(INFLUXDB_SECRET_DIR).each do |file|
|
38
|
+
if (file == 'username' || file == 'password' || file == 'url')
|
39
|
+
params[file.to_sym] = File.read("#{INFLUXDB_SECRET_DIR}#{file}")
|
40
|
+
end
|
41
|
+
end
|
37
42
|
{
|
38
|
-
url:
|
39
|
-
username:
|
40
|
-
password:
|
43
|
+
url: params[:url],
|
44
|
+
username: params[:username],
|
45
|
+
password: params[:password],
|
41
46
|
time_precision: 'ms'
|
42
47
|
}
|
43
48
|
end
|
@@ -33,7 +33,7 @@ module DTK::State
|
|
33
33
|
# The encode function we allow us to use different mappings of name, params_hash
|
34
34
|
# to the influxdb actual measurement name and tags.
|
35
35
|
influxdb_encoding = influxdb_encoding(params_hash, timestamp)
|
36
|
-
timestamp.nil? ?
|
36
|
+
timestamp = timestamp.nil? ? Time.now : timestamp
|
37
37
|
|
38
38
|
data = {
|
39
39
|
values: { value: value },
|
data/lib/state/crd_component.rb
CHANGED
@@ -26,7 +26,7 @@ module DTK::State
|
|
26
26
|
def self.get_attributes_for(namespace, crd_component_name, components, opts = {})
|
27
27
|
output = {}
|
28
28
|
|
29
|
-
crd_component = get(namespace, crd_component_name)
|
29
|
+
crd_component = get(namespace, crd_component_name, opts)
|
30
30
|
crd_components = crd_component.components
|
31
31
|
|
32
32
|
if components == 'all'
|
@@ -42,7 +42,7 @@ module DTK::State
|
|
42
42
|
check_for_missing_components(crd_components, components)
|
43
43
|
components.each do |component_name|
|
44
44
|
matching_component = crd_components.find{ |cmp| cmp.to_hash.keys.first == component_name }
|
45
|
-
component = Component.new(component_name, matching_component, crd_component, opts)
|
45
|
+
component = Component.new(component_name, matching_component[component_name], crd_component, opts)
|
46
46
|
output.merge!(component_name => component.attributes(opts))
|
47
47
|
end
|
48
48
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kubeclient
|