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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 457778db31cd7a5a4f02ffa77800a84db23db015
4
- data.tar.gz: c816cf244a6dbe69476701fc0d4bc535a171f04b
3
+ metadata.gz: 67b238516159dbc557c0f028f1ed64309d58662a
4
+ data.tar.gz: f434c79cde6fbf9687145894cace532a177dd17d
5
5
  SHA512:
6
- metadata.gz: 20ba1b125177932546f88f9dab29a04c042194f2ea98e2ba092fb30824649ad25b60de4ce1a1f3740ebfb5e217f933a2cfed3ae78daadb4700f21a4020cb3aaf
7
- data.tar.gz: 82baa75051114666b65f57c025c9747d80903b1b11fb087251e50dd88cbd2621a90a3472b72b789a91ce5d8847c18c36c66ab6baca4ef3a5e148dd014d1f0e09
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)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "hiera-mysql-backend"
5
- gem.version = "0.0.5"
5
+ gem.version = "0.0.6"
6
6
  gem.authors = ["Telmo"]
7
7
  gem.email = ["telmox@gmail.com"]
8
8
  gem.description = %q{Alternative MySQL backend for hiera}
@@ -34,11 +34,12 @@ class Hiera
34
34
  YAML.load(datafile)
35
35
  end
36
36
 
37
- mysql_host = data.fetch(:dbconfig, {}).fetch(:host, nil) || Config[:mysql2][:host]
38
- mysql_user = data.fetch(:dbconfig, {}).fetch(:user, nil) || Config[:mysql2][:user]
39
- mysql_pass = data.fetch(:dbconfig, {}).fetch(:pass, nil) || Config[:mysql2][:pass]
40
- mysql_port = data.fetch(:dbconfig, {}).fetch(:port, nil) || Config[:mysql2][:port]
41
- mysql_database = data.fetch(:dbconfig, {}).fetch(:database, nil) || Config[:mysql2][:database]
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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-mysql-backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Telmo