hiera-mock 0.1.3 → 0.2.0

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: 05a6a637e930b9c43ee82968ef117085f0e15c3f
4
- data.tar.gz: 72d8f961bcd2466fa4376fcc72591bf2bcccd46c
3
+ metadata.gz: 8ef9399dff5ba4905c4e236a6903123d445ec97b
4
+ data.tar.gz: e59bc509e846b5960341bba319d2a416da2d40d8
5
5
  SHA512:
6
- metadata.gz: 6b1d41e9ceb41abd712b4ae5aea243a65bb79e2c8317af4f2c5dfac7a4710361d94a28a6964148ed293685c1357953832f6c0e5c69b725c1289d6f663d72019c
7
- data.tar.gz: bb524dd36907384abeb765d645ef84bc7e72efdba7cafbccf38d968e1a4163457b31ced98cb3ea211268d807501ceacd08b0765393e6b85f4b28beae61479177
6
+ metadata.gz: 1f568c9b1e3424175f5dff2d418cd3069898e008209adefc4233634b0aa4c323135122c0783a1f9e0b92e63ed957bdd29681da05a810e89a762ae5f69cd6c8f3
7
+ data.tar.gz: 7b51ddfa5b8fa60965d49d151ffd3408d515ff740f5307a696424514bd549db987256e3dddd6734148c00a38d5a7fd4878b811219cf70b8b98f5c15d14ede78b
@@ -1,3 +1,4 @@
1
+ require 'digest/md5'
1
2
  class Hiera
2
3
  module Backend
3
4
  class Mock_backend
@@ -12,6 +13,7 @@ class Hiera
12
13
  @data = YAML.load(File.read(datafile))
13
14
  end
14
15
 
16
+ @deterministic = Config[:mock][:deterministic]
15
17
  @data ||= {}
16
18
 
17
19
  Hiera.debug("hiera mock initialized")
@@ -23,6 +25,10 @@ class Hiera
23
25
 
24
26
  Hiera.debug("Couldn't find '#{key}' -- making up random data...")
25
27
 
28
+ if(@deterministic)
29
+ srand(Digest::MD5.hexdigest(key)[0..8].to_i(16))
30
+ end
31
+
26
32
  case resolution_type
27
33
  when :array
28
34
  return random_array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jo Vandeginste
@@ -9,10 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-24 00:00:00.000000000 Z
12
+ date: 2017-04-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: |
15
- Hiera backend to return data from a single yaml file or random data (meant for testing purposes)
14
+ description: 'Hiera backend to return data from a single yaml file or random data
15
+ (meant for testing purposes)
16
+
17
+ '
16
18
  email:
17
19
  - jo.vandeginste@kuleuven.be
18
20
  - tom.leuse@kuleuven.be
@@ -41,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
43
  version: '0'
42
44
  requirements: []
43
45
  rubyforge_project:
44
- rubygems_version: 2.4.5
46
+ rubygems_version: 2.6.11
45
47
  signing_key:
46
48
  specification_version: 4
47
49
  summary: Hiera backend to return data from a single yaml file or random data (meant