onceover 3.21.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/devcontainer.json +4 -6
  3. data/.github/workflows/release.yaml +24 -0
  4. data/Gemfile +3 -0
  5. data/README.md +45 -1
  6. data/Rakefile +1 -0
  7. data/cucumber.yml +1 -0
  8. data/features/step_definitions/run.rb +4 -0
  9. data/features/zzz_run.feature +1 -8
  10. data/lib/onceover/beaker/spec_helper.rb +8 -8
  11. data/lib/onceover/controlrepo.rb +3 -3
  12. data/lib/onceover/deploy.rb +1 -1
  13. data/lib/onceover/rspec/formatters.rb +2 -4
  14. data/lib/onceover/runner.rb +1 -1
  15. data/lib/onceover/test.rb +1 -1
  16. data/onceover.gemspec +6 -13
  17. data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
  18. data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
  19. data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
  20. data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
  21. data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
  22. data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
  23. data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
  24. data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
  25. data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +6 -0
  26. data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
  27. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
  28. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
  29. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
  30. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
  31. data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
  32. data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
  33. data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
  34. data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
  35. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
  36. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
  37. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
  38. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
  39. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
  40. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
  41. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
  42. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
  43. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
  44. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
  45. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
  46. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
  47. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
  48. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
  49. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
  50. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
  51. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
  52. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
  53. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
  54. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
  55. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
  56. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
  57. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
  58. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
  59. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
  60. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
  61. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
  62. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
  63. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
  64. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
  65. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
  66. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
  67. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
  68. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
  69. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
  70. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
  71. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
  72. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
  73. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
  74. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
  75. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
  76. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
  77. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
  78. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
  79. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
  80. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
  81. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
  82. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
  83. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
  84. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
  85. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
  86. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
  87. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
  88. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
  89. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
  90. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
  91. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
  92. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
  93. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
  94. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
  95. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
  96. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
  97. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
  98. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
  99. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
  100. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
  101. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
  102. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
  103. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
  104. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
  105. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
  106. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
  107. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
  108. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
  109. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
  110. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
  111. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
  112. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
  113. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
  114. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
  115. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
  116. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
  117. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
  118. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
  119. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
  120. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
  121. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
  122. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
  123. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
  124. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
  125. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
  126. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
  127. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
  128. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
  129. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
  130. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
  131. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
  132. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
  133. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
  134. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
  135. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
  136. data/templates/spec_helper.rb.erb +0 -2
  137. data/templates/test_spec.rb.erb +3 -0
  138. metadata +137 -79
  139. data/.gitmodules +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4efb9fe2eee59809e38c373cbc31ea99eeb314b0ddd631b9242789da7174609c
4
- data.tar.gz: 0a4186e296c4d0cf3eb99ef4f5214d110622de95e8037138bb9e1fb66d45d1d4
3
+ metadata.gz: f3673b1ea11e712766d85ddd0c97ff68671d698acdb0fd0f0e516182f18a3ef1
4
+ data.tar.gz: 11037d12d4734ad69b94f335824154dc5056b61adb118c7a32a10ebb8f1034e7
5
5
  SHA512:
6
- metadata.gz: e3bdc3f4114ddd8291a798c73585677a2855522d63d425d55d19a8a47c0ea4a9dbd7d31544fce7554133076a5be82779a4ffeffc6650e8f04fbc5c43d76847e5
7
- data.tar.gz: 06ef6823ba3371f6f259e9c4f85ed97d17f623297a368baa2dc0cf9bc9c3255162244a27b32e3376958dbe522e642850450a562ff4b648af04b04cb8632e9537
6
+ metadata.gz: 2294e1581eadcda9f2305f2c63941c7f58d00ed9e232bd19b3f40a58b1e15a7c8aa6b56750c3a480694f3e2fdc2cf74b314363cf5fca84c4a07b24607cbc6d94
7
+ data.tar.gz: 250fed721814af4074477bd83d9ca77f41442c39d2476b09bd0fe15fba675a0d604077ca69d33cf861a4d318d4fe4785580b6dd8b30989ea5c7cd5e628314897
@@ -3,21 +3,19 @@
3
3
  {
4
4
  "name": "Debian",
5
5
  // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
- "image": "mcr.microsoft.com/devcontainers/base:bullseye",
6
+ "image": "mcr.microsoft.com/devcontainers/ruby:3.2",
7
7
  "features": {
8
- "ghcr.io/devcontainers/features/ruby:1": {},
9
8
  "ghcr.io/devcontainers/features/github-cli:1": {}
10
9
  },
11
10
 
12
- "postAttachCommand": "bundle",
13
11
  "customizations": {
14
12
  "vscode": {
15
13
  "extensions": [
16
- "castwide.ruby-debug",
17
- "CucumberOpen.cucumber-official"
14
+ "CucumberOpen.cucumber-official",
15
+ "Shopify.ruby-extensions-pack"
18
16
  ]
19
17
  }
20
- }
18
+ },
21
19
 
22
20
  // Features to add to the dev container. More info: https://containers.dev/features.
23
21
  // "features": {},
@@ -0,0 +1,24 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ permissions:
9
+ contents: write
10
+
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - uses: fregante/setup-git-user@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.2.3
17
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
18
+
19
+ - name: Release Gem
20
+ uses: cadwallion/publish-rubygems-action@master
21
+ env:
22
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
24
+ RELEASE_COMMAND: bundle exec rake release
data/Gemfile CHANGED
@@ -15,6 +15,9 @@ end
15
15
 
16
16
  group :development do
17
17
  gem 'pry'
18
+ gem 'cucumber'
19
+ gem 'rubocop'
20
+ gem 'rubygems-tasks'
18
21
  end
19
22
 
20
23
  # Evaluate Gemfile.local if it exists
data/README.md CHANGED
@@ -225,7 +225,7 @@ node_groups:
225
225
  exclude: 'windows_nodes' # Then remove the windows ones from that list
226
226
  ```
227
227
 
228
- It's important to note that in order to reference a group using the *include/exclude* syntax is has to have been defined already i.e. it has to come above the group that references it
228
+ It's important to note that in order to reference a group using the *include/exclude* syntax it has to have been defined already i.e. it has to come above the group that references it
229
229
 
230
230
  #### Examples
231
231
 
@@ -384,6 +384,50 @@ In this case, you're all set and onceover will auto-magically pick those up for
384
384
 
385
385
  **Note**: The top level `trusted` hash takes precidence over the `trusted[extensions]` hash nested under `values`. Meaning that if you have any specified at the top level, any nested ones will not be considered. So pick **ONE** method and stick with that.
386
386
 
387
+ #### Trusted Certname
388
+ **Note:** When testing with Puppet >= 4.3 the trusted facts hash will have the standard trusted fact keys (certname, domain, and hostname) populated based on the node name (as set with :node).
389
+
390
+ To support the resolution of the trusted fact `certname` in auto-generated spec tests, onceover will set `:node` to the value of `trusted[certname]` where present in the source factset.
391
+
392
+ For example: A spec test generated by the factset below would result in `:node` == `node.puppetlabs.net`.
393
+
394
+ ```json
395
+ {
396
+ "name": "node.puppetlabs.net",
397
+ "values": {
398
+ "aio_agent_build": "1.10.4",
399
+ "aio_agent_version": "1.10.4",
400
+ "architecture": "x86_64",
401
+ "trusted": {
402
+ "certname": "node.puppetlabs.net",
403
+ "extensions": {
404
+ "pp_role": "agent",
405
+ "pp_datacenter": "puppet"
406
+ }
407
+ }
408
+ ```
409
+
410
+ If `trusted[certname]` is absent, the value of `:node` will default to the FQDN of the host running onceover. For example:
411
+
412
+ ```json
413
+ {
414
+ "name": "node.puppetlabs.net",
415
+ "values": {
416
+ "aio_agent_build": "1.10.4",
417
+ "aio_agent_version": "1.10.4",
418
+ "architecture": "x86_64",
419
+ "trusted": {
420
+ "extensions": {
421
+ "pp_role": "agent",
422
+ "pp_datacenter": "puppet"
423
+ }
424
+ }
425
+ ```
426
+
427
+ See the following rspec-puppet links for more information:
428
+ - [Specifying the FQDN of the test node](https://github.com/puppetlabs/rspec-puppet#specifying-the-fqdn-of-the-test-node)
429
+ - [Specifying trusted facts](https://github.com/puppetlabs/rspec-puppet#specifying-trusted-facts)
430
+
387
431
  #### Trusted External Data
388
432
 
389
433
  **Note:** This feature requires `rspec-puppet` >= 2.8.0.
data/Rakefile CHANGED
@@ -51,6 +51,7 @@ task :syntax do
51
51
  require 'find'
52
52
  Find.find(*paths) do |path|
53
53
  next unless path =~ /\.rb$/
54
+
54
55
  if windows?
55
56
  sh "ruby -cw #{path} > NUL"
56
57
  else
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --publish-quiet
@@ -11,3 +11,7 @@ end
11
11
  When(/^I make local modifications$/) do
12
12
  FileUtils.rm_rf("#{@repo.onceover_temp_root_folder}/modules/apache/manifests")
13
13
  end
14
+
15
+ Before('@skip_on_windows') do
16
+ skip_this_scenario if RUBY_PLATFORM =~ /mswin|mingw/
17
+ end
@@ -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
- # TODO: Work out why this is fialing on windows
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"
@@ -39,14 +39,14 @@ RSpec.configure do |c|
39
39
  }
40
40
  #read env vars
41
41
  env_vars = {
42
- :color => ENV['BEAKER_color'] || ENV['RS_COLOR'],
43
- :nodeset => ENV['BEAKER_set'] || ENV['RS_SET'],
44
- :nodesetfile => ENV['BEAKER_setfile'] || ENV['RS_SETFILE'],
45
- :provision => ENV['BEAKER_provision'] || ENV['RS_PROVISION'],
46
- :keyfile => ENV['BEAKER_keyfile'] || ENV['RS_KEYFILE'],
47
- :debug => ENV['BEAKER_debug'] || ENV['RS_DEBUG'],
48
- :destroy => ENV['BEAKER_destroy'] || ENV['RS_DESTROY'],
49
- }.delete_if {|key, value| value.nil?}
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
 
@@ -517,7 +517,7 @@ class Onceover
517
517
  # Add .onceover to Gitignore
518
518
  gitignore_path = File.expand_path('.gitignore', repo.root)
519
519
  if File.exist? gitignore_path
520
- gitignore_content = (File.open(gitignore_path, 'r') {|f| f.read }).split("\n")
520
+ gitignore_content = (File.read(gitignore_path)).split("\n")
521
521
  message = "#{'changed'.green}"
522
522
  else
523
523
  message = "#{'created'.green}"
@@ -526,7 +526,7 @@ class Onceover
526
526
 
527
527
  unless gitignore_content.include?(".onceover")
528
528
  gitignore_content << ".onceover\n"
529
- File.open(gitignore_path, 'w') {|f| f.write(gitignore_content.join("\n")) }
529
+ File.write(gitignore_path, gitignore_content.join("\n"))
530
530
  puts "#{message} #{Pathname.new(gitignore_path).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
531
531
  end
532
532
  end
@@ -611,7 +611,7 @@ class Onceover
611
611
  if File.exist?(out_file)
612
612
  puts "#{'skipped'.yellow} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s} #{'(exists)'.yellow}"
613
613
  else
614
- File.open(out_file,'w') {|f| f.write(contents)}
614
+ File.write(out_file, contents)
615
615
  puts "#{'created'.green} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
616
616
  end
617
617
  end
@@ -89,7 +89,7 @@ class Onceover
89
89
  # Avoid touching thing if we don't need to
90
90
  if /:control_branch/.match(puppetfile_contents)
91
91
  logger.debug "replacing :control_branch mentions in the Puppetfile with #{git_branch}"
92
- new_puppetfile_contents = puppetfile_contents.gsub(/:control_branch/, "'#{git_branch}'")
92
+ new_puppetfile_contents = puppetfile_contents.gsub(":control_branch", "'#{git_branch}'")
93
93
  File.write("#{temp_controlrepo}/Puppetfile", new_puppetfile_contents)
94
94
  end
95
95
  end
@@ -266,9 +266,7 @@ class OnceoverFormatterParallel < OnceoverFormatter
266
266
  FileUtils.mkdir_p "#{RSpec.configuration.onceover_tempdir}/parallel"
267
267
 
268
268
  # Dump the notification to a unique file
269
- File.open("#{RSpec.configuration.onceover_tempdir}/parallel/results-#{random_string}.yaml", "w") do |file|
270
- file.write(extract_failures(notification).to_yaml)
271
- end
269
+ File.write("#{RSpec.configuration.onceover_tempdir}/parallel/results-#{random_string}.yaml", extract_failures(notification).to_yaml)
272
270
  end
273
271
 
274
272
  def output_results(directory)
@@ -280,7 +278,7 @@ class OnceoverFormatterParallel < OnceoverFormatter
280
278
  # Merge data
281
279
  roles = files.reduce({}) do |errs, file|
282
280
  # Read all files and merge them
283
- errs.merge(YAML.load(File.read(file))) {|key, oldval, newval| [oldval, newval].flatten }# rubocop:disable Security/YAMLLoad
281
+ errs.merge(YAML.load_file(file)) {|key, oldval, newval| [oldval, newval].flatten }
284
282
  end
285
283
 
286
284
  # Delete files from the disk
@@ -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['RUBYOPT']
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
@@ -72,7 +72,7 @@ class Onceover
72
72
  if classes.count > 1
73
73
  class_msg = "#{classes.count}_classes"
74
74
  else
75
- class_msg = classes[0].name.gsub(/::/,'__')
75
+ class_msg = classes[0].name.gsub("::",'__')
76
76
  end
77
77
 
78
78
  if nodes.count > 1
data/onceover.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
4
4
 
5
- Gem::Specification.new do |s|
5
+ Gem::Specification.new do |s| # rubocop:disable Gemspec/RequireMFA
6
6
  s.name = "onceover"
7
- s.version = "3.21.0"
7
+ s.version = "3.22.0"
8
8
  s.authors = ["Dylan Ratcliffe"]
9
9
  s.email = ["dylan.ratcliffe@puppet.com"]
10
10
  s.homepage = "https://github.com/dylanratcliffe/onceover"
@@ -19,27 +19,20 @@ Gem::Specification.new do |s|
19
19
 
20
20
  # Runtime dependencies, but also probably dependencies of requiring projects
21
21
  s.add_runtime_dependency 'backticks', '>= 1.0.2'
22
- s.add_runtime_dependency 'colored', '~> 1.2'
22
+ s.add_runtime_dependency 'colored', '>= 1.2'
23
23
  s.add_runtime_dependency 'cri', '>= 2.6'
24
24
  s.add_runtime_dependency 'deep_merge', '>= 1.0.0'
25
25
  s.add_runtime_dependency 'git'
26
26
  s.add_runtime_dependency 'logging', '>= 2.0.0'
27
- s.add_runtime_dependency 'multi_json', '~> 1.10'
27
+ s.add_runtime_dependency 'multi_json', '>= 1.10'
28
28
  s.add_runtime_dependency 'parallel_tests', ">= 2.0.0"
29
29
  s.add_runtime_dependency 'puppet', '>=4.0'
30
30
  s.add_runtime_dependency 'puppetlabs_spec_helper', ">= 0.4.0"
31
31
  s.add_runtime_dependency 'r10k', '>=2.1.0'
32
32
  s.add_runtime_dependency 'rake', '>= 10.0.0'
33
33
  s.add_runtime_dependency 'rspec', '>= 3.0.0'
34
- s.add_runtime_dependency 'rspec-puppet', ">= 2.4.0"
35
34
  s.add_runtime_dependency 'rspec_junit_formatter', '>= 0.2.0'
35
+ s.add_runtime_dependency 'rspec-puppet', ">= 2.4.0"
36
36
  s.add_runtime_dependency 'terminal-table', '>= 1.8.0'
37
37
  s.add_runtime_dependency 'versionomy', '>= 0.5.0'
38
-
39
- s.add_development_dependency 'cucumber', '~> 4.1'
40
- s.add_development_dependency 'pry', '~> 0.13.1'
41
- # We need to depend on rubocop <= 1.12 in order to support Ruby 2.4 (Puppet
42
- # 5). Once we drop support for Puppet 5 we can re-open this
43
- s.add_development_dependency 'rubocop', '>= 1.6.1', '<= 1.12'
44
- s.add_development_dependency 'rubygems-tasks', '~> 0.2.5'
45
38
  end
@@ -0,0 +1,9 @@
1
+ {
2
+ "cmd": "bundle exec onceover run spec",
3
+ "name": "onceover spec",
4
+ "cwd": "{PROJECT_PATH}",
5
+ "errorMatch": [
6
+ "compilation:\\s.*production\\/(?<file>[\\w\\/]*.pp):(?<line>\\d*):(?<col>\\d*)"
7
+ ],
8
+ "atomCommandName": "onceover:spec"
9
+ }
@@ -0,0 +1,5 @@
1
+ .onceover
2
+ .DS_Store
3
+ .bundle
4
+ Gemfile.lock
5
+ vendor
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+
3
+ cache:
4
+ bundler: true
5
+ directories:
6
+ - .onceover
7
+
8
+ script: bundle exec onceover run spec --force
9
+ bundler_args: --without development --path vendor/bundle
10
+
11
+ rvm:
12
+ - 2.3.0
13
+ - 2.3.3
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'pry'
5
+ gem 'pry-byebug'
6
+ gem 'rb-readline'
7
+ gem 'puppet-debugger'
8
+ end
9
+
10
+ if ENV['ONCEOVER_gem'] == 'local'
11
+ gem 'onceover', :path => '/Users/dylan/git/onceover'
12
+ # gem 'onceover-octocatalog-diff', :path => '/Users/dylan/git/onceover-octocatalog-diff'
13
+ else
14
+ gem 'onceover', :git => 'https://github.com/dylanratcliffe/onceover.git'#, :branch => 'issue-51'
15
+ # gem 'onceover-octocatalog-diff', :git => 'https://github.com/dylanratcliffe/onceover-octocatalog-diff.git'
16
+ end
17
+
18
+ gem 'hiera-eyaml'
19
+ gem 'puppet', ENV['PUPPET_version'] || '~> 8'
20
+
21
+ # Require by telegraf module
22
+ gem 'toml-rb'
@@ -0,0 +1,50 @@
1
+ node {
2
+ puppet.credentials 'PE-Deploy-Token'
3
+ stage('Git Checkout') { // for display purposes
4
+ // Get some code from a GitHub repository
5
+ checkout([
6
+ $class: 'GitSCM',
7
+ branches: [[name: env.BRANCH_NAME]],
8
+ doGenerateSubmoduleConfigurations: false,
9
+ userRemoteConfigs: [[url: 'https://github.com/dylanratcliffe/puppet_controlrepo.git']]])
10
+ }
11
+ stage('Install Gems') {
12
+ // Run the onceover tests
13
+ sh '''source /usr/local/rvm/scripts/rvm && bundle install --path=.gems --binstubs'''
14
+ }
15
+ stage('Run Onceover Tests') {
16
+ // Run the onceover tests
17
+ try {
18
+ sh '''source /usr/local/rvm/scripts/rvm && ./bin/onceover run spec'''
19
+ } catch (error) {
20
+ junit '.onceover/spec.xml'
21
+ throw error
22
+ }
23
+ }
24
+ stage('Deploy Code') {
25
+ echo env.BRANCH_NAME
26
+ puppet.codeDeploy env.BRANCH_NAME
27
+ }
28
+ stage('Run Puppet') {
29
+ // Get all of the classes that have changed
30
+ changedClasses = sh(returnStdout: true, script: './scripts/get_changed_classes.rb').trim().split('\n')
31
+ // Get the number of classes that have changed
32
+ numChangedClasses = sh(returnStdout: true, script: './scripts/count_changed_classes.rb').trim().toInteger()
33
+ // Generate a query that we will use
34
+ nodeQuery = ('nodes { resources { type = "Class" and title in ' + ("[\"" + changedClasses.join("\",\"") + "\"]") + ' } and catalog_environment = "' + env.BRANCH_NAME +'" }').toString()
35
+ // If things have changed then execute the query
36
+ if (numChangedClasses > 0) {
37
+ echo nodeQuery
38
+ affectedNodes = puppet.query nodeQuery
39
+ // If nothing has been affected by the change we don't need to try to
40
+ // initiate the run
41
+ if (affectedNodes.size() > 0) {
42
+ puppet.job env.BRANCH_NAME, query: nodeQuery
43
+ } else {
44
+ echo "Classes: " + changedClasses.join(",") + " changed. But no nodes were affected, skipping run."
45
+ }
46
+ } else {
47
+ echo "No classes changed, skipping this step."
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,102 @@
1
+ #mod 'dylanratcliffe/sumologic',
2
+ # :git => 'https://github.com/dylanratcliffe/sumologic.git'
3
+ mod 'dylanratcliffe/sumologic', '1.0.2'
4
+ mod 'nwops-debug', '0.1.3'
5
+ mod 'puppetlabs/mysql', '8.0.0'
6
+ mod 'puppetlabs/inifile', '2.5.0'
7
+ mod 'puppet-r10k', '6.8.0'
8
+ mod 'gentoo/portage', '2.3.0'
9
+ mod 'puppetlabs/gcc', '0.3.0'
10
+ mod 'puppetlabs/git', '0.5.0'
11
+ mod 'puppetlabs/pe_gem', '0.2.0'
12
+ mod 'puppetlabs/ruby', '1.0.0'
13
+ mod 'puppetlabs/vcsrepo', '2.4.0'
14
+ mod 'puppet-make', '2.1.1'
15
+ mod 'puppet/jira', '3.5.2'
16
+ mod 'actionjack/crowd', '0.1.1'
17
+ mod 'puppetlabs/java', '3.3.0'
18
+ mod 'puppetlabs-java_ks', '2.3.0'
19
+ mod 'puppetlabs/postgresql', '5.11.0'
20
+ mod 'mkrakowitzer/deploy', '0.0.3'
21
+ mod 'nanliu/staging', '1.0.3'
22
+ mod 'puppetlabs/apt', '6.3.0'
23
+ mod 'puppetlabs/concat', '5.2.0'
24
+ mod 'puppetlabs/firewall', '1.15.0'
25
+ mod 'puppet/hiera', '3.3.4'
26
+ mod 'danzilio/report_all_the_things', '0.1.0'
27
+ mod 'rtyler-jenkins', '1.7.0'
28
+ mod 'unibet/vagrant', '0.2.1'
29
+ mod 'darin/zypprepo', '1.0.2'
30
+ mod 'puppet/nginx', '0.15.0'
31
+ mod 'puppet/nodejs', '6.0.0'
32
+ mod 'puppet/wget', '2.0.1'
33
+ mod 'stahnma/epel', '1.3.1'
34
+ mod 'puppetlabs/apache', '4.0.0'
35
+ mod 'puppet/collectd', '10.1.0'
36
+ mod 'puppet-yum', '3.1.1'
37
+ mod 'puppetlabs/puppetserver_gem', '1.1.1'
38
+ mod 'WhatsARanjit/node_manager', '0.7.1'
39
+
40
+ mod 'pltraining-rbac', '0.0.10'
41
+ mod 'camptocamp/systemd', '2.1.0'
42
+ mod 'puppetlabs/stdlib', '5.2.0'
43
+ mod 'maestrodev/rvm', '1.13.1'
44
+ mod 'golja/gnupg', '1.2.3'
45
+ mod 'treydock/gpg_key', '0.1.0'
46
+ mod 'evenup/hubot', '0.2.0'
47
+ mod 'puppetlabs/haproxy', '4.3.0'
48
+ mod 'puppetlabs/aws', '2.1.0'
49
+ #mod 'danieldreier/autosign', '0.1.2'
50
+ mod 'autosign',
51
+ :git => 'https://github.com/dylanratcliffe/puppet-autosign.git',
52
+ :ref => '07ca3e0ad181483bd40ad1bd25466a19ac240fa7'
53
+ mod 'puppetlabs/hocon', '0.9.4' # Hold due to MODULES-5837
54
+ mod 'puppetlabs/dsc', '1.8.0'
55
+ mod 'puppetlabs/powershell', '2.2.0'
56
+ mod 'puppetlabs/reboot', '2.1.2'
57
+ mod 'puppetlabs/chocolatey', '3.1.1'
58
+ mod 'puppet-selinux', '1.6.1'
59
+ mod 'puppet-windows_env', '3.2.0'
60
+ mod 'puppet-archive', '7.0.0'
61
+ mod 'puppetlabs-transition', '0.1.1'
62
+ mod 'dylanratcliffe-windows_disk_facts','0.2.5'
63
+ mod 'biemond-wildfly', '2.3.2'
64
+ mod 'jethrocarr-initfact', '1.0.1'
65
+ mod 'puppetlabs-iis', '4.5.0'
66
+ mod 'puppetlabs-registry', '2.1.0'
67
+ mod 'puppetlabs-acl', '3.2.1'
68
+ mod 'trlinkin-noop', '1.0.0'
69
+ mod 'puppetlabs-puppet_agent', '2.0.1'
70
+ mod 'puppetlabs-exec', '0.3.0'
71
+ # CIDR Based Facts Example
72
+ mod 'dylanratcliffe-cidr_facts', '0.1.6'
73
+ mod 'puppet-grafana', '7.0.0'
74
+ mod 'puppetlabs-puppet_metrics_dashboard', '2.5.0'
75
+ mod 'puppet-telegraf', '4.1.0'
76
+
77
+ mod 'compliance_api',
78
+ :git => 'https://github.com/dylanratcliffe/puppet-compliance_api.git',
79
+ :ref => 'master'
80
+
81
+ mod 'deployment_signature',
82
+ :git => 'https://github.com/dylanratcliffe/puppet-deployment_signature.git',
83
+ :ref => 'master'
84
+
85
+
86
+ mod 'puppetlabs-bolt_shim', '0.2.1'
87
+ mod 'puppetlabs-facts', '0.5.0'
88
+ mod 'puppetlabs-service', '0.5.0'
89
+ mod 'puppetlabs-package', '0.4.1'
90
+ mod 'puppetlabs-puppet_conf', '0.3.0'
91
+ mod 'puppetlabs-yumrepo_core', '1.0.7'
92
+ mod 'puppetlabs-augeas_core', '1.0.4'
93
+ mod 'puppetlabs-cd4pe', '3.0.1'
94
+ mod 'puppetlabs-puppet_authorization', '0.5.1'
95
+ mod 'puppetlabs-docker', '3.12.1'
96
+ mod 'puppetlabs-translate', '1.2.0'
97
+ mod 'puppetlabs-pe_databases', '1.1.0'
98
+ mod 'puppetlabs-cron_core', '1.0.4'
99
+ mod 'puppetlabs-support_tasks', '1.1.2'
100
+ mod 'inkblot-bind', '7.4.0'
101
+ mod 'saz-resolv_conf', '4.2.1'
102
+ mod 'kinners00-nessus_agent', '1.1.3'
@@ -0,0 +1,4 @@
1
+ # puppet_controlrepo
2
+
3
+ [![Build Status](https://travis-ci.org/dylanratcliffe/puppet_controlrepo.svg?branch=production)](https://travis-ci.org/dylanratcliffe/puppet_controlrepo)
4
+
@@ -0,0 +1,6 @@
1
+ require 'puppetlabs_spec_helper/rake_tasks'
2
+
3
+ #desc "Run acceptance tests"
4
+ #RSpec::Core::RakeTask.new(:acceptance) do |t|
5
+ # t.pattern = 'spec/acceptance'
6
+ #end