onceover 3.21.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +4 -6
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/release.yaml +32 -0
- data/.github/workflows/tests.yaml +30 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +4 -704
- data/.rubocop_todo.yml +828 -0
- data/CHANGELOG.md +1036 -0
- data/Gemfile +9 -0
- data/LICENSE +202 -0
- data/README.md +122 -32
- data/Rakefile +24 -14
- data/cucumber.yml +1 -0
- data/features/auto_vendored.feature +27 -0
- data/features/step_definitions/common.rb +5 -5
- data/features/step_definitions/run.rb +4 -0
- data/features/support/cache_helper.rb +0 -1
- data/features/support/command_helper.rb +0 -2
- data/features/support/controlrepo_helper.rb +0 -2
- data/features/zzz_run.feature +1 -8
- data/lib/onceover/beaker/spec_helper.rb +9 -9
- data/lib/onceover/beaker.rb +9 -12
- data/lib/onceover/cli/run.rb +1 -0
- data/lib/onceover/controlrepo.rb +22 -27
- data/lib/onceover/deploy.rb +30 -3
- data/lib/onceover/group.rb +1 -3
- data/lib/onceover/logger.rb +3 -3
- data/lib/onceover/node.rb +0 -2
- data/lib/onceover/rake_tasks.rb +9 -4
- data/lib/onceover/rspec/formatters.rb +5 -8
- data/lib/onceover/runner.rb +1 -1
- data/lib/onceover/test.rb +2 -3
- data/lib/onceover/testconfig.rb +2 -2
- data/lib/onceover/vendored_modules.rb +186 -0
- data/onceover.gemspec +26 -30
- data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +1 -1
- data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +1 -1
- data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +1 -1
- data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile +3 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile.cron +5 -0
- data/spec/fixtures/controlrepos/vendored/environment.conf +1 -0
- data/spec/fixtures/controlrepos/vendored/site-modules/role/manifests/cron.pp +9 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json +1 -0
- data/spec/onceover/controlrepo_spec.rb +1 -1
- data/templates/factsets_README.md.erb +1 -1
- data/templates/pre_conditions_README.md.erb +1 -1
- data/templates/spec_helper.rb.erb +0 -2
- data/templates/test_spec.rb.erb +3 -0
- metadata +173 -68
- data/.gitmodules +0 -4
data/features/zzz_run.feature
CHANGED
@@ -38,14 +38,7 @@ Feature: Run rspec and acceptance test suites
|
|
38
38
|
When I run onceover command "run spec"
|
39
39
|
Then I should see error with message pattern "The module acme-not_exists does not exist"
|
40
40
|
|
41
|
-
|
42
|
-
# Scenario: Run with local modifications
|
43
|
-
# Given initialized control repo "basic"
|
44
|
-
# When I run onceover command "run spec"
|
45
|
-
# And I make local modifications
|
46
|
-
# And I run onceover command "run spec"
|
47
|
-
# Then I should see message pattern "local modifications"
|
48
|
-
|
41
|
+
@skip_on_windows
|
49
42
|
Scenario: Force overwrite local modifications
|
50
43
|
Given initialized control repo "basic"
|
51
44
|
When I run onceover command "run spec"
|
@@ -35,18 +35,18 @@ RSpec.configure do |c|
|
|
35
35
|
|
36
36
|
#default option values
|
37
37
|
defaults = {
|
38
|
-
:nodeset
|
38
|
+
:nodeset => 'onceover-nodes',
|
39
39
|
}
|
40
40
|
#read env vars
|
41
41
|
env_vars = {
|
42
|
-
:color
|
43
|
-
:nodeset
|
44
|
-
:nodesetfile => ENV['BEAKER_setfile'] || ENV
|
45
|
-
:provision
|
46
|
-
:keyfile
|
47
|
-
:debug
|
48
|
-
:destroy
|
49
|
-
}.
|
42
|
+
:color => ENV['BEAKER_color'] || ENV.fetch('RS_COLOR', nil),
|
43
|
+
:nodeset => ENV['BEAKER_set'] || ENV.fetch('RS_SET', nil),
|
44
|
+
:nodesetfile => ENV['BEAKER_setfile'] || ENV.fetch('RS_SETFILE', nil),
|
45
|
+
:provision => ENV['BEAKER_provision'] || ENV.fetch('RS_PROVISION', nil),
|
46
|
+
:keyfile => ENV['BEAKER_keyfile'] || ENV.fetch('RS_KEYFILE', nil),
|
47
|
+
:debug => ENV['BEAKER_debug'] || ENV.fetch('RS_DEBUG', nil),
|
48
|
+
:destroy => ENV['BEAKER_destroy'] || ENV.fetch('RS_DESTROY', nil),
|
49
|
+
}.compact
|
50
50
|
#combine defaults and env_vars to determine overall options
|
51
51
|
options = defaults.merge(env_vars)
|
52
52
|
|
data/lib/onceover/beaker.rb
CHANGED
@@ -11,9 +11,8 @@ class Onceover
|
|
11
11
|
# se or an array
|
12
12
|
|
13
13
|
if facts.is_a?(Array)
|
14
|
-
returnval =
|
15
|
-
|
16
|
-
returnval << self.facts_to_vagrant_box(fact)
|
14
|
+
returnval = facts.map do |fact|
|
15
|
+
self.facts_to_vagrant_box(fact)
|
17
16
|
end
|
18
17
|
return returnval
|
19
18
|
end
|
@@ -64,9 +63,8 @@ class Onceover
|
|
64
63
|
warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
|
65
64
|
|
66
65
|
if facts.is_a?(Array)
|
67
|
-
returnval =
|
68
|
-
|
69
|
-
returnval << self.facts_to_platform(fact)
|
66
|
+
returnval = facts.map do |fact|
|
67
|
+
self.facts_to_platform(fact)
|
70
68
|
end
|
71
69
|
return returnval
|
72
70
|
end
|
@@ -131,9 +129,9 @@ class Onceover
|
|
131
129
|
|
132
130
|
# Do an r10k deploy
|
133
131
|
r10k_deploy(host, {
|
134
|
-
|
135
|
-
|
136
|
-
|
132
|
+
:puppetfile => true,
|
133
|
+
:configfile => '/tmp/r10k.yaml',
|
134
|
+
})
|
137
135
|
end
|
138
136
|
|
139
137
|
# This actually provisions a node and checks that puppet will be able to run and
|
@@ -153,7 +151,6 @@ class Onceover
|
|
153
151
|
opts = {:check_idempotency => true}.merge(opts)
|
154
152
|
opts = {:deploy_controlrepo => true}.merge(opts)
|
155
153
|
|
156
|
-
|
157
154
|
raise "Hosts must be a single host object, not an array" if host.is_a?(Array)
|
158
155
|
raise "Class must be a single Class [String], not an array" unless puppet_class.is_a?(String)
|
159
156
|
|
@@ -216,8 +213,8 @@ class Onceover
|
|
216
213
|
# to refer to each key as either a string or an object
|
217
214
|
current_opts.default_proc = proc do |h, k|
|
218
215
|
case k
|
219
|
-
|
220
|
-
|
216
|
+
when String then sym = k.to_sym; h[sym] if h.key?(sym)
|
217
|
+
when Symbol then str = k.to_s; h[str] if h.key?(str)
|
221
218
|
end
|
222
219
|
end
|
223
220
|
|
data/lib/onceover/cli/run.rb
CHANGED
@@ -44,6 +44,7 @@ This includes deploying using r10k and running all custom tests.
|
|
44
44
|
optional nil, :format, 'Which RSpec formatter to use, valid options are: documentation, progress, FailureCollector, OnceoverFormatter. You also specify this multiple times', multiple: true, default: :defaults
|
45
45
|
optional nil, :no_workarounds, 'Disables workarounds that have been added for convenience to get around common RSPec issues such as https://github.com/rodjek/rspec-puppet/issues/665'
|
46
46
|
optional :ff, :fail_fast, 'Abort the run after the first failure'
|
47
|
+
optional nil, :auto_vendored, 'Attempt to resolve vendored puppet modules. Ex: puppetlabs/cron_core', default: false
|
47
48
|
|
48
49
|
run do |opts, args, cmd|
|
49
50
|
repo = Onceover::Controlrepo.new(opts)
|
data/lib/onceover/controlrepo.rb
CHANGED
@@ -119,7 +119,7 @@ class Onceover
|
|
119
119
|
@spec_dir = opts[:spec_dir] || File.expand_path('./spec', @root)
|
120
120
|
@facts_dir = opts[:facts_dir] || File.expand_path('factsets', @spec_dir)
|
121
121
|
_facts_dirs = [@facts_dir, File.expand_path('../../factsets', __dir__)]
|
122
|
-
_facts_files = opts[:facts_files]
|
122
|
+
_facts_files = opts[:facts_files] || _facts_dirs.map{|d| File.join(d, '*.json')}
|
123
123
|
@facts_files = _facts_files.map{|_path| Dir[_path]}.flatten
|
124
124
|
|
125
125
|
@nodeset_file = opts[:nodeset_file] || File.expand_path('./spec/acceptance/nodesets/onceover-nodes.yml', @root)
|
@@ -139,7 +139,6 @@ class Onceover
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
|
143
142
|
def to_s
|
144
143
|
require 'colored'
|
145
144
|
|
@@ -182,9 +181,8 @@ class Onceover
|
|
182
181
|
end
|
183
182
|
|
184
183
|
# Get all the classes from all of the manifests
|
185
|
-
classes =
|
186
|
-
|
187
|
-
classes << get_classes(dir)
|
184
|
+
classes = code_dirs.map do |dir|
|
185
|
+
get_classes(dir)
|
188
186
|
end
|
189
187
|
classes.flatten
|
190
188
|
end
|
@@ -208,9 +206,8 @@ class Onceover
|
|
208
206
|
raise "Filter param must be a hash" unless filter.is_a?(Hash)
|
209
207
|
|
210
208
|
all_facts.keep_if do |hash|
|
211
|
-
matches =
|
212
|
-
|
213
|
-
matches << keypair_is_in_hash(hash,filter_fact,value)
|
209
|
+
matches = filter.map do |filter_fact,value|
|
210
|
+
keypair_is_in_hash(hash,filter_fact,value)
|
214
211
|
end
|
215
212
|
!matches.include? false
|
216
213
|
end
|
@@ -231,10 +228,9 @@ class Onceover
|
|
231
228
|
puppetfile.load!
|
232
229
|
|
233
230
|
output_array = []
|
234
|
-
threads = []
|
235
231
|
error_array = []
|
236
|
-
puppetfile.modules.
|
237
|
-
|
232
|
+
threads = puppetfile.modules.map do |mod|
|
233
|
+
Thread.new do
|
238
234
|
begin
|
239
235
|
row = []
|
240
236
|
logger.debug "Loading data for #{mod.full_name}"
|
@@ -268,7 +264,7 @@ class Onceover
|
|
268
264
|
"PatchLevel_minor".green
|
269
265
|
else
|
270
266
|
"No".green
|
271
|
-
|
267
|
+
end
|
272
268
|
|
273
269
|
row << mod.v3_module.endorsement
|
274
270
|
superseded_by = mod.v3_module.superseded_by
|
@@ -290,8 +286,8 @@ class Onceover
|
|
290
286
|
error_array << error
|
291
287
|
logger.debug "Error loading module #{mod.full_name} - #{e.inspect}"
|
292
288
|
end
|
293
|
-
end
|
294
289
|
end
|
290
|
+
end
|
295
291
|
|
296
292
|
threads.map(&:join)
|
297
293
|
|
@@ -313,13 +309,12 @@ class Onceover
|
|
313
309
|
# TODO: Make sure we can deal with :latest
|
314
310
|
|
315
311
|
# Create threading resources
|
316
|
-
|
317
|
-
queue = Queue.new
|
312
|
+
queue = Queue.new
|
318
313
|
queue.push(puppetfile_string)
|
319
314
|
|
320
315
|
puppetfile.modules.keep_if {|m| m.is_a?(R10K::Module::Forge)}
|
321
|
-
puppetfile.modules.
|
322
|
-
|
316
|
+
threads = puppetfile.modules.map do |mod|
|
317
|
+
Thread.new do
|
323
318
|
logger.debug "Getting latest version of #{mod.full_name}"
|
324
319
|
latest_version = mod.v3_module.current_release.version
|
325
320
|
|
@@ -360,14 +355,14 @@ class Onceover
|
|
360
355
|
# Set it up as a symlink, because we are using local files in the Puppetfile
|
361
356
|
symlinks << {
|
362
357
|
'name' => mod.name,
|
363
|
-
'dir'
|
358
|
+
'dir' => mod.expected_version[:path]
|
364
359
|
}
|
365
360
|
elsif mod.expected_version.is_a?(String)
|
366
361
|
# Set it up as a normal forge module
|
367
362
|
forge_modules << {
|
368
363
|
'name' => mod.name,
|
369
364
|
'repo' => mod.title,
|
370
|
-
'ref'
|
365
|
+
'ref' => mod.expected_version
|
371
366
|
}
|
372
367
|
end
|
373
368
|
elsif mod.is_a? R10K::Module::Git
|
@@ -377,7 +372,7 @@ class Onceover
|
|
377
372
|
# I know I shouldn't be doing this, but trust me, there are no methods
|
378
373
|
# anywhere that expose this value, I looked.
|
379
374
|
'repo' => mod.instance_variable_get(:@remote),
|
380
|
-
'ref'
|
375
|
+
'ref' => mod.version
|
381
376
|
}
|
382
377
|
end
|
383
378
|
end
|
@@ -392,7 +387,7 @@ class Onceover
|
|
392
387
|
Dir["#{dir}/*"].each do |mod|
|
393
388
|
symlinks << {
|
394
389
|
'name' => File.basename(mod),
|
395
|
-
'dir'
|
390
|
+
'dir' => Pathname.new(File.expand_path(mod)).relative_path_from(Pathname.new(@root))#File.expand_path(mod)
|
396
391
|
}
|
397
392
|
end
|
398
393
|
end
|
@@ -517,7 +512,7 @@ class Onceover
|
|
517
512
|
# Add .onceover to Gitignore
|
518
513
|
gitignore_path = File.expand_path('.gitignore', repo.root)
|
519
514
|
if File.exist? gitignore_path
|
520
|
-
gitignore_content = (File.
|
515
|
+
gitignore_content = (File.read(gitignore_path)).split("\n")
|
521
516
|
message = "#{'changed'.green}"
|
522
517
|
else
|
523
518
|
message = "#{'created'.green}"
|
@@ -526,7 +521,7 @@ class Onceover
|
|
526
521
|
|
527
522
|
unless gitignore_content.include?(".onceover")
|
528
523
|
gitignore_content << ".onceover\n"
|
529
|
-
File.
|
524
|
+
File.write(gitignore_path, gitignore_content.join("\n"))
|
530
525
|
puts "#{message} #{Pathname.new(gitignore_path).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
|
531
526
|
end
|
532
527
|
end
|
@@ -574,9 +569,9 @@ class Onceover
|
|
574
569
|
# Add the resulting info to the hosts hash. This is what the
|
575
570
|
# template will output
|
576
571
|
hosts_hash[node_name] = {
|
577
|
-
:platform
|
578
|
-
:boxname
|
579
|
-
:url
|
572
|
+
:platform => platform,
|
573
|
+
:boxname => boxname,
|
574
|
+
:url => url,
|
580
575
|
:comment_out => comment_out
|
581
576
|
}
|
582
577
|
end
|
@@ -611,7 +606,7 @@ class Onceover
|
|
611
606
|
if File.exist?(out_file)
|
612
607
|
puts "#{'skipped'.yellow} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s} #{'(exists)'.yellow}"
|
613
608
|
else
|
614
|
-
File.
|
609
|
+
File.write(out_file, contents)
|
615
610
|
puts "#{'created'.green} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
|
616
611
|
end
|
617
612
|
end
|
data/lib/onceover/deploy.rb
CHANGED
@@ -13,6 +13,10 @@ class Onceover
|
|
13
13
|
skip_r10k_default = !(File.file?(repo.puppetfile))
|
14
14
|
skip_r10k = opts[:skip_r10k] || skip_r10k_default
|
15
15
|
force = opts[:force] || false
|
16
|
+
# Only attempt to resolve vendored modules if configured to do so
|
17
|
+
auto_vendored = opts[:auto_vendored] || false
|
18
|
+
|
19
|
+
require 'onceover/vendored_modules' if auto_vendored
|
16
20
|
|
17
21
|
if repo.tempdir == nil
|
18
22
|
repo.tempdir = Dir.mktmpdir('r10k')
|
@@ -63,7 +67,11 @@ class Onceover
|
|
63
67
|
# add to list of files copied to cache by onceover
|
64
68
|
onceover_manifest << relative_source
|
65
69
|
|
66
|
-
if File.
|
70
|
+
if File.symlink?(source)
|
71
|
+
# Handle symlinks
|
72
|
+
link_target = File.readlink(source) # Get the target of the symlink
|
73
|
+
FileUtils.ln_s link_target, target, force: true # Create symlink at target
|
74
|
+
elsif File.directory? source
|
67
75
|
Find.prune if excluded_dirs.include? source
|
68
76
|
FileUtils.mkdir target
|
69
77
|
else
|
@@ -89,8 +97,27 @@ class Onceover
|
|
89
97
|
# Avoid touching thing if we don't need to
|
90
98
|
if /:control_branch/.match(puppetfile_contents)
|
91
99
|
logger.debug "replacing :control_branch mentions in the Puppetfile with #{git_branch}"
|
92
|
-
new_puppetfile_contents = puppetfile_contents.gsub(
|
93
|
-
File.write("#{temp_controlrepo}/Puppetfile", new_puppetfile_contents)
|
100
|
+
new_puppetfile_contents = puppetfile_contents.gsub(":control_branch", "'#{git_branch}'")
|
101
|
+
File.write("#{temp_controlrepo}/Puppetfile", new_puppetfile_contents)
|
102
|
+
end
|
103
|
+
|
104
|
+
if auto_vendored
|
105
|
+
tmp_puppetfile = File.join(temp_controlrepo, 'Puppetfile')
|
106
|
+
tmp_puppetfile_contents = File.read(tmp_puppetfile)
|
107
|
+
vm = Onceover::VendoredModules.new({ repo: repo })
|
108
|
+
puppetfile = R10K::ModuleLoader::Puppetfile.new(basedir: temp_controlrepo)
|
109
|
+
vm.puppetfile_missing_vendored(puppetfile)
|
110
|
+
unless vm.missing_vendored.empty?
|
111
|
+
missing_slugs = vm.missing_vendored.map do |missing_mod|
|
112
|
+
missing_mod.keys[0]
|
113
|
+
end
|
114
|
+
logger.debug "Adding #{missing_slugs} to #{tmp_puppetfile}"
|
115
|
+
modlines = vm.missing_vendored.map do |missing_mod|
|
116
|
+
mod_slug = missing_mod.keys[0]
|
117
|
+
"mod '#{mod_slug}',\n git: '#{missing_mod[mod_slug][:git]}',\n ref: '#{missing_mod[mod_slug][:ref]}'"
|
118
|
+
end.join("\n")
|
119
|
+
File.write(tmp_puppetfile, "#{tmp_puppetfile_contents}\n# Onceover Managed Vendored Modules\n#{modlines}")
|
120
|
+
end
|
94
121
|
end
|
95
122
|
end
|
96
123
|
|
data/lib/onceover/group.rb
CHANGED
@@ -28,10 +28,8 @@ class Onceover
|
|
28
28
|
@members = []
|
29
29
|
else
|
30
30
|
# Turn it into a full list
|
31
|
-
member_objects = []
|
32
|
-
|
33
31
|
# This should also handle lists that include groups
|
34
|
-
members.
|
32
|
+
member_objects = members.map { |member| Onceover::TestConfig.find_list(member) }
|
35
33
|
member_objects.flatten!
|
36
34
|
|
37
35
|
# Check that they are all the same type
|
data/lib/onceover/logger.rb
CHANGED
@@ -8,8 +8,8 @@ module Onceover::Logger
|
|
8
8
|
'bright',
|
9
9
|
:levels => {
|
10
10
|
:debug => :cyan,
|
11
|
-
:info
|
12
|
-
:warn
|
11
|
+
:info => :green,
|
12
|
+
:warn => :yellow,
|
13
13
|
:error => :red,
|
14
14
|
:fatal => [:white, :on_red]
|
15
15
|
}
|
@@ -18,7 +18,7 @@ module Onceover::Logger
|
|
18
18
|
Logging.appenders.stdout(
|
19
19
|
'stdout',
|
20
20
|
:layout => Logging.layouts.pattern(
|
21
|
-
:pattern
|
21
|
+
:pattern => '%l\t -> %m\n',
|
22
22
|
:color_scheme => 'bright'
|
23
23
|
)
|
24
24
|
)
|
data/lib/onceover/node.rb
CHANGED
data/lib/onceover/rake_tasks.rb
CHANGED
@@ -4,7 +4,6 @@ require 'pathname'
|
|
4
4
|
@repo = nil
|
5
5
|
@config = nil
|
6
6
|
|
7
|
-
|
8
7
|
desc 'Writes a `fixtures.yml` file based on the Puppetfile'
|
9
8
|
task :generate_fixtures do
|
10
9
|
repo = Onceover::Controlrepo.new
|
@@ -15,7 +14,6 @@ task :generate_fixtures do
|
|
15
14
|
File.write(File.expand_path('./.fixtures.yml', repo.root), repo.fixtures)
|
16
15
|
end
|
17
16
|
|
18
|
-
|
19
17
|
desc "Modifies your `hiera.yaml` to point at the hieradata relative to its position."
|
20
18
|
task :hiera_setup do
|
21
19
|
repo = Onceover::Controlrepo.new
|
@@ -45,7 +43,6 @@ task :generate_onceover_yaml do
|
|
45
43
|
puts ERB.new(onceover_yaml_template, nil, '-').result(binding)
|
46
44
|
end
|
47
45
|
|
48
|
-
|
49
46
|
task :generate_nodesets do
|
50
47
|
warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
|
51
48
|
|
@@ -75,7 +72,7 @@ task :generate_nodesets do
|
|
75
72
|
comment_out = false
|
76
73
|
box_info = MultiJson.load(response.body)
|
77
74
|
box_info['current_version']['providers'].each do |provider|
|
78
|
-
if
|
75
|
+
if provider['name'] == 'virtualbox'
|
79
76
|
url = provider['original_url']
|
80
77
|
end
|
81
78
|
end
|
@@ -86,5 +83,13 @@ task :generate_nodesets do
|
|
86
83
|
fixtures_template = File.read(File.expand_path('./nodeset.yaml.erb', template_dir))
|
87
84
|
puts ERB.new(fixtures_template, nil, '-').result(binding)
|
88
85
|
end
|
86
|
+
end
|
87
|
+
|
88
|
+
desc 'Create cache for vendored modules'
|
89
|
+
task :generate_vendor_cache do
|
90
|
+
require 'onceover/controlrepo'
|
91
|
+
require 'onceover/vendored_modules'
|
89
92
|
|
93
|
+
repo = Onceover::Controlrepo.new(debug: true)
|
94
|
+
Onceover::VendoredModules.new({ repo: repo, cachedir: File.join(repo.spec_dir, 'vendored_modules'), force_update: true })
|
90
95
|
end
|
@@ -127,9 +127,9 @@ class OnceoverFormatter
|
|
127
127
|
|
128
128
|
scanned_errors.map do |error_matches|
|
129
129
|
{
|
130
|
-
text:
|
131
|
-
file:
|
132
|
-
line:
|
130
|
+
text: error_matches[0],
|
131
|
+
file: calculate_relative_source(error_matches[1]),
|
132
|
+
line: error_matches[2],
|
133
133
|
column: error_matches[3],
|
134
134
|
}
|
135
135
|
end
|
@@ -223,7 +223,6 @@ class OnceoverFormatter
|
|
223
223
|
def longest_group
|
224
224
|
RSpec.configuration.world.example_groups.max { |a,b| a.description.length <=> b.description.length}.description.length
|
225
225
|
end
|
226
|
-
|
227
226
|
end
|
228
227
|
|
229
228
|
class OnceoverFormatterParallel < OnceoverFormatter
|
@@ -266,9 +265,7 @@ class OnceoverFormatterParallel < OnceoverFormatter
|
|
266
265
|
FileUtils.mkdir_p "#{RSpec.configuration.onceover_tempdir}/parallel"
|
267
266
|
|
268
267
|
# Dump the notification to a unique file
|
269
|
-
File.
|
270
|
-
file.write(extract_failures(notification).to_yaml)
|
271
|
-
end
|
268
|
+
File.write("#{RSpec.configuration.onceover_tempdir}/parallel/results-#{random_string}.yaml", extract_failures(notification).to_yaml)
|
272
269
|
end
|
273
270
|
|
274
271
|
def output_results(directory)
|
@@ -280,7 +277,7 @@ class OnceoverFormatterParallel < OnceoverFormatter
|
|
280
277
|
# Merge data
|
281
278
|
roles = files.reduce({}) do |errs, file|
|
282
279
|
# Read all files and merge them
|
283
|
-
errs.merge(YAML.
|
280
|
+
errs.merge(YAML.load_file(file)) {|key, oldval, newval| [oldval, newval].flatten }
|
284
281
|
end
|
285
282
|
|
286
283
|
# Delete files from the disk
|
data/lib/onceover/runner.rb
CHANGED
@@ -78,7 +78,7 @@ class Onceover
|
|
78
78
|
Dir.chdir(@repo.tempdir) do
|
79
79
|
# Disable warnings unless we are running in debug mode
|
80
80
|
unless logger.level.zero?
|
81
|
-
previous_rubyopt = ENV
|
81
|
+
previous_rubyopt = ENV.fetch('RUBYOPT', nil)
|
82
82
|
ENV['RUBYOPT'] = ENV['RUBYOPT'].to_s + ' -W0'
|
83
83
|
end
|
84
84
|
|
data/lib/onceover/test.rb
CHANGED
@@ -12,9 +12,8 @@ class Onceover
|
|
12
12
|
# it will then detect them and expand them out into their respective objects so that
|
13
13
|
# we just end up with a list of nodes and classes
|
14
14
|
def initialize(on_this, test_this, test_config)
|
15
|
-
|
16
15
|
@default_test_config = {
|
17
|
-
'check_idempotency'
|
16
|
+
'check_idempotency' => true,
|
18
17
|
'runs_before_idempotency' => 1
|
19
18
|
}
|
20
19
|
|
@@ -72,7 +71,7 @@ class Onceover
|
|
72
71
|
if classes.count > 1
|
73
72
|
class_msg = "#{classes.count}_classes"
|
74
73
|
else
|
75
|
-
class_msg = classes[0].name.gsub(
|
74
|
+
class_msg = classes[0].name.gsub("::",'__')
|
76
75
|
end
|
77
76
|
|
78
77
|
if nodes.count > 1
|
data/lib/onceover/testconfig.rb
CHANGED
@@ -282,9 +282,9 @@ class Onceover
|
|
282
282
|
def run_filters(tests)
|
283
283
|
# All of this needs to be applied AFTER deduplication but BEFORE writing
|
284
284
|
filters = {
|
285
|
-
'tags'
|
285
|
+
'tags' => @filter_tags,
|
286
286
|
'classes' => @filter_classes,
|
287
|
-
'nodes'
|
287
|
+
'nodes' => @filter_nodes
|
288
288
|
}
|
289
289
|
filters.each do |method, filter_list|
|
290
290
|
if filter_list
|