fencing 0.1.0

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: 496654c6eccb23d675e9c67719f4f3ab73e033da
4
+ data.tar.gz: 70534e895152e426ed8d2844b599e63820bd73e9
5
+ SHA512:
6
+ metadata.gz: 359ed4e0d4a2b10875fc229c6499df20467abcbcbd0831db075ca8e645fd62b58e9e752ea0003dcec5c7d37322de6eec234a503beda069816beae4f21e119e3f
7
+ data.tar.gz: 9945c582501438bddf7a30677fe7491ea60597894608ad02475e8ad45162a0f474f322cfaf7a3d68c520ff0a502eab5424704690a6cb15720055266a5d4e1cf1
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [2015] [George McIntosh]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Fencing
2
+
3
+ Fencing is a Puppet external node classifier which will hold back node definitions until Puppet Facts meet required conditions. This is useful if you need to orchestrate nodes.
4
+
5
+ ## Motivation
6
+
7
+ When configuring an estate, we had a requirement to bring up certain services before others. This is not really supported by Puppet, and is mitigated is a number of ways, such as using MCollective or Ansible to orchestrate the nodes. We already had an ENC in place, and it seemed a fairly simple move to extend that to only release node definitions when certain conditions were met.
8
+
9
+ ## How it works
10
+
11
+ The Puppetmaster locally stores all Facts from every node it manages. If we define a custom fact on a node to say "I'm ready", then the ENC can look at the state of this fact and make a decision on whether to release a node definition to the Puppet master.
12
+
13
+ ## Use
14
+
15
+ Fencing is a Ruby Gem. You can install it with
16
+
17
+ $ gem install fencing
18
+
19
+ To configure your Puppetmaster to use it, your Puppetmaster's puppet.conf needs an entry like this
20
+
21
+ [master]
22
+ node_terminus = exec
23
+ external_nodes = "/usr/bin/fencing <path_to_conf_file> <path_to_node_definitions>"
24
+
25
+ Both provided paths must be absolute. The node definitions are, of course, the yamls that will be released to Puppet.
26
+
27
+
28
+ The configuration file is JSON, and it looks like this:
29
+
30
+ {
31
+ "hosts" : {
32
+ "node1" : "node1",
33
+ "node2" : "node2",
34
+ "node3" : {
35
+ "node_name" : "node3"
36
+ },
37
+ "node4" : {
38
+ "node_name" : "node4",
39
+ "blocker" : {
40
+ "blocking_host_name" : "node3",
41
+ "fact" : "node3_ready",
42
+ "expected_value" : "true"
43
+ }
44
+ }
45
+ },
46
+ "blocker" : {
47
+ "blocking_host_name" : "node1",
48
+ "fact" : "node1_ready",
49
+ "expected_value" : "true"
50
+ }
51
+ }
52
+
53
+ The hosts element is mandatory. In the above example, any hostname passed to the ENC which starts with *node1* will be passed back *node1.yaml*, providing the global blocker is satisfied. This is configured by the blocker element, and in this case, it says that node defintions will not be released until the host whose name starts with node1 reports that the Puppet Fact node1_ready returns true. Obviously, node1 cannot block itself or your estate would never be configured, so the node1 defintion will be released regardless.
54
+
55
+ Also in the above example, node4 is not dependent on the global blocker, but instead it blocks until node3 reports that the Fact node3_ready is true. Anything which has its own inline blocker configured currently ignores the global blocker.
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ =begin
2
+
3
+ PUT LICENCE HERE
4
+
5
+ =end
6
+
7
+ require 'rubygems'
8
+ require 'rubygems/package_task'
9
+ require 'rake/testtask'
10
+ require 'rspec/core/rake_task'
11
+
12
+ spec = Gem::Specification.new do |gem|
13
+ gem.name = "fencing"
14
+ gem.version = '0.1.0'
15
+ gem.authors = ["George McIntosh"]
16
+ gem.email = ["george@elevenware.com"]
17
+ gem.summary = %q{A Puppet ENC that releases config based on configuration}
18
+ gem.description = %q{Releases Puppet configuration for a node dependent on the condition of dependent nodes}
19
+ gem.homepage = "https://github.com/georgecodes/fencing"
20
+ gem.license = "Apache License (2.0)"
21
+
22
+ gem.files = Dir['{bin,lib,man,test,spec}/**/*', 'Rakefile', 'README*', 'LICENSE*']
23
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
25
+ gem.require_paths = ["lib"]
26
+
27
+ gem.add_development_dependency "rake"
28
+ gem.add_development_dependency "rspec"
29
+ gem.add_development_dependency "rspec-mocks"
30
+ gem.add_development_dependency "puppet"
31
+ gem.add_runtime_dependency "json", "~> 1.8.0"
32
+ end
33
+
34
+ Gem::PackageTask.new(spec) do |pkg|
35
+ pkg.need_tar = true
36
+ end
37
+
38
+ Rake::TestTask.new do |t|
39
+ t.pattern = 'spec/*_spec.rb'
40
+ t.verbose = true
41
+ end
42
+
43
+ RSpec::Core::RakeTask.new(:spec)
data/bin/fencing ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fencing'
4
+
5
+ enc_config_location = ARGV[0]
6
+ nodes_location = ARGV[1]
7
+ host_name = ARGV[2]
8
+
9
+ enc = OS::Puppet::Fencing::FencingRunner.new(enc_config_location, nodes_location)
10
+ puts enc.lookup(host_name)
@@ -0,0 +1,31 @@
1
+ module OS
2
+ module Puppet
3
+ module Fencing
4
+
5
+ class Classifier
6
+
7
+ def initialize(config, facter_adapter)
8
+ @config = config
9
+ @facter = facter_adapter
10
+ end
11
+
12
+ def resolve_node(host_name)
13
+ node_config = @config.match_node(host_name)
14
+ assert_blocked(host_name, node_config.blocker)
15
+ node_config.node
16
+ end
17
+
18
+ def assert_blocked(host_name, blocker)
19
+ return if !blocker
20
+ allowed_host = blocker.blocking_host_name
21
+ return if host_name.start_with?(allowed_host)
22
+ fact_name = blocker.fact
23
+ fact_value = @facter.lookup(allowed_host, fact_name)
24
+ raise "cannot release #{host_name}" unless fact_value == blocker.expected_value
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,68 @@
1
+ module OS
2
+ module Puppet
3
+ module Fencing
4
+
5
+ class Config
6
+
7
+ attr_reader :nodes
8
+
9
+ def initialize(config_hash)
10
+ @config = config_hash
11
+ global_blocker_config = config_hash['blocker']
12
+ @global_blocker = Blocker.new(global_blocker_config) if global_blocker_config
13
+ @nodes = []
14
+
15
+ config_hash['hosts'].each do | host_prefix, conf|
16
+ node_name = conf
17
+ blocker = @global_blocker
18
+ if(conf.class == Hash)
19
+ node_name = conf['node_name']
20
+ blocker_conf = conf['blocker']
21
+ blocker = blocker_conf ? Blocker.new(conf['blocker']) : global_blocker
22
+ end
23
+ nodes << Node.new(host_prefix, node_name, blocker)
24
+ end
25
+
26
+ end
27
+
28
+ def match_node(host_name)
29
+ nodes.each do | node |
30
+ return node if host_name.start_with?(node.host_prefix)
31
+ end
32
+ raise "Could not find configuration for host #{host_name}"
33
+ end
34
+
35
+ def global_blocker
36
+ @global_blocker
37
+ end
38
+
39
+ end
40
+
41
+ class Node
42
+
43
+ attr_reader :host_prefix, :node, :blocker
44
+
45
+ def initialize(host_prefix, node_file_name, blocker)
46
+ @host_prefix = host_prefix
47
+ @node = node_file_name
48
+ @blocker = blocker
49
+ end
50
+
51
+ end
52
+
53
+
54
+ class Blocker
55
+
56
+ attr_reader :blocking_host_name, :fact, :expected_value
57
+
58
+ def initialize(hash)
59
+ @blocking_host_name = hash['blocking_host_name']
60
+ @fact = hash['fact']
61
+ @expected_value = hash['expected_value']
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,34 @@
1
+ require 'yaml'
2
+ require 'puppet'
3
+
4
+ module OS
5
+ module Puppet
6
+ module Fencing
7
+
8
+ class FacterAdapter
9
+
10
+ def initialize(puppet_nodes_dir = '/var/lib/puppet/yaml/node')
11
+ @node_dir = puppet_nodes_dir
12
+ end
13
+
14
+ def lookup(node_name, fact_name)
15
+ node_def = find_node_def(node_name)
16
+ node = YAML.load_file(node_def)
17
+ fact_list = node.facts.to_data_hash
18
+ fact_result = fact_list['values'][fact_name]
19
+ raise "Fact #{fact_name} not found on node #{node_name}" if fact_result == nil
20
+ fact_result
21
+ end
22
+
23
+ def find_node_def(node_name)
24
+ Dir.foreach(@node_dir) do | file |
25
+ return File.join(@node_dir, file) if file.start_with?(node_name)
26
+ end
27
+ raise "Cannot find node #{node_name}"
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ require 'yaml'
2
+
3
+ module OS
4
+ module Puppet
5
+ module Fencing
6
+
7
+ class NodeResolver
8
+
9
+ def initialize(nodes_location)
10
+ @location = nodes_location
11
+ end
12
+
13
+ def resolve(file_name)
14
+ File.read(File.join(@location, "#{file_name}.yaml"))
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
21
+ end
data/lib/fencing.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'fencing/config'
2
+ require 'fencing/facter_adapter'
3
+ require 'fencing/classifier'
4
+ require 'fencing/node_resolver'
5
+ require 'json'
6
+
7
+ module OS
8
+ module Puppet
9
+ module Fencing
10
+
11
+ class FencingRunner
12
+
13
+ def initialize(config_location, nodes_location)
14
+ config_json = JSON.parse(File.read(config_location))
15
+ config = OS::Puppet::Fencing::Config.new(config_json)
16
+ facter_adapter = OS::Puppet::Fencing::FacterAdapter.new
17
+ @classifier = OS::Puppet::Fencing::Classifier.new(config, facter_adapter)
18
+ @resolver = OS::Puppet::Fencing::NodeResolver.new(nodes_location)
19
+ end
20
+
21
+ def lookup(host_name)
22
+ node_file_name = @classifier.resolve_node(host_name)
23
+ node_definition = @resolver.resolve(node_file_name)
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
30
+ end
data/spec/enc_spec.rb ADDED
@@ -0,0 +1,151 @@
1
+ require 'rspec'
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe 'configured ENC' do
5
+
6
+ before(:each) do
7
+ config_hash = {
8
+ 'hosts' => {
9
+ 'node1' => 'node1',
10
+ 'node2' => 'node2',
11
+ 'node3' => {
12
+ 'node_name' => 'node3'
13
+ },
14
+ 'node4' => {
15
+ 'node_name' => 'node4',
16
+ 'blocker' => {
17
+ 'blocking_host_name' => 'node3',
18
+ 'fact' => 'node3_ready',
19
+ 'expected_value' => 'true'
20
+ }
21
+ }
22
+ },
23
+ 'blocker' => {
24
+ 'blocking_host_name' => 'node1',
25
+ 'fact' => 'node1_ready',
26
+ 'expected_value' => 'true'
27
+ }
28
+ }
29
+ config = OS::Puppet::Fencing::Config.new(config_hash)
30
+ @facter = double('facter')
31
+ @enc = OS::Puppet::Fencing::Classifier.new(config, @facter)
32
+ end
33
+
34
+ it "raises an error if the node isn't found" do
35
+
36
+ host_name = 'nonexistent.os.uk'
37
+
38
+ expect { @enc.resolve_node(host_name)}.to raise_error(RuntimeError)
39
+
40
+ end
41
+
42
+ it "does not block the node that is the global blocker" do
43
+
44
+ host_name = 'node1.os.uk'
45
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'false' }
46
+
47
+ expect(@enc.resolve_node(host_name)).to eq('node1')
48
+
49
+ end
50
+
51
+ it "returns the node name for a simple node" do
52
+
53
+ host_name = 'node2.os.uk'
54
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'true' }
55
+
56
+ expect(@enc.resolve_node(host_name)).to eq('node2')
57
+
58
+ end
59
+
60
+ it "raises an error if the node is blocked by the global blocker" do
61
+
62
+ host_name = 'node2.os.uk'
63
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'false' }
64
+
65
+ expect { @enc.resolve_node(host_name)}.to raise_error(RuntimeError)
66
+
67
+ end
68
+
69
+ it "returns the node name for a configured node" do
70
+
71
+ host_name = 'node3.os.uk'
72
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'true' }
73
+
74
+ expect(@enc.resolve_node(host_name)).to eq('node3')
75
+
76
+ end
77
+
78
+ it "ignores the global blocker if a node has its own blocker" do
79
+
80
+ host_name = 'node4.os.uk'
81
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'false' }
82
+ allow(@facter).to receive(:lookup).with('node3', 'node3_ready') { 'true' }
83
+
84
+ expect(@enc.resolve_node(host_name)).to eq('node4')
85
+
86
+ end
87
+
88
+ it "will not release if the nodes blocker does not allow it" do
89
+
90
+ host_name = 'node4.os.uk'
91
+ allow(@facter).to receive(:lookup).with('node1', 'node1_ready') { 'false' }
92
+ allow(@facter).to receive(:lookup).with('node3', 'node3_ready') { 'false' }
93
+
94
+ expect {@enc.resolve_node(host_name)}.to raise_error(RuntimeError)
95
+
96
+ end
97
+
98
+ it "will still run if no global blocker exists" do
99
+
100
+ config_hash = {
101
+ 'hosts' => {
102
+ 'node1' => 'node1'
103
+ }
104
+ }
105
+
106
+ config = OS::Puppet::Fencing::Config.new(config_hash)
107
+ facter = double('facter')
108
+ enc = OS::Puppet::Fencing::Classifier.new(config, @facter)
109
+
110
+ host_name = 'node1.os.uk'
111
+
112
+ expect(enc.resolve_node(host_name)).to eq('node1')
113
+
114
+ end
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ end
@@ -0,0 +1,15 @@
1
+ require 'rspec'
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe "Facter" do
5
+
6
+ it "retrieves a fact from the puppet directory" do
7
+ node_dir = File.join(__dir__, 'fixtures/nodes')
8
+
9
+ facter_adapter = OS::Puppet::Fencing::FacterAdapter.new(node_dir)
10
+
11
+ expect(facter_adapter.lookup('node1', 'node_ready')).to eq('true')
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,22 @@
1
+ {
2
+ "hosts" : {
3
+ "node1" : "node1",
4
+ "node2" : "node2",
5
+ "node3" : {
6
+ "node_name" : "node3"
7
+ },
8
+ "node4" : {
9
+ "node_name" : "node4",
10
+ "blocker" : {
11
+ "blocking_host_name" : "node3",
12
+ "fact" : "node3_ready",
13
+ "expected_value" : "true"
14
+ }
15
+ }
16
+ },
17
+ "blocker" : {
18
+ "blocking_host_name" : "node1",
19
+ "fact" : "node1_ready",
20
+ "expected_value" : "true"
21
+ }
22
+ }
@@ -0,0 +1,2 @@
1
+ ---
2
+ node1
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Puppet::Node
2
+ name: store1.dev.amp.os.uk
3
+ classes:
4
+ - "amp_role::store"
5
+ parameters:
6
+ product: amp
7
+ kernel: Linux
8
+ processors: "{\x22models\x22=>[\x22Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz\x22], \x22count\x22=>1, \x22physicalcount\x22=>1}"
9
+ architecture: x86_64
10
+ hardwaremodel: x86_64
11
+ operatingsystem: Amazon
12
+ os: "{\x22name\x22=>\x22Amazon\x22, \x22family\x22=>\x22RedHat\x22, \x22release\x22=>{\x22major\x22=>\x222015\x22, \x22minor\x22=>\x2203\x22, \x22full\x22=>\x222015.03\x22}}"
13
+ processor0: "Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz"
14
+ processorcount: "1"
15
+ partitions: "{\x22xvda1\x22=>{\x22uuid\x22=>\x22e57ff077-2c96-4a37-bd16-1722932e6126\x22, \x22size\x22=>\x2216773087\x22, \x22mount\x22=>\x22/\x22, \x22filesystem\x22=>\x22ext4\x22}}"
16
+ ps: "ps -ef"
17
+ physicalprocessorcount: "1"
18
+ selinux: "false"
19
+ uptime_hours: "2"
20
+ timezone: UTC
21
+ uptime_days: "0"
22
+ blockdevice_xvda_size: "8589934592"
23
+ blockdevices: xvda
24
+ id: root
25
+ network_eth0: "172.16.0.0"
26
+ network_lo: "127.0.0.0"
27
+ kernelmajversion: "3.14"
28
+ uniqueid: "30d5ac36"
29
+ bios_vendor: Xen
30
+ bios_version: "4.2.amazon"
31
+ bios_release_date: "06/01/2015"
32
+ manufacturer: Xen
33
+ productname: "HVM domU"
34
+ serialnumber: ec2848b7-0d30-4115-d7da-567d46de11cd
35
+ uuid: EC2848B7-0D30-4115-D7DA-567D46DE11CD
36
+ type: Other
37
+ operatingsystemrelease: "2015.03"
38
+ uptime_seconds: "9693"
39
+ augeasversion: "1.0.0"
40
+ osfamily: RedHat
41
+ ipaddress: "172.16.0.40"
42
+ kernelversion: "3.14.35"
43
+ virtual: xenhvm
44
+ is_virtual: "true"
45
+ kernelrelease: "3.14.35-28.38.amzn1.x86_64"
46
+ domain: uk
47
+ hardwareisa: x86_64
48
+ puppetversion: "3.7.4"
49
+ interfaces: "eth0,lo"
50
+ ipaddress_eth0: "172.16.0.40"
51
+ macaddress_eth0: "02:C9:9E:5C:D8:15"
52
+ netmask_eth0: "255.255.255.0"
53
+ mtu_eth0: "9001"
54
+ ipaddress_lo: "127.0.0.1"
55
+ netmask_lo: "255.0.0.0"
56
+ mtu_lo: "65536"
57
+ gid: root
58
+ operatingsystemmajrelease: "2015"
59
+ system_uptime: "{\x22seconds\x22=>9693, \x22hours\x22=>2, \x22days\x22=>0, \x22uptime\x22=>\x222:41 hours\x22}"
60
+ netmask: "255.255.255.0"
61
+ sshdsakey: "AAAAB3NzaC1kc3MAAACBAIIcmZc+50JBWVFnaq2gGdzYzyjuntoykVmKNqX6bf32p9SLOSKXKoUblDZ9Zwnfj+MGkjRCE7no1FVjD0h+12cIoN+GYnIyVopW4mqJJDtx1ClClkjpjYkRlto2gzQEs1oPE++txAIG8QGNKR723YBI+84TwqOR1vFRUNzeNDytAAAAFQDYMY/PZ0eM5C0vy6Eofbyl5kPOQwAAAIAElYPRvcV4D+Atq+AZN8mrMVAovregRn4LO80K3kK8p2u+fECZlgzDnicuZZUdgyOaK81PVeMw031at/rF/CTsHVoSjZpMyBpsvaLipYr5FoNNEQ/+qOtYUGZlYRB1vNUg3DXBjElMUlYXIiievPt1nAi71svUN5M/KyVSDjsOlQAAAIBV7sT7hBZrOKewcfx74Cmb7H2TB82QkIS8+/L1gAtRIZrt+ZERtuV/19vSZEyb2iZGoASyYcEln8Y4nYNsiEvOqDFKQMhXxhOEeq9Y7gfc6Q10MGzoeq92AZiKzS56h0XCcffaHgPEGKF/n5iIM+4/HUhd9NC1FeBf05XYJ8Y3ew=="
62
+ sshfp_dsa: |-
63
+ SSHFP 2 1 411d185f20a52fac9a445bd345b5daba6d35b754
64
+ SSHFP 2 2 6c04acb57142af1d97ee0c4b4c21bc49daafa69093626a9692ee722f9e8ca04c
65
+ sshrsakey: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDLPnpOZX5tHgEbECiAfH3qx/zK2p1QBdVFSYVJSJ5MaoAZNFgP/+Smy2ynlly14ZZUcXS/ulLajlSxzqeB+wyKw2i6MJoRetdW4mBc4F3z9d0mWbnSJjZNHNJSZkdB/xFvBijguU3ZMbRse8s6EwjPDYnhZU4/2VX/eUtKdEwaC8MEpumPKyUv388/cQoTYoUbYVXaVvWCuGobMIwDZLia2Qj06l8HumTgKFak3MR9v1LrPGWZdsPzlb/oeLbpW69kShRnJrfpMrk8zQP+kLNLyEslDwM0c6g85JZldZSOV5e//CoLD+ebr7tyN0HxzsJL0lVnORSV5qCaoT84FzOp"
66
+ sshfp_rsa: |-
67
+ SSHFP 1 1 1841bc4838419cb780ffedd51d283543a2e1b3f1
68
+ SSHFP 1 2 31a2a1a6313855b40c9c0a9c9ff3ec3d7d49b8f697e658f2674019ee816f1ac0
69
+ sshecdsakey: "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGRF+Or1jFrCu/BFPKx018pqsGxpEmBQLYMs7krJnklC4ALVM3LCfms+By5Mx1JKez1KbBr8qvGrv8TM8Tow6go="
70
+ sshfp_ecdsa: |-
71
+ SSHFP 3 1 a90535354b0376a12535ae8054b03fff9604311d
72
+ SSHFP 3 2 045ce9308a493a4d03943f10b9c7fcf3966176d5fed68108c67a6f06953df09f
73
+ facterversion: "2.2.0"
74
+ memorysize: "996.28 MB"
75
+ memoryfree: "625.76 MB"
76
+ swapsize: "0.00 MB"
77
+ swapfree: "0.00 MB"
78
+ swapsize_mb: "0.00"
79
+ swapfree_mb: "0.00"
80
+ memorysize_mb: "996.28"
81
+ memoryfree_mb: "625.76"
82
+ uptime: "2:41 hours"
83
+ path: "/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin"
84
+ filesystems: ext4
85
+ rubysitedir: /usr/local/share/ruby/site_ruby/2.0
86
+ ec2_metadata: "{\x22ami-id\x22=>\x22ami-a10897d6\x22, \x22ami-launch-index\x22=>\x220\x22, \x22ami-manifest-path\x22=>\x22(unknown)\x22, \x22block-device-mapping\x22=>{\x22ami\x22=>\x22/dev/xvda\x22, \x22root\x22=>\x22/dev/xvda\x22}, \x22hostname\x22=>\x22ip-172-16-0-40.eu-west-1.compute.internal\x22, \x22instance-action\x22=>\x22none\x22, \x22instance-id\x22=>\x22i-a2ff6f08\x22, \x22instance-type\x22=>\x22t2.micro\x22, \x22local-hostname\x22=>\x22ip-172-16-0-40.eu-west-1.compute.internal\x22, \x22local-ipv4\x22=>\x22172.16.0.40\x22, \x22mac\x22=>\x2202:c9:9e:5c:d8:15\x22, \x22metrics\x22=>{\x22vhostmd\x22=>\x22<?xml version=\x5c\x221.0\x5c\x22 encoding=\x5c\x22UTF-8\x5c\x22?>\x22}, \x22network\x22=>{\x22interfaces\x22=>{\x22macs\x22=>{\x2202:c9:9e:5c:d8:15\x22=>{\x22device-number\x22=>\x220\x22, \x22interface-id\x22=>\x22eni-0a849c6e\x22, \x22ipv4-associations\x22=>{\x2252.18.54.113\x22=>\x22172.16.0.40\x22}, \x22local-hostname\x22=>\x22ip-172-16-0-40.eu-west-1.compute.internal\x22, \x22local-ipv4s\x22=>\x22172.16.0.40\x22, \x22mac\x22=>\x2202:c9:9e:5c:d8:15\x22, \x22owner-id\x22=>\x22481030032710\x22, \x22public-hostname\x22=>\x22ec2-52-18-54-113.eu-west-1.compute.amazonaws.com\x22, \x22public-ipv4s\x22=>\x2252.18.54.113\x22, \x22security-group-ids\x22=>[\x22sg-573b3b32\x22, \x22sg-543b3b31\x22], \x22security-groups\x22=>[\x22ghm-test-stack-OrdnanceSurveyNetworkSecurityGroup-IROHIDXIWCVT\x22, \x22ghm-test-stack-VpcInternalSecurityGroup-1TUSMI7PRH62T\x22], \x22subnet-id\x22=>\x22subnet-65502d00\x22, \x22subnet-ipv4-cidr-block\x22=>\x22172.16.0.0/24\x22, \x22vpc-id\x22=>\x22vpc-e0971785\x22, \x22vpc-ipv4-cidr-block\x22=>\x22172.16.0.0/16\x22}}}}, \x22placement\x22=>{\x22availability-zone\x22=>\x22eu-west-1a\x22}, \x22profile\x22=>\x22default-hvm\x22, \x22public-hostname\x22=>\x22ec2-52-18-54-113.eu-west-1.compute.amazonaws.com\x22, \x22public-ipv4\x22=>\x2252.18.54.113\x22, \x22public-keys\x22=>{\x220\x22=>{\x22openssh-key\x22=>\x22ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKaz98ns6RbUdMAE1mpKtprGWdiTRtc4S8fujprCTgGeWhrgOu6PP2iMKXtUEAL3urVo6TbiJP+xAasjOk2cIfk1LxvHqLKybMyjmfGg2iPM7r+Joo+U4XYkpDlxq2YxihnuOe/mBXlknQy4AwP+2gEPCothd4FVsc+Tf5wzSq/gLUergJmThWPDPQJSoSzUOAu3ETNpu4wmjavxUIEI2E2h7oKACM5YKHE4cT43TQcoZ9xlyzgsKnJ4BIjapMzAYyM027mzQnv0yyAjb8xToOwJvA2Tc+yOrMxwAQ46RmUKrs2U0TntURoeLDVrbs5lQNNIfNfzEcjwZ2vXcpIWMr wso2dev\x22}}, \x22reservation-id\x22=>\x22r-11c482f5\x22, \x22security-groups\x22=>[\x22ghm-test-stack-OrdnanceSurveyNetworkSecurityGroup-IROHIDXIWCVT\x22, \x22ghm-test-stack-VpcInternalSecurityGroup-1TUSMI7PRH62T\x22], \x22services\x22=>{\x22domain\x22=>\x22amazonaws.com\x22}}"
87
+ ec2_userdata: "#!/bin/bash\n/opt/aws/bin/cfn-init --region eu-west-1 -s ghm-test-stack- -r AMPStoreEC2Instance1\n"
88
+ ec2_ami_id: ami-a10897d6
89
+ ec2_ami_launch_index: "0"
90
+ ec2_ami_manifest_path: "(unknown)"
91
+ ec2_block_device_mapping_ami: /dev/xvda
92
+ ec2_block_device_mapping_root: /dev/xvda
93
+ ec2_hostname: ip-172-16-0-40.eu-west-1.compute.internal
94
+ ec2_instance_action: none
95
+ ec2_instance_id: i-a2ff6f08
96
+ ec2_instance_type: t2.micro
97
+ ec2_local_hostname: ip-172-16-0-40.eu-west-1.compute.internal
98
+ ec2_local_ipv4: "172.16.0.40"
99
+ ec2_mac: "02:c9:9e:5c:d8:15"
100
+ ec2_metrics_vhostmd: "<?xml version=\x221.0\x22 encoding=\x22UTF-8\x22?>"
101
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_device_number": "0"
102
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_interface_id": eni-0a849c6e
103
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_ipv4_associations_52.18.54.113": "172.16.0.40"
104
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_local_hostname": ip-172-16-0-40.eu-west-1.compute.internal
105
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_local_ipv4s": "172.16.0.40"
106
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_mac": "02:c9:9e:5c:d8:15"
107
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_owner_id": "481030032710"
108
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_public_hostname": ec2-52-18-54-113.eu-west-1.compute.amazonaws.com
109
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_public_ipv4s": "52.18.54.113"
110
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_security_group_ids_0": sg-573b3b32
111
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_security_group_ids_1": sg-543b3b31
112
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_security_groups_0": ghm-test-stack-OrdnanceSurveyNetworkSecurityGroup-IROHIDXIWCVT
113
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_security_groups_1": ghm-test-stack-VpcInternalSecurityGroup-1TUSMI7PRH62T
114
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_subnet_id": subnet-65502d00
115
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_subnet_ipv4_cidr_block": "172.16.0.0/24"
116
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_vpc_id": vpc-e0971785
117
+ "ec2_network_interfaces_macs_02:c9:9e:5c:d8:15_vpc_ipv4_cidr_block": "172.16.0.0/16"
118
+ ec2_placement_availability_zone: eu-west-1a
119
+ ec2_profile: default-hvm
120
+ ec2_public_hostname: ec2-52-18-54-113.eu-west-1.compute.amazonaws.com
121
+ ec2_public_ipv4: "52.18.54.113"
122
+ ec2_public_keys_0_openssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKaz98ns6RbUdMAE1mpKtprGWdiTRtc4S8fujprCTgGeWhrgOu6PP2iMKXtUEAL3urVo6TbiJP+xAasjOk2cIfk1LxvHqLKybMyjmfGg2iPM7r+Joo+U4XYkpDlxq2YxihnuOe/mBXlknQy4AwP+2gEPCothd4FVsc+Tf5wzSq/gLUergJmThWPDPQJSoSzUOAu3ETNpu4wmjavxUIEI2E2h7oKACM5YKHE4cT43TQcoZ9xlyzgsKnJ4BIjapMzAYyM027mzQnv0yyAjb8xToOwJvA2Tc+yOrMxwAQ46RmUKrs2U0TntURoeLDVrbs5lQNNIfNfzEcjwZ2vXcpIWMr wso2dev"
123
+ ec2_reservation_id: r-11c482f5
124
+ ec2_security_groups_0: ghm-test-stack-OrdnanceSurveyNetworkSecurityGroup-IROHIDXIWCVT
125
+ ec2_security_groups_1: ghm-test-stack-VpcInternalSecurityGroup-1TUSMI7PRH62T
126
+ ec2_services_domain: amazonaws.com
127
+ fqdn: store1.uk
128
+ rubyversion: "2.0.0"
129
+ hostname: store1
130
+ macaddress: "02:C9:9E:5C:D8:15"
131
+ puppet_vardir: /var/lib/puppet
132
+ store_service_ready: "true"
133
+ root_home: /root
134
+ is_pe: "false"
135
+ clientcert: store1.dev.amp.os.uk
136
+ clientversion: "3.7.4"
137
+ clientnoop: "false"
138
+ "_timestamp": "2015-07-03 10:50:05 +0000"
139
+ environment: AMP_develop
140
+ facts: !ruby/object:Puppet::Node::Facts
141
+ name: store1.dev.amp.os.uk
142
+ values:
143
+ kernel: Linux
144
+ processors: "{\x22models\x22=>[\x22Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz\x22], \x22count\x22=>1, \x22physicalcount\x22=>1}"
145
+ architecture: x86_64
146
+ hardwaremodel: x86_64
147
+ operatingsystem: Amazon
148
+ os: "{\x22name\x22=>\x22Amazon\x22, \x22family\x22=>\x22RedHat\x22, \x22release\x22=>{\x22major\x22=>\x222015\x22, \x22minor\x22=>\x2203\x22, \x22full\x22=>\x222015.03\x22}}"
149
+ processor0: "Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz"
150
+ processorcount: "1"
151
+ partitions: "{\x22xvda1\x22=>{\x22uuid\x22=>\x22e57ff077-2c96-4a37-bd16-1722932e6126\x22, \x22size\x22=>\x2216773087\x22, \x22mount\x22=>\x22/\x22, \x22filesystem\x22=>\x22ext4\x22}}"
152
+ ps: "ps -ef"
153
+ physicalprocessorcount: "1"
154
+ selinux: "false"
155
+ uptime_hours: "2"
156
+ timezone: UTC
157
+ uptime_days: "0"
158
+ blockdevice_xvda_size: "8589934592"
159
+ blockdevices: xvda
160
+ id: root
161
+ network_eth0: "172.16.0.0"
162
+ network_lo: "127.0.0.0"
163
+ kernelmajversion: "3.14"
164
+ uniqueid: "30d5ac36"
165
+ bios_vendor: Xen
166
+ bios_version: "4.2.amazon"
167
+ bios_release_date: "06/01/2015"
168
+ manufacturer: Xen
169
+ productname: "HVM domU"
170
+ serialnumber: ec2848b7-0d30-4115-d7da-567d46de11cd
171
+ uuid: EC2848B7-0D30-4115-D7DA-567D46DE11CD
172
+ type: Other
173
+ operatingsystemrelease: "2015.03"
174
+ uptime_seconds: "9693"
175
+ augeasversion: "1.0.0"
176
+ osfamily: RedHat
177
+ ipaddress: "172.16.0.40"
178
+ kernelversion: "3.14.35"
179
+ virtual: xenhvm
180
+ is_virtual: "true"
181
+ kernelrelease: "3.14.35-28.38.amzn1.x86_64"
182
+ domain: uk
183
+ hardwareisa: x86_64
184
+ puppetversion: "3.7.4"
185
+ interfaces: "eth0,lo"
186
+ ipaddress_eth0: "172.16.0.40"
187
+ macaddress_eth0: "02:C9:9E:5C:D8:15"
188
+ netmask_eth0: "255.255.255.0"
189
+ mtu_eth0: "9001"
190
+ ipaddress_lo: "127.0.0.1"
191
+ netmask_lo: "255.0.0.0"
192
+ mtu_lo: "65536"
193
+ gid: root
194
+ operatingsystemmajrelease: "2015"
195
+ system_uptime: "{\x22seconds\x22=>9693, \x22hours\x22=>2, \x22days\x22=>0, \x22uptime\x22=>\x222:41 hours\x22}"
196
+ netmask: "255.255.255.0"
197
+ facterversion: "2.2.0"
198
+ memorysize: "996.28 MB"
199
+ memoryfree: "625.76 MB"
200
+ swapsize: "0.00 MB"
201
+ swapfree: "0.00 MB"
202
+ swapsize_mb: "0.00"
203
+ swapfree_mb: "0.00"
204
+ memorysize_mb: "996.28"
205
+ memoryfree_mb: "625.76"
206
+ uptime: "2:41 hours"
207
+ path: "/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin"
208
+ filesystems: ext4
209
+ rubysitedir: /usr/local/share/ruby/site_ruby/2.0
210
+ fqdn: store1.uk
211
+ rubyversion: "2.0.0"
212
+ hostname: store1
213
+ macaddress: "02:C9:9E:5C:D8:15"
214
+ puppet_vardir: /var/lib/puppet
215
+ node_ready: "true"
216
+ root_home: /root
217
+ is_pe: "false"
218
+ clientcert: store1.dev.amp.os.uk
219
+ clientversion: "3.7.4"
220
+ clientnoop: "false"
221
+ "_timestamp": "2015-07-03 10:50:05 +0000"
222
+ expiration: 2015-07-03 10:51:05.874073 +00:00
223
+ time: 2015-07-03 10:50:05.931608 +00:00
224
+ environment: AMP_develop
225
+ expiration: 2015-07-03 11:20:05.933271 +00:00
@@ -0,0 +1,3 @@
1
+ require_relative '../lib/fencing/classifier'
2
+ require_relative '../lib/fencing/config'
3
+ require_relative '../lib/fencing/facter_adapter'
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fencing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - George McIntosh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-09 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: :development
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: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: rspec-mocks
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: puppet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
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: 1.8.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.8.0
83
+ description: Releases Puppet configuration for a node dependent on the condition of
84
+ dependent nodes
85
+ email:
86
+ - george@elevenware.com
87
+ executables:
88
+ - fencing
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - LICENSE
93
+ - README.md
94
+ - Rakefile
95
+ - bin/fencing
96
+ - lib/fencing.rb
97
+ - lib/fencing/classifier.rb
98
+ - lib/fencing/config.rb
99
+ - lib/fencing/facter_adapter.rb
100
+ - lib/fencing/node_resolver.rb
101
+ - spec/enc_spec.rb
102
+ - spec/facter_spec.rb
103
+ - spec/fixtures/conf/test_conf.json
104
+ - spec/fixtures/nodedefs/node1.yaml
105
+ - spec/fixtures/nodes/node1.local.uk
106
+ - spec/spec_helper.rb
107
+ homepage: https://github.com/georgecodes/fencing
108
+ licenses:
109
+ - Apache License (2.0)
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.6
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: A Puppet ENC that releases config based on configuration
131
+ test_files:
132
+ - spec/enc_spec.rb
133
+ - spec/facter_spec.rb
134
+ - spec/fixtures/conf/test_conf.json
135
+ - spec/fixtures/nodedefs/node1.yaml
136
+ - spec/fixtures/nodes/node1.local.uk
137
+ - spec/spec_helper.rb