onceover 3.2.2 → 3.2.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 +24 -1
- data/lib/onceover/controlrepo.rb +16 -5
- data/onceover.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b0094b1e1122cb55139f0d0a4357deb58388ab6
|
4
|
+
data.tar.gz: efe48aca14a7ddaa6838f6a4c13c19bc82e2f53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8b58914063953bdf9a4705f718e5db287990bc12d6f37208d881d26726a185c735a8713583510de1a536ffa36f3f5049cccba6cb7a318303d7aa8e15cbb6bb7
|
7
|
+
data.tar.gz: 6cdf239e35493e7391b51e7bea4e01be6bdb384b22a3510c93e6f211d17b0e584a282fb1521d1cbe6ea7d00e123dcd76644c3ba6209abc506c7b1d72253d8fb0
|
data/README.md
CHANGED
@@ -85,7 +85,7 @@ If we are doing acceptance testing then we need information about how to spin up
|
|
85
85
|
|
86
86
|
### onceover.yaml
|
87
87
|
|
88
|
-
`spec/onceover.yaml`
|
88
|
+
`spec/onceover.yaml` _(override with environment variable: `ONCEOVER_YAML`)_
|
89
89
|
|
90
90
|
Hopefully this config file will be fairly self explanatory once you see it, but basically this is the place where we define what classes we want to test and the [factsets](#factsets)/[nodesets](#nodesets) that we want to test them against. The config file must contain the following sections:
|
91
91
|
|
@@ -114,6 +114,25 @@ In the example below we have referred to `centos6a` and `centos7b` in all of our
|
|
114
114
|
- **type** *statement or rvalue*
|
115
115
|
- **returns** *Optional: A value to return*
|
116
116
|
|
117
|
+
**opts** The `opts` section overrides defaults for the `Onceover::Controlrepo` class' `opts` hash.
|
118
|
+
|
119
|
+
```yaml
|
120
|
+
opts:
|
121
|
+
:facts_dirs: # Remember: `opts` keys are symbols!
|
122
|
+
- 'spec/factsets' # Limit factsets to files in this repository
|
123
|
+
:debug: true # set the `logger.level` to debug
|
124
|
+
```
|
125
|
+
|
126
|
+
```yaml
|
127
|
+
opts:
|
128
|
+
# profiles include a legacy module named `site::`
|
129
|
+
:profile_regex: '^(profile|site)::'
|
130
|
+
|
131
|
+
# factset filenames use the extension`.facts` instead of `.json`
|
132
|
+
:facts_files:
|
133
|
+
- 'spec/factsets/*.facts'
|
134
|
+
```
|
135
|
+
|
117
136
|
A full example:
|
118
137
|
|
119
138
|
```yaml
|
@@ -166,6 +185,10 @@ functions:
|
|
166
185
|
query_resources:
|
167
186
|
type: rvalue
|
168
187
|
returns: []
|
188
|
+
|
189
|
+
opts:
|
190
|
+
:facts_dirs:
|
191
|
+
- spec/factsets
|
169
192
|
```
|
170
193
|
|
171
194
|
**Include/Exclude syntax:** This can be used with either `node_groups` or `class_groups` and allows us to save some time by using existing groups to create new ones e.g.
|
data/lib/onceover/controlrepo.rb
CHANGED
@@ -98,24 +98,35 @@ class Onceover
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
@onceover_yaml = ENV['ONCEOVER_YAML'] || opts[:onceover_yaml] || File.expand_path("#{@root}/spec/onceover.yaml")
|
102
|
+
|
103
|
+
if File.exists?(@onceover_yaml) && _data = YAML.load_file(@onceover_yaml)
|
104
|
+
opts.merge!(_data.fetch('opts',{})||{})
|
105
|
+
end
|
106
|
+
opts.fetch(:facts_dir,'').sub!(%r{^[^/.].+} ){|path| File.expand_path(path,@root)}
|
107
|
+
opts.fetch(:facts_files,[]).map!{|path| path =~ %r{^[/.]} ? path : File.expand_path(path, @root)}
|
108
|
+
|
101
109
|
@environmentpath = opts[:environmentpath] || 'etc/puppetlabs/code/environments'
|
102
110
|
@puppetfile = opts[:puppetfile] || File.expand_path('./Puppetfile',@root)
|
103
111
|
@environment_conf = opts[:environment_conf] || File.expand_path('./environment.conf',@root)
|
104
|
-
@facts_dir = opts[:facts_dir] || File.expand_path('./spec/factsets',@root)
|
105
112
|
@spec_dir = opts[:spec_dir] || File.expand_path('./spec',@root)
|
106
|
-
@
|
113
|
+
@facts_dir = opts[:facts_dir] || File.expand_path('factsets',@spec_dir)
|
114
|
+
_facts_dirs = [@facts_dir, File.expand_path('../../../factsets',__FILE__)]
|
115
|
+
_facts_files = opts[:facts_files] || _facts_dirs.map{|d| File.join(d,'*.json')}
|
116
|
+
@facts_files = _facts_files.map{|_path| Dir[_path]}.flatten
|
117
|
+
|
107
118
|
@nodeset_file = opts[:nodeset_file] || File.expand_path('./spec/acceptance/nodesets/onceover-nodes.yml',@root)
|
108
|
-
@role_regex = /role[s]?:{2}/
|
109
|
-
@profile_regex = /profile[s]?:{2}/
|
119
|
+
@role_regex = opts[:role_regex] ? Regexp.new(opts[:role_regex]) : /role[s]?:{2}/
|
120
|
+
@profile_regex = opts[:profile_regex] ? Regexp.new(opts[:profile_regex]) : /profile[s]?:{2}/
|
110
121
|
@tempdir = opts[:tempdir] || File.expand_path('./.onceover',@root)
|
111
122
|
$temp_modulepath = nil
|
112
123
|
@manifest = opts[:manifest] || config['manifest'] ? File.expand_path(config['manifest'],@root) : nil
|
113
|
-
@onceover_yaml = opts[:onceover_yaml] || "#{@spec_dir}/onceover.yaml"
|
114
124
|
@opts = opts
|
115
125
|
logger.level = :debug if @opts[:debug]
|
116
126
|
@@existing_controlrepo = self
|
117
127
|
end
|
118
128
|
|
129
|
+
|
119
130
|
def to_s
|
120
131
|
require 'colored'
|
121
132
|
|
data/onceover.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 = "onceover"
|
6
|
-
s.version = "3.2.
|
6
|
+
s.version = "3.2.3"
|
7
7
|
s.authors = ["Dylan Ratcliffe"]
|
8
8
|
s.email = ["dylan.ratcliffe@puppet.com"]
|
9
9
|
s.homepage = "https://github.com/dylanratcliffe/onceover"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onceover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07
|
11
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|