hiera-simulator 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a409ed848956ad385eaa26c1ca9ceaf758deb132
4
+ data.tar.gz: df0f290c98e20878842060ef1f60ac87d7635ccf
5
+ SHA512:
6
+ metadata.gz: 8fff178d310a6ecb83ca7cb109811003d0f945ebeec248b47489a6be0e2d726690f2fbeb63e162e50cd82131de45e3a9f1379dac29e00723006809ad960c407d
7
+ data.tar.gz: 0b612f1d2de47c239e6bddcc5c4228d3aedc38adfca4b418f90a57d03c388276db7831692f333cbf0adcd759404f8352604c9b64c514d1622a8157126778600d
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.hiera1 ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'hiera', '= 1.3.4'
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hiera-simulator (0.2.1)
5
+ bundler
6
+ deep_merge
7
+ hiera
8
+ httparty
9
+ json
10
+ rake
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ deep_merge (1.0.1)
16
+ diff-lcs (1.2.5)
17
+ hiera (1.3.4)
18
+ json_pure
19
+ httparty (0.13.7)
20
+ json (~> 1.8)
21
+ multi_xml (>= 0.5.2)
22
+ json (1.8.3)
23
+ json_pure (1.8.3)
24
+ multi_xml (0.5.5)
25
+ rake (11.1.2)
26
+ rspec (3.4.0)
27
+ rspec-core (~> 3.4.0)
28
+ rspec-expectations (~> 3.4.0)
29
+ rspec-mocks (~> 3.4.0)
30
+ rspec-core (3.4.4)
31
+ rspec-support (~> 3.4.0)
32
+ rspec-expectations (3.4.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-mocks (3.4.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.4.0)
38
+ rspec-support (3.4.1)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ hiera (= 1.3.4)
45
+ hiera-simulator!
46
+ rspec (>= 3.0.0)
47
+
48
+ BUNDLED WITH
49
+ 1.11.2
data/Gemfile.hiera3 ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'hiera', '= 3.1.1'
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hiera-simulator (0.2.1)
5
+ bundler
6
+ deep_merge
7
+ hiera
8
+ httparty
9
+ json
10
+ rake
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ deep_merge (1.0.1)
16
+ diff-lcs (1.2.5)
17
+ hiera (3.1.1)
18
+ json_pure
19
+ httparty (0.13.7)
20
+ json (~> 1.8)
21
+ multi_xml (>= 0.5.2)
22
+ json (1.8.3)
23
+ json_pure (1.8.3)
24
+ multi_xml (0.5.5)
25
+ rake (11.1.2)
26
+ rspec (3.4.0)
27
+ rspec-core (~> 3.4.0)
28
+ rspec-expectations (~> 3.4.0)
29
+ rspec-mocks (~> 3.4.0)
30
+ rspec-core (3.4.4)
31
+ rspec-support (~> 3.4.0)
32
+ rspec-expectations (3.4.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-mocks (3.4.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.4.0)
38
+ rspec-support (3.4.1)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ hiera (= 3.1.1)
45
+ hiera-simulator!
46
+ rspec (>= 3.0.0)
47
+
48
+ BUNDLED WITH
49
+ 1.11.2
data/Gemfile.lock ADDED
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hiera-simulator (0.2.1)
5
+ bundler
6
+ deep_merge
7
+ hiera
8
+ httparty
9
+ json
10
+ rake
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ deep_merge (1.0.1)
16
+ diff-lcs (1.2.5)
17
+ hiera (1.3.4)
18
+ json_pure
19
+ httparty (0.13.7)
20
+ json (~> 1.8)
21
+ multi_xml (>= 0.5.2)
22
+ json (1.8.3)
23
+ json_pure (1.8.3)
24
+ multi_xml (0.5.5)
25
+ rake (11.1.2)
26
+ rspec (3.4.0)
27
+ rspec-core (~> 3.4.0)
28
+ rspec-expectations (~> 3.4.0)
29
+ rspec-mocks (~> 3.4.0)
30
+ rspec-core (3.4.4)
31
+ rspec-support (~> 3.4.0)
32
+ rspec-expectations (3.4.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-mocks (3.4.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.4.0)
38
+ rspec-support (3.4.1)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ hiera
45
+ hiera-simulator!
46
+ rspec (>= 3.0.0)
47
+
48
+ BUNDLED WITH
49
+ 1.11.2
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Hiera Simulator
2
+
3
+ [![Build Status](https://travis-ci.org/kpaulisse/hiera-simulator.svg?branch=master)](https://travis-ci.org/kpaulisse/hiera-simulator)
4
+
5
+ Pull facts about a node, and then preview Hiera changes there, without touching the node.
6
+
7
+ This is intended for Puppet 3.x and below. In Puppet 4, the [`puppet lookup` command](https://docs.puppetlabs.com/puppet/4.4/reference/man/lookup.html) accomplishes the same thing. If you have Puppet 4, you should be using this built-in tool, and I will too once my Puppet installation gets to version 4.
8
+
9
+ # Why?
10
+
11
+ [Hiera](https://github.com/puppetlabs/hiera) is a critical part of a Puppet implementation, and it is amazingly helpful to separate data from code.
12
+
13
+ The Hiera Simulator simplifies the development process by allowing someone to "preview" Hiera changes without committing to source control, awaiting results from CI tests, or touching any real hosts in the environment. While it's possible to do all this with stock Hiera, that involves copying facts and using less common command line options. Hiera Simulator handles all that for you, and then calls the *actual Hiera code* to do your lookup.
14
+
15
+ # Setup
16
+
17
+ This code is meant to run on a developer's workstation -- perhaps in some cases it's also suitable for your Puppet Master, but it's definitely not intended to be installed everywhere in your environment. Once you've installed the code, you'll have to do a bit of configuration so it knows where to find everything.
18
+
19
+ - [Installation](./docs/installation.md)
20
+ - [Configuration](./docs/configuration.md)
21
+
22
+ Because the version of Hiera to use is set in the Gemfile, you may have to update the Gemfile to match your version. This code is intended to work correctly with both Hiera 1.3.4 and Hiera 3.1. No default version of the Hiera gem is required in the default Gemfile, so if you run Puppet from gems (like we do at my work), it won't conflict.
23
+
24
+ # Usage
25
+
26
+ Type `hiera-simulator --help` for a list of command line options.
27
+
28
+ Here are the important ones:
29
+
30
+ - `-n FQDN`: The FQDN of the host whose facts you want to use. This option is **required** unless you use `--fact-file FILENAME` to provide the facts for you.
31
+
32
+ - `-d`: Turn on Hiera debug mode, which will show you what files were tried until it ultimately came up with your fact.
33
+
34
+ - `--fact-file FILENAME`: Instead of providing a node name and letting Hiera Simulator find the facts for you, load the facts directly from the file you specify. The fact file may be in YAML or JSON format (parsing method depends on file extension).
35
+
36
+ # Troubleshooting
37
+
38
+ - [Troubleshooting](./docs/troubleshooting.md)
39
+
40
+ # Limitations
41
+
42
+ - [Limitations](./docs/limitations.md)
43
+
44
+ # Changelog
45
+
46
+ | Version | Notes |
47
+ |---------|-------|
48
+ | 0.2.1 | Remove PuppetDB hiera backend support, add --[no-]stringify-facts command line option |
49
+ | 0.2.0 | Add support for PuppetDB API v4 |
50
+ | 0.1.0 | Initial release |
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'bundler'
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ task :default do
8
+ Rake::Task['spec'].invoke
9
+ end
10
+
11
+ desc 'Run all hiera-simulator gem specs'
12
+ task :spec do
13
+ exec 'rspec -c spec'
14
+ end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if File.basename(File.dirname(File.absolute_path(__FILE__))) == 'exe'
4
+ require_relative '../lib/hiera-simulator'
5
+ else
6
+ require 'hiera-simulator'
7
+ end
8
+ HieraSimulator::Cli.run
@@ -0,0 +1,2 @@
1
+ raise 'Error: hiera-simulator requires Ruby >= 2.0.0' if RUBY_VERSION < '2.0.0'
2
+ Dir["#{File.dirname(__FILE__)}/hiera-simulator/**/*.rb"].each { |f| require(f) }
@@ -0,0 +1,144 @@
1
+ require 'hiera/version'
2
+ require 'optparse'
3
+ require 'pp'
4
+
5
+ module HieraSimulator
6
+ # Command Line Interface
7
+ class Cli
8
+ # Drive the command line interface - this is called externally
9
+ def self.run(options_in = nil, config_in = {})
10
+ options = options_in.nil? ? parse_options : options_in
11
+ answer = execute(options, config_in)
12
+ exit print_answer(answer, options)
13
+ end
14
+
15
+ # Handle command line interface
16
+ def self.execute(options, config_in)
17
+ config = HieraSimulator::Config.new(config_in)
18
+ command_line_override(options, config)
19
+ config.validate
20
+ facts = HieraSimulator::Facts.facts(config, options[:hostname], options[:stringify_facts])
21
+ raise "No facts found for host #{options[:hostname]}" if facts.empty?
22
+ hiera_options = { resolution_type: options[:resolution_type], verbose: options[:verbose] }
23
+ HieraSimulator::HieraLookup.lookup(options[:key], config, facts, hiera_options)
24
+ end
25
+
26
+ # Print answer
27
+ def self.print_answer(answer, options)
28
+ STDERR.puts "Hiera version = #{Hiera::VERSION}" if options[:verbose]
29
+ if answer.nil?
30
+ puts 'nil'
31
+ return 1
32
+ elsif answer.is_a?(String)
33
+ puts answer
34
+ else
35
+ pp answer
36
+ end
37
+ 0
38
+ end
39
+
40
+ # Overrides from command line
41
+ def self.command_line_override(options, config)
42
+ merges = {}
43
+ [:hiera_yaml_path, :json_datadir, :yaml_datadir, :factdir, :fact_file].each do |key|
44
+ merges[key.to_s] = options[key] if options.key?(key) && !options[key].nil?
45
+ end
46
+ config.merge!(merges) unless merges.empty?
47
+ end
48
+
49
+ # Parse command line options
50
+ # @return [Hash] Parsed (command line) options
51
+ def self.parse_options
52
+ result = {
53
+ verbose: false,
54
+ resolution_type: :priority,
55
+ hostname: nil,
56
+ fact_file: nil,
57
+ stringify_facts: nil,
58
+ }
59
+ OptionParser.new do |opts|
60
+ opts.banner = 'Usage: hiera-simulator -n <Node_FQDN> [options] key'
61
+
62
+ opts.on('--hiera-yaml-path PATH', 'Path to hiera.yaml file') do |path|
63
+ dir = find_dir(File.dirname(path))
64
+ result[:hiera_yaml_path] = File.absolute_path(File.join(dir, File.basename(path)))
65
+ raise Errno::ENOENT, 'The specified hiera.yaml file does not exist' unless File.file?(result[:hiera_yaml_path])
66
+ end
67
+
68
+ opts.on('--yaml-datadir DIR', 'YAML data directory') do |datadir|
69
+ result[:yaml_datadir] = find_dir(datadir)
70
+ end
71
+
72
+ opts.on('--json-datadir DIR', 'JSON data directory') do |datadir|
73
+ result[:json_datadir] = find_dir(datadir)
74
+ end
75
+
76
+ opts.on('-d', '--debug', 'Turn on Hiera debugging/verbose mode') do
77
+ result[:verbose] = true
78
+ end
79
+
80
+ opts.on('--hostname FQDN', '-n', 'Use facts from last run of FQDN') do |fqdn|
81
+ result[:hostname] = fqdn
82
+ end
83
+
84
+ opts.on('--fact-file PATH', 'Use facts from the specified file (.yaml/.json only)') do |path|
85
+ result[:fact_file] = path
86
+ result[:hostname] = '.' if result[:hostname].nil?
87
+ end
88
+
89
+ opts.on('--factsdir DIR', '-f', 'Base directory of YAML facts') do |factdir|
90
+ result[:factdir] = find_dir(factdir)
91
+ end
92
+
93
+ opts.on('--puppetdb', '-p', 'Force lookup of facts in puppetdb') do |puppetdb|
94
+ result[:puppetdb] = puppetdb
95
+ end
96
+
97
+ opts.on('--array', 'Return answer as an array') do
98
+ result[:resolution_type] = :array
99
+ end
100
+
101
+ opts.on('--hash', 'Return answer as an hash') do
102
+ result[:resolution_type] = :hash
103
+ end
104
+
105
+ opts.on('--[no-]stringify-facts', 'Override default stringify facts behavior') do |x|
106
+ result[:stringify_facts] = x
107
+ end
108
+ end.parse!
109
+
110
+ if ARGV.empty?
111
+ puts 'ERROR: You did not specify a data item to look up!'
112
+ exit 1
113
+ end
114
+
115
+ if result[:hostname].nil?
116
+ puts 'ERROR: You did not specify a host name to simulate (-n <hostname>)'
117
+ exit 1
118
+ end
119
+
120
+ result[:key] = ARGV.delete_at(0)
121
+ result
122
+ end
123
+
124
+ # Find a user-supplied directory, either absolute path, or relative to the current
125
+ # working directory. If directory cannot be find, raise exception.
126
+ # @param dir [String] Directory name supplied by user
127
+ # @return [String] Absolute path to confirmed existing directory
128
+ def self.find_dir(dir)
129
+ result = []
130
+ dir_array = dir.is_a?(Array) ? dir : [dir]
131
+ dir_array.each do |dir_ent|
132
+ if File.directory?(dir_ent)
133
+ result << File.absolute_path(dir_ent)
134
+ elsif File.directory?(File.join(File.absolute_path(Dir.getwd), factdir))
135
+ result << File.join(File.absolute_path(Dir.getwd), dir_ent)
136
+ else
137
+ raise Errno::ENOENT, "Specified directory #{dir_ent} does not exist or is inaccessible"
138
+ end
139
+ end
140
+ return result[0] unless dir.is_a?(Array)
141
+ result
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,92 @@
1
+ require 'yaml'
2
+
3
+ module HieraSimulator
4
+ # Load the configuration for the Hiera simulator
5
+ #
6
+ # The order in which files are read in are:
7
+ # - $CWD/.hiera-simulator.yaml
8
+ # - $HOME/.hiera-simulator.yaml
9
+ # - /etc/hiera-simulator.yaml
10
+ #
11
+ # The reading of the configuration values happens very much like in Hiera itself, where
12
+ # the first time a key is seen, subsequent occurrences of that key are ignored.
13
+ class Config
14
+ attr_reader :config
15
+
16
+ # Constructor
17
+ # @param overrides [Hash] Override default settings for home_dir, global_config, and/or cwd
18
+ def initialize(overrides = {})
19
+ @home_dir = overrides.fetch(:home_dir, ENV['HOME'])
20
+ @global_configfile = overrides.fetch(:global_config, '/etc/hiera-simulator.yaml')
21
+ @working_dir = overrides.fetch(:cwd) { |_x| File.absolute_path(Dir.getwd) }
22
+ @config = overrides.fetch(:config) { |_x| retrieve_config }
23
+ end
24
+
25
+ # Get - shorthand method to retrieve a particular key from the config hash
26
+ # @param key [String] Key to retrieve
27
+ # @param default [Object] Default value
28
+ # @return [Object] Value of config setting
29
+ def get(key, default = nil)
30
+ @config.fetch(key, @config.fetch(key.to_s, @config.fetch(key.to_sym, default)))
31
+ end
32
+
33
+ # Merge! - Merge a hash
34
+ # @param newhash [Hash] Hash to merge in
35
+ def merge!(newhash)
36
+ @config.merge!(newhash)
37
+ end
38
+
39
+ # Validate configuration
40
+ def validate
41
+ raise_no_config_files_found if config.empty?
42
+ end
43
+
44
+ # Throw "Missing Parameter" error
45
+ def raise_missing_parameter(parameter)
46
+ errmsg = "\n\nERROR!!! A required parameter (#{parameter}) was missing.\n"
47
+ errmsg += "Tried these files: #{filelist.inspect}\n"
48
+ errmsg += "(None of these files could be found)\n" if retrieve_config.empty?
49
+ errmsg += "Please see https://github.com/kpaulisse/hiera-simulator/blob/master/doc/troubleshooting.rb for more.\n\n"
50
+ raise ConfigError, errmsg
51
+ end
52
+
53
+ private
54
+
55
+ # Read the configuration for the hiera simulator
56
+ # @param overrides [Hash] Override default settings for home_dir, global_config, and/or cwd
57
+ # @return [Hash] Merged configuration
58
+ def retrieve_config
59
+ result = {}
60
+ filelist.each do |file|
61
+ next unless File.file?(file)
62
+ data = YAML.load_file(file)
63
+ raise ConfigError, "File #{file} is not in the correct format. Expected hash got #{data.class}" unless data.is_a?(Hash)
64
+ result = data.merge(result)
65
+ end
66
+ result
67
+ end
68
+
69
+ # From the overrides, get the file list
70
+ # @return [Array<String>] File names of possible config files
71
+ def filelist
72
+ filename = '.hiera-simulator.yaml'
73
+ files = []
74
+ files << File.join(@working_dir, filename) unless @working_dir.nil?
75
+ files << File.join(@home_dir, filename) unless @home_dir.nil?
76
+ files << @global_configfile unless @global_configfile.nil?
77
+ files
78
+ end
79
+
80
+ # Throw "No config files contain config data" error
81
+ def raise_no_config_files_found
82
+ errmsg = "\nNo local or global hiera-simulator config files contain config data.\n"
83
+ errmsg += "Perhaps you have not yet configured hiera-simulator on this system?\n"
84
+ errmsg += "Please see https://github.com/kpaulisse/hiera-simulator/blob/master/doc/troubleshooting.rb for more.\n\n"
85
+ raise ConfigError, errmsg
86
+ end
87
+ end
88
+
89
+ class ConfigError < RuntimeError
90
+ # Specific error handling for handled exceptions in this class
91
+ end
92
+ end
@@ -0,0 +1,27 @@
1
+ require 'json'
2
+ require 'yaml'
3
+
4
+ module HieraSimulator
5
+ module FactSource
6
+ # Retrieve facts from a specified file on the file system.
7
+ class FactFile
8
+ # Constructor
9
+ # @param config [HieraSimulator::Config] Config object
10
+ def initialize(config, override = {})
11
+ @fact_file = override.fetch(:fact_file, config.get('fact_file', nil))
12
+ raise HieraSimulator::FactSourceError, 'No :fact_file was passed to FactFile' if @fact_file.nil?
13
+ end
14
+
15
+ # Get facts for a node
16
+ # @param node [String] IGNORED
17
+ # @param stringify_facts [Boolean] IGNORED
18
+ # @return [Hash] Facts from the node in question
19
+ def facts(node = nil)
20
+ raise HieraSimulator::FactLookupError, "Invalid fact file specified: #{@fact_file}" unless File.file?(@fact_file)
21
+ return HieraSimulator::FactSource::Util.modify_and_load_yamlfile(@fact_file) if @fact_file =~ /\.yaml$/
22
+ return HieraSimulator::FactSource::Util.modify_and_load_jsonfile(@fact_file) if @fact_file =~ /\.json$/
23
+ raise HieraSimulator::FactLookupError, "Unknown extension for: #{@fact_file}; .yaml and .json files are supported"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ require 'tempfile'
2
+ require 'yaml'
3
+
4
+ module HieraSimulator
5
+ module FactSource
6
+ # Retrieve facts from the file system. This object is a "connection" to those files.
7
+ class FileSystem
8
+ # Constructor
9
+ # @param config [HieraSimulator::Config] Config object
10
+ def initialize(config, override = {})
11
+ @fact_dir = override.fetch(:fact_dir, config.get('fact_dir', nil))
12
+ raise HieraSimulator::FactSourceError, 'No fact_dir was found in hiera-simulator configuration' if @fact_dir.nil?
13
+ end
14
+
15
+ # Get facts for a node
16
+ # @param node [String] Node FQDN as it should exist in PuppetDB
17
+ # @return [Hash] Facts from the node in question
18
+ def facts(node)
19
+ filepath = File.join(@fact_dir, node + '.yaml')
20
+ return HieraSimulator::FactSource::Util.modify_and_load_yamlfile(filepath) if File.readable?(filepath)
21
+ raise HieraSimulator::FactLookupError, "Fact retriever could not find or access #{filepath}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,96 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module HieraSimulator
5
+ module FactSource
6
+ # Retrieve facts from PuppetDB. This object is a connection to a PuppetDB instance.
7
+ class PuppetDB
8
+ # Constructor
9
+ # @param config [HieraSimulator::Config] Config object
10
+ def initialize(config, override = {})
11
+ @puppetdb_url = override.fetch(:puppetdb_url, config.get('puppetdb_url', nil))
12
+ raise HieraSimulator::FactSourceError, 'No PuppetDB URL was found in hiera-simulator configuration' if @puppetdb_url.nil?
13
+ @puppetdb_api_version = override.fetch(:puppetdb_api_version, config.get('puppetdb_api_version', 3))
14
+ @httparty_timeout = override.fetch(:timeout, config.get('timeout', 10))
15
+ @mock_puppetdb = override.fetch(:mock_puppetdb, config.get('mock_puppetdb', nil))
16
+ @stringify_facts = determine_stringify_facts(override, config)
17
+ end
18
+
19
+ # Get facts for a node
20
+ # @param node [String] Node FQDN as it should exist in PuppetDB
21
+ # @return [Hash] Facts from the node in question
22
+ def facts(node)
23
+ return facts_v3(node) if @puppetdb_api_version == 3
24
+ return facts_v4(node) if @puppetdb_api_version == 4
25
+ message = "HieraSimulator does not know how to handle PuppetDB API version #{@puppetdb_api_version}"
26
+ raise HieraSimulator::FactSourceError, message
27
+ end
28
+
29
+ private
30
+
31
+ def determine_stringify_facts(override, config)
32
+ return override.fetch(:stringify_facts) if override.key?(:stringify_facts)
33
+ default = false
34
+ default = true if @puppetdb_api_version <= 3
35
+ default = true if Hiera.version.to_i < 2
36
+ config.get('stringify_facts', default)
37
+ end
38
+
39
+ # PuppetDB API common
40
+ def facts_common(uri)
41
+ reply = response(uri)
42
+
43
+ # Stringify facts if needed (old hiera, old PuppetDB)
44
+ if @stringify_facts
45
+ result = {}
46
+ reply.each do |x|
47
+ HieraSimulator::FactSource::Util.stringify(x['name'], x['value']).each do |y|
48
+ result[y[0]] = y[1]
49
+ end
50
+ end
51
+ return result
52
+ end
53
+
54
+ # Don't stringify facts
55
+ result = {}
56
+ reply.map { |x| result[x['name']] = x['value'] }
57
+ result
58
+ end
59
+
60
+ # PuppetDB API v3
61
+ def facts_v3(source)
62
+ facts_common("/v3/nodes/#{source}/facts")
63
+ end
64
+
65
+ # PuppetDB API v4
66
+ def facts_v4(source)
67
+ facts_common("/pdb/query/v4/nodes/#{source}/facts")
68
+ end
69
+
70
+ # HTTP(S) Query
71
+ # @param path [String] Path portion of the URL
72
+ # @return [Hash] Facts from the node in question
73
+ def response(path)
74
+ return mocked_response(@mock_puppetdb) unless @mock_puppetdb.nil?
75
+ complete_url = @puppetdb_url + path
76
+ options = {
77
+ timeout: @httparty_timeout
78
+ }
79
+ begin
80
+ x = HTTParty.get(complete_url, options).parsed_response
81
+ raise HieraSimulator::FactLookupError, "PuppetDB resource not found: #{complete_url}" if x == 'Not Found'
82
+ return x
83
+ rescue Net::OpenTimeout => e
84
+ raise HieraSimulator::FactSourceError, "PuppetDB connection timeout: #{e.message}"
85
+ rescue Errno::ECONNREFUSED => e
86
+ raise HieraSimulator::FactSourceError, "PuppetDB connection refused: #{e.message}"
87
+ end
88
+ end
89
+
90
+ # Mock puppetdb response, for spec testing
91
+ def mocked_response(filepath)
92
+ JSON.parse(File.read(filepath))
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,66 @@
1
+ require 'json'
2
+ require 'yaml'
3
+
4
+ module HieraSimulator
5
+ module FactSource
6
+ # Some handy methods that may be used by multiple fact sources
7
+ class Util
8
+ # A typical Puppet YAML fact file looks like this:
9
+ # ```
10
+ # --- !ruby/object:Puppet::Node::Facts
11
+ # name: your.fqdn.com
12
+ # values:
13
+ # key1: val1
14
+ # key2: val2
15
+ # ```
16
+ # To avoid loading in all of Puppet just to parse what is basically a plain YAML file,
17
+ # this method strips off the first line and un-indents all of the remaining lines to
18
+ # make it a plain YAML file, and then parses that.
19
+ # @param filepath [String] File Path to read
20
+ # @return [Hash] Parsed YAML object
21
+ def self.modify_and_load_yamlfile(filepath)
22
+ content = File.read(filepath).split(/[\r\n]+/)
23
+ first_line = content.shift
24
+ unless first_line == '--- !ruby/object:Puppet::Node::Facts'
25
+ raise HieraSimulator::FactSourceError, "#{filepath} was not in expected Puppet::Node::Facts format"
26
+ end
27
+ content.unshift '---'
28
+ fixed_yaml = content.map { |line| line.sub(/^ /, '') }
29
+ data = YAML.load(fixed_yaml.join("\n"))
30
+ raise HieraSimulator::FactLookupError, "Invalid content in node fact file #{filepath}" unless data.key?('values')
31
+ result = {}
32
+ data['values'].each { |k, v| result['::' + k] = v }
33
+ result
34
+ end
35
+
36
+ # A typical fact file (e.g., from PuppetDB) looks like this:
37
+ # {
38
+ # "key1": "value1",
39
+ # "key2": "value2"
40
+ # }
41
+ # This reads the fact file and returns a hash with the facts in the proper format.
42
+ # @param filepath [String] File Path to read
43
+ # @return [Hash] Parsed YAML object
44
+ def self.modify_and_load_jsonfile(filepath)
45
+ data = JSON.parse(File.read(filepath))
46
+ result = {}
47
+ data.each { |k, v| result['::' + k] = v }
48
+ result
49
+ end
50
+
51
+ # Stringify key-value, needed for some older versions of Puppet and hiera
52
+ # @param name [String] current key
53
+ # @param value [Object] current value
54
+ # @param prior [String] prior value, for recursion
55
+ # @return [Array<[name, value]>] Stringified facts and values
56
+ def self.stringify(name, value, prior = '::' + name)
57
+ return [[ prior.sub(/::$/, ''), value ]] unless value.is_a?(Hash)
58
+ result = []
59
+ value.each do |k, v|
60
+ result.concat stringify(k, v, prior + '::' + k)
61
+ end
62
+ result
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,36 @@
1
+ module HieraSimulator
2
+ # Gather facts from the specified backend(s)
3
+ class Facts
4
+ # Constructor
5
+ # @param config [HieraSimulator::Config] Configuration object
6
+ def self.facts(config, node, stringify_facts = nil)
7
+ override = {}
8
+ override[:stringify_facts] = stringify_facts unless stringify_facts.nil?
9
+ errors = []
10
+ backends = config.get(:backends, %w(FileSystem PuppetDB))
11
+ backends = ['FactFile'] unless config.get('fact_file', nil).nil?
12
+ backends.each do |backend|
13
+ begin
14
+ obj = Module.const_get("HieraSimulator::FactSource::#{backend}").new(config, override)
15
+ return obj.facts(node)
16
+ rescue HieraSimulator::FactSourceError, HieraSimulator::FactLookupError => exc
17
+ errors << { exception: exc, backend: backend }
18
+ next
19
+ end
20
+ end
21
+ raise "Unable to retrieve facts for #{node}:\n#{format_errors(errors)}"
22
+ end
23
+
24
+ def self.format_errors(error_array)
25
+ error_array.map { |x| "- #{x[:backend]}: #{x[:exception]}" }.join("\n")
26
+ end
27
+ end
28
+
29
+ class FactLookupError < RuntimeError
30
+ # Catch handled exceptions from data source
31
+ end
32
+
33
+ class FactSourceError < RuntimeError
34
+ # Catch handled exceptions from data source
35
+ end
36
+ end
@@ -0,0 +1,55 @@
1
+ require 'hiera'
2
+ require 'hiera/util'
3
+ require 'tempfile'
4
+
5
+ module HieraSimulator
6
+ # Actually interact with the Hiera gem
7
+ class HieraLookup
8
+ # Look up a key in hiera
9
+ # @param key [String] Key to look up
10
+ # @param config [HieraSimulator::Config] Configuration object
11
+ # @param verbose [Boolean] Enable verbose mode for hiera
12
+ def self.lookup(key, config, facts, options = {})
13
+ hiera_tmp_config = generate_hiera_file(config)
14
+ hiera = Hiera.new(config: hiera_tmp_config)
15
+ Hiera.logger = options.fetch(:verbose, false) ? 'console' : 'noop'
16
+ result = hiera.lookup(key, nil, facts, nil, options.fetch(:resolution_type, :priority))
17
+ File.unlink(hiera_tmp_config)
18
+ result
19
+ end
20
+
21
+ # Generate a temporary hiera configuration file, adjusting for directory paths
22
+ # in a local development environment.
23
+ def self.generate_hiera_file(config)
24
+ hiera_yaml_path = config.get('hiera_yaml_path', '(undefined)')
25
+ raise Errno::ENOENT, "Cannot open hiera_yaml_path '#{hiera_yaml_path}'" unless File.file?(hiera_yaml_path)
26
+ hiera_cfg = YAML.load_file(hiera_yaml_path)
27
+
28
+ backends = config.get('backends', hiera_cfg[:backends])
29
+ hiera_cfg[:backends] = backends unless backends == 'preserve'
30
+
31
+ if hiera_cfg[:backends].include?('yaml')
32
+ yaml_datadir = config.get('yaml_datadir', nil)
33
+ config.raise_missing_parameter 'yaml_datadir' if yaml_datadir.nil?
34
+ hiera_cfg[:yaml] = { datadir: yaml_datadir }
35
+ end
36
+
37
+ if hiera_cfg[:backends].include?('json')
38
+ json_datadir = config.get('json_datadir', nil)
39
+ config.raise_missing_parameter 'json_datadir' if json_datadir.nil?
40
+ hiera_cfg[:json] = { datadir: json_datadir }
41
+ end
42
+
43
+ other_backends = hiera_cfg[:backends] - ['yaml','json']
44
+ if other_backends.any?
45
+ STDERR.puts "WARNING: Ignoring unsupported backend(s): #{other_backends.join(', ')}"
46
+ hiera_cfg[:backends] = hiera_cfg[:backends] & ['yaml', 'json']
47
+ end
48
+
49
+ hiera_file = Tempfile.new('hiera.yaml')
50
+ hiera_file.write hiera_cfg.to_yaml
51
+ hiera_file.close
52
+ hiera_file.path
53
+ end
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hiera-simulator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Paulisse
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hiera
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: deep_merge
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 3.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 3.0.0
111
+ description: Used to pre-test changes in a Puppet codebase
112
+ email:
113
+ executables:
114
+ - hiera-simulator
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - Gemfile
119
+ - Gemfile.hiera1
120
+ - Gemfile.hiera1.lock
121
+ - Gemfile.hiera3
122
+ - Gemfile.hiera3.lock
123
+ - Gemfile.lock
124
+ - LICENSE
125
+ - README.md
126
+ - Rakefile
127
+ - bin/hiera-simulator
128
+ - lib/hiera-simulator.rb
129
+ - lib/hiera-simulator/cli.rb
130
+ - lib/hiera-simulator/config.rb
131
+ - lib/hiera-simulator/fact_source/factfile.rb
132
+ - lib/hiera-simulator/fact_source/filesystem.rb
133
+ - lib/hiera-simulator/fact_source/puppetdb.rb
134
+ - lib/hiera-simulator/fact_source/util.rb
135
+ - lib/hiera-simulator/facts.rb
136
+ - lib/hiera-simulator/hieralookup.rb
137
+ homepage: http://github.com/kpaulisse/hiera-simulator
138
+ licenses:
139
+ - Apache 2.0
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.2.2
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Determine what hiera would output for a set of facts
161
+ test_files: []