controlrepo 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/controlrepo.gemspec +2 -1
- data/lib/controlrepo.rb +7 -1
- data/lib/controlrepo/rake_tasks.rb +10 -12
- data/lib/controlrepo/testconfig.rb +4 -10
- metadata +15 -2
- data/templates/Gemfile.erb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f1e530d2aac6db832e66b31b06ccda1536595e
|
4
|
+
data.tar.gz: c4de4272d509eae7a31ea656b6681f524956f6ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df2d05bb540e4b6f287745d563f609ab56ed660a51085100b2ff1890417924a6161d8304e03f4617207768aa206052b3a1e2921359fec71d484a27abe071dec2
|
7
|
+
data.tar.gz: d157c35ed069a7b32dceef4fdecf42f01091d8a71288db187915282dcf816304d84d501b9ac78fc21dbbae284c2f9229f54f47b1f2ba67875e119d8f7fdd302a
|
data/README.md
CHANGED
@@ -44,16 +44,20 @@ Install all the gems:
|
|
44
44
|
Add this to your [Rakefile](#rake-tasks):
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
require '
|
47
|
+
require 'controlrepo/rake_tasks'
|
48
48
|
```
|
49
49
|
|
50
|
+
Create directories:
|
51
|
+
|
52
|
+
`mkdir -p spec/acceptance/nodesets`
|
53
|
+
|
50
54
|
Generate your [controlrepo.yaml](#controlrepoyaml):
|
51
55
|
|
52
56
|
`bundle exec rake generate_controlrepo_yaml > spec/controlrepo.yaml`
|
53
57
|
|
54
58
|
Generate your [nodesets](#nodesets):
|
55
59
|
|
56
|
-
`bundle exec rake generate_nodesets > spec/acceptance/controlrepo-nodes.yml`
|
60
|
+
`bundle exec rake generate_nodesets > spec/acceptance/nodesets/controlrepo-nodes.yml`
|
57
61
|
|
58
62
|
*Optional:* [Get hiera working](#hiera-data)
|
59
63
|
|
data/controlrepo.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "controlrepo"
|
6
|
-
s.version = "2.0.
|
6
|
+
s.version = "2.0.3"
|
7
7
|
s.authors = ["Dylan Ratcliffe"]
|
8
8
|
s.email = ["dylan.ratcliffe@puppetlabs.com"]
|
9
9
|
s.homepage = ""
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency 'json'
|
21
21
|
s.add_runtime_dependency 'beaker-rspec'
|
22
22
|
s.add_runtime_dependency 'rspec-puppet'
|
23
|
+
s.add_runtime_dependency 'puppetlabs_spec_helper'
|
23
24
|
s.add_runtime_dependency 'rspec'
|
24
25
|
s.add_runtime_dependency 'bundler'
|
25
26
|
s.add_runtime_dependency 'r10k'
|
data/lib/controlrepo.rb
CHANGED
@@ -107,6 +107,8 @@ class Controlrepo
|
|
107
107
|
spec_dir: #{@spec_dir}
|
108
108
|
facts_files: #{@facts_files}
|
109
109
|
nodeset_file: #{@nodeset_file}
|
110
|
+
roles: #{roles}
|
111
|
+
profiles #{profiles}
|
110
112
|
END
|
111
113
|
end
|
112
114
|
|
@@ -228,7 +230,8 @@ class Controlrepo
|
|
228
230
|
begin
|
229
231
|
YAML.load_file(hiera_config_file)
|
230
232
|
rescue TypeError
|
231
|
-
|
233
|
+
puts "WARNING: Could not find hiera config file, continuing"
|
234
|
+
nil
|
232
235
|
end
|
233
236
|
end
|
234
237
|
|
@@ -250,6 +253,9 @@ class Controlrepo
|
|
250
253
|
env_conf = File.read(@environment_conf)
|
251
254
|
env_conf = env_conf.split("\n")
|
252
255
|
|
256
|
+
# Delete commented out lines
|
257
|
+
env_conf.delete_if { |l| l =~ /^\s*#/}
|
258
|
+
|
253
259
|
# Map the lines into a hash
|
254
260
|
environment_config = {}
|
255
261
|
env_conf.each do |line|
|
@@ -102,9 +102,6 @@ task :controlrepo_autotest_prep do
|
|
102
102
|
# Create spec_helper_accpetance.rb
|
103
103
|
@config.write_spec_helper_acceptance("#{@repo.tempdir}/spec",@repo)
|
104
104
|
|
105
|
-
# Create Gemfile
|
106
|
-
@config.write_gemfile(@repo.tempdir)
|
107
|
-
|
108
105
|
# Deduplicate and write the tests (Spec and Acceptance)
|
109
106
|
Controlrepo::Test.deduplicate(@config.spec_tests).each do |test|
|
110
107
|
@config.write_spec_test("#{@repo.tempdir}/spec/classes",test)
|
@@ -113,16 +110,17 @@ task :controlrepo_autotest_prep do
|
|
113
110
|
@config.write_acceptance_tests("#{@repo.tempdir}/spec/acceptance",Controlrepo::Test.deduplicate(@config.acceptance_tests))
|
114
111
|
|
115
112
|
# Parse the current hiera config, modify, and write it to the temp dir
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
if value.
|
120
|
-
|
113
|
+
unless @repo.hiera_config ==nil
|
114
|
+
hiera_config = @repo.hiera_config
|
115
|
+
hiera_config.each do |setting,value|
|
116
|
+
if value.is_a?(Hash)
|
117
|
+
if value.has_key?(:datadir)
|
118
|
+
hiera_config[setting][:datadir] = "#{@repo.temp_environmentpath}/#{@config.environment}/#{value[:datadir]}"
|
119
|
+
end
|
121
120
|
end
|
122
121
|
end
|
122
|
+
File.write("#{@repo.temp_environmentpath}/#{@config.environment}/hiera.yaml",hiera_config.to_yaml)
|
123
123
|
end
|
124
|
-
binding.pry
|
125
|
-
File.write("#{@repo.temp_environmentpath}/#{@config.environment}/hiera.yaml",hiera_config.to_yaml)
|
126
124
|
|
127
125
|
@config.create_fixtures_symlinks(@repo)
|
128
126
|
end
|
@@ -131,7 +129,7 @@ task :controlrepo_autotest_spec do
|
|
131
129
|
Dir.chdir(@repo.tempdir) do
|
132
130
|
#`bundle install --binstubs`
|
133
131
|
#`bin/rake spec_standalone`
|
134
|
-
exec("bundle
|
132
|
+
exec("bundle exec rake spec_standalone")
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
@@ -139,7 +137,7 @@ task :controlrepo_autotest_acceptance do
|
|
139
137
|
Dir.chdir(@repo.tempdir) do
|
140
138
|
#`bundle install --binstubs`
|
141
139
|
#`bin/rake spec_standalone`
|
142
|
-
exec("bundle
|
140
|
+
exec("bundle exec rake acceptance")
|
143
141
|
end
|
144
142
|
end
|
145
143
|
|
@@ -37,10 +37,10 @@ class Controlrepo
|
|
37
37
|
@node_groups << Controlrepo::Group.new('all_nodes',@nodes)
|
38
38
|
@class_groups << Controlrepo::Group.new('all_classes',@classes)
|
39
39
|
|
40
|
-
config['classes'].each { |clarse| @classes << Controlrepo::Class.new(clarse) }
|
41
|
-
config['nodes'].each { |node| @nodes << Controlrepo::Node.new(node) }
|
42
|
-
config['node_groups'].each { |name, members| @node_groups << Controlrepo::Group.new(name, members) }
|
43
|
-
config['class_groups'].each { |name, members| @class_groups << Controlrepo::Group.new(name, members) }
|
40
|
+
config['classes'].each { |clarse| @classes << Controlrepo::Class.new(clarse) } unless config['classes'] == nil
|
41
|
+
config['nodes'].each { |node| @nodes << Controlrepo::Node.new(node) } unless config['nodes'] == nil
|
42
|
+
config['node_groups'].each { |name, members| @node_groups << Controlrepo::Group.new(name, members) } unless config['node_groups'] == nil
|
43
|
+
config['class_groups'].each { |name, members| @class_groups << Controlrepo::Group.new(name, members) } unless config['class_groups'] == nil
|
44
44
|
|
45
45
|
config['test_matrix'].each do |test_hash|
|
46
46
|
test_hash.each do |machines, settings|
|
@@ -159,12 +159,6 @@ class Controlrepo
|
|
159
159
|
File.write("#{location}/Rakefile",ERB.new(rakefile_template, nil, '-').result(binding))
|
160
160
|
end
|
161
161
|
|
162
|
-
def write_gemfile(location)
|
163
|
-
template_dir = File.expand_path('../../templates',File.dirname(__FILE__))
|
164
|
-
gemfile_template = File.read(File.expand_path('./Gemfile.erb',template_dir))
|
165
|
-
File.write("#{location}/Gemfile",ERB.new(gemfile_template, nil, '-').result(binding))
|
166
|
-
end
|
167
|
-
|
168
162
|
def write_spec_helper(location, repo)
|
169
163
|
environmentpath = repo.temp_environmentpath
|
170
164
|
modulepath = repo.config['modulepath']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controlrepo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: puppetlabs_spec_helper
|
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'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +179,6 @@ files:
|
|
165
179
|
- lib/controlrepo/test.rb
|
166
180
|
- lib/controlrepo/testconfig.rb
|
167
181
|
- templates/.fixtures.yml.erb
|
168
|
-
- templates/Gemfile.erb
|
169
182
|
- templates/Rakefile.erb
|
170
183
|
- templates/acceptance_test_spec.rb.erb
|
171
184
|
- templates/controlrepo.yaml.erb
|
data/templates/Gemfile.erb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
group :spec do
|
4
|
-
gem 'rspec-puppet'
|
5
|
-
gem 'puppetlabs_spec_helper'
|
6
|
-
end
|
7
|
-
|
8
|
-
group :acceptance do
|
9
|
-
gem 'beaker-rspec'
|
10
|
-
gem 'controlrepo', :git => 'https://github.com/dylanratcliffe/controlrepo_gem.git'
|
11
|
-
end
|
12
|
-
|
13
|
-
gem 'rake'
|