hiera-mysql-json-backend 2.0.0 → 2.2.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8a1886efe7ccceb511cc7e6e478badcf22bc7e99ae84cf146953cc4c4a8578fa
|
4
|
+
data.tar.gz: e684e16256fae20776ed08e0d0b4ba5bd44be8c29a305bd193a05031c66798f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49f9b84e47ad2fcea9303835988658600311674940adc79e1babb1027900771b939a035222c984d8911db34f246dde10d39b00b07b28074ad112a9234c29b168
|
7
|
+
data.tar.gz: ca802b9dea41bf44a7319200b2aef8c63bd6215b445b7b90096093f2ab84e4cb3ed6aa5a890fb8d6833ce7c353f7ed06bcab0a59cda05a08702138243d3c6e43
|
data/CHANGELOG.md
CHANGED
@@ -20,3 +20,11 @@
|
|
20
20
|
|
21
21
|
- If we cannot parse JSON as json, do something nasty to try if the value is a
|
22
22
|
boolean
|
23
|
+
|
24
|
+
### 2.1.0
|
25
|
+
|
26
|
+
- Host/domain constraints can now be defined per hierarchy file instead of being global only
|
27
|
+
|
28
|
+
### 2.2.0
|
29
|
+
|
30
|
+
- Proper connection closing and previous patches
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "hiera-mysql-json-backend-jruby"
|
5
|
-
gem.version = "2.
|
5
|
+
gem.version = "2.2.0"
|
6
6
|
gem.authors = ["Hostnet"]
|
7
7
|
gem.email = ["opensource@hostnet.nl"]
|
8
8
|
gem.description = %q{Alternative MySQL backend with json support for hiera}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "hiera-mysql-json-backend"
|
5
|
-
gem.version = "2.
|
5
|
+
gem.version = "2.2.0"
|
6
6
|
gem.authors = ["Hostnet"]
|
7
7
|
gem.email = ["opensource@hostnet.nl"]
|
8
8
|
gem.description = %q{Alternative MySQL backend with json support for hiera}
|
@@ -66,6 +66,9 @@ class Hiera
|
|
66
66
|
mysql_pass = mysql_config.fetch(:pass, nil) || Config[:mysql_json][:pass]
|
67
67
|
mysql_port = mysql_config.fetch(:port, nil) || Config[:mysql_json][:port] || '3306'
|
68
68
|
mysql_database = mysql_config.fetch(:database, nil) || Config[:mysql_json][:database]
|
69
|
+
lookup_constraints = data.fetch(:only_for, nil) || Config[:mysql_json][:only_for] || {}
|
70
|
+
|
71
|
+
next unless should_lookup?(lookup_constraints, scope)
|
69
72
|
|
70
73
|
connection_hash = {
|
71
74
|
host: mysql_host,
|
@@ -92,23 +95,9 @@ class Hiera
|
|
92
95
|
sqlvalue = sql_results[0]['value']
|
93
96
|
|
94
97
|
begin
|
95
|
-
new_answer = JSON.parse(sqlvalue)
|
98
|
+
new_answer = JSON.parse("{\"r\":#{sqlvalue}}")['r']
|
96
99
|
rescue
|
97
100
|
Hiera.debug("Miserable failure while parsing #{key} as JSON.")
|
98
|
-
end
|
99
|
-
|
100
|
-
if new_answer.nil?
|
101
|
-
case sqlvalue
|
102
|
-
when /^(true|t|yes|y|1)$/i
|
103
|
-
new_answer = true
|
104
|
-
when /^(false|f|no|n|0)$/i
|
105
|
-
new_answer = false
|
106
|
-
else
|
107
|
-
Hiera.debug("Miserable failure while parsing #{key} as boolean.")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
if new_answer.nil?
|
112
101
|
raise Exception, "Parse error for key '#{key}'. Offending data: #{sql_results[0]['value']}." unless Config[:mysql_json][:ignore_json_parse_errors]
|
113
102
|
next
|
114
103
|
end
|
@@ -163,7 +152,9 @@ class Hiera
|
|
163
152
|
end
|
164
153
|
data << row
|
165
154
|
end
|
166
|
-
|
155
|
+
stmt.close
|
156
|
+
conn.close
|
157
|
+
data
|
167
158
|
else
|
168
159
|
client = Mysql2::Client.new(connection_hash)
|
169
160
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera-mysql-json-backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hostnet
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -73,7 +73,7 @@ homepage: https://github.com/hostnet/hiera-mysql-json-backend
|
|
73
73
|
licenses:
|
74
74
|
- MIT
|
75
75
|
metadata: {}
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -88,9 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
|
92
|
-
|
93
|
-
signing_key:
|
91
|
+
rubygems_version: 3.3.27
|
92
|
+
signing_key:
|
94
93
|
specification_version: 4
|
95
94
|
summary: Alternative MySQL backend with json support for hiera
|
96
95
|
test_files: []
|