hiera-mysql-backend 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/hiera-mysql-backend.gemspec +1 -1
- data/lib/hiera/backend/mysql2_backend.rb +6 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67b238516159dbc557c0f028f1ed64309d58662a
|
4
|
+
data.tar.gz: f434c79cde6fbf9687145894cace532a177dd17d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34396bca064fdf98a4d8748e5a629742001342ad9c613a72e826c7936f938dcf96945e9dcb90604f09fc9d0bae83f2399d7b538e39bc7591b677fc8f2ff4273f
|
7
|
+
data.tar.gz: 1e221ab27a654fbebc50b02088ed5a8b2fce1af2c81f7fdb98108cb784160c4be4cda5666e1e2288727dd88522638a75de5e2eb345c21c166e3c9d16c8e7f4fc
|
data/README.md
CHANGED
@@ -32,11 +32,16 @@ Lets assume your _datadir_ is `/etc/puppet/hieradata/` and your hierarchy for hi
|
|
32
32
|
:user: hieratest
|
33
33
|
:pass: sekret
|
34
34
|
:database: testhieradb
|
35
|
+
:port: 44445
|
35
36
|
|
36
37
|
applications: SELECT * FROM applications WHERE host='%{fqdn}';
|
37
38
|
coats: SELECT cut,name,type FROM coats WHERE color='brown';
|
38
39
|
```
|
39
40
|
|
41
|
+
If `host` is not defined it will use `localhost` as default.
|
42
|
+
|
43
|
+
If `port` is not defined it will use the default `3306` mysql port
|
44
|
+
|
40
45
|
running `hiera applications` would run the query against the configured database.
|
41
46
|
|
42
47
|
|
@@ -64,6 +69,7 @@ Hiera configuration is pretty simple
|
|
64
69
|
:user: username
|
65
70
|
:pass: password
|
66
71
|
:database: database
|
72
|
+
:port: 3306
|
67
73
|
|
68
74
|
:hierarchy:
|
69
75
|
- "%{::clientcert}"
|
@@ -73,6 +79,10 @@ Hiera configuration is pretty simple
|
|
73
79
|
:logger: console
|
74
80
|
```
|
75
81
|
|
82
|
+
If `host` is not defined it will use `localhost` as default.
|
83
|
+
|
84
|
+
If `port` is not defined it will use the default `3306` mysql port
|
85
|
+
|
76
86
|
## Known issues
|
77
87
|
|
78
88
|
1. It always return an Array of hashes regardless of the number of items returned. (I did this on purpose because it is what I needed but I may be persuaded to do otherwise)
|
data/hiera-mysql-backend.gemspec
CHANGED
@@ -34,11 +34,12 @@ class Hiera
|
|
34
34
|
YAML.load(datafile)
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
mysql_config = data.fetch(:dbconfig, {})
|
38
|
+
mysql_host = mysql_config.fetch(:host, nil) || Config[:mysql2][:host] || 'localhost'
|
39
|
+
mysql_user = mysql_config.fetch(:user, nil) || Config[:mysql2][:user]
|
40
|
+
mysql_pass = mysql_config.fetch(:pass, nil) || Config[:mysql2][:pass]
|
41
|
+
mysql_port = mysql_config.fetch(:port, nil) || Config[:mysql2][:port] || '3306'
|
42
|
+
mysql_database = mysql_config.fetch(:database, nil) || Config[:mysql2][:database]
|
42
43
|
|
43
44
|
connection_hash = {
|
44
45
|
:host => mysql_host,
|