beaker-puppet 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +2 -2
- data/.github_changelog_generator +3 -0
- data/.rubocop_todo.yml +52 -7
- data/CHANGELOG.md +14 -3
- data/CODEOWNERS +1 -0
- data/README.md +4 -13
- data/acceptance/tests/stub_host.rb +1 -1
- data/beaker-puppet.gemspec +3 -3
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +20 -95
- data/lib/beaker-puppet/install_utils/foss_utils.rb +10 -194
- data/lib/beaker-puppet/install_utils/puppet_utils.rb +0 -17
- data/lib/beaker-puppet/version.rb +1 -1
- data/release-prep.sh +11 -0
- data/setup/aio/010_Install_Puppet_Agent.rb +22 -8
- data/setup/common/040_ValidateSignCert.rb +4 -11
- data/setup/gem/010_GemInstall.rb +1 -1
- data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +1 -251
- data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +34 -463
- data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +0 -23
- data/tasks/ci.rake +27 -19
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413a669d5587e9a9383879b9fc9ae0dfa7fe6215a7bc970b053df9565318c062
|
4
|
+
data.tar.gz: ecf64aaa4593c25ca6f1b0e8e963ed6f7191fc9d5a3ebf521806a7b80b130e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd806ebd7b80d20a08d75faff6f075775a5d6a11a3c4be02fa801c81bac8adbabeed791021d7f215158666cca62abc79489c4240ad9cc70784c63653fdc2af47
|
7
|
+
data.tar.gz: acb9a8bb1554d6dc4f0c54ae4b9c12674b5215846ee3a73047e0c6e2b52ed30b83d81298ef53bfc0e395919da87f1bca2131205eb1935982d751cdc7becabfe7
|
data/.github/workflows/test.yml
CHANGED
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
rubocop:
|
14
14
|
runs-on: ubuntu-latest
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v4
|
17
17
|
- name: Install Ruby ${{ matrix.ruby }}
|
18
18
|
uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
@@ -38,7 +38,7 @@ jobs:
|
|
38
38
|
COVERAGE: ${{ matrix.coverage }}
|
39
39
|
name: RSpec - Ruby ${{ matrix.ruby }}
|
40
40
|
steps:
|
41
|
-
- uses: actions/checkout@
|
41
|
+
- uses: actions/checkout@v4
|
42
42
|
- name: Install Ruby ${{ matrix.ruby }}
|
43
43
|
uses: ruby/setup-ruby@v1
|
44
44
|
with:
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-12-19 12:29:40 UTC using RuboCop version 1.57.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -15,6 +15,7 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
15
15
|
- 'beaker-puppet.gemspec'
|
16
16
|
|
17
17
|
# Offense count: 2
|
18
|
+
# This cop supports safe autocorrection (--autocorrect).
|
18
19
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
19
20
|
Lint/AmbiguousBlockAssociation:
|
20
21
|
Exclude:
|
@@ -79,8 +80,14 @@ Lint/ParenthesesAsGroupedExpression:
|
|
79
80
|
- 'spec/beaker-puppet/helpers/facter_helpers_spec.rb'
|
80
81
|
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
|
81
82
|
|
82
|
-
# Offense count:
|
83
|
+
# Offense count: 1
|
83
84
|
# This cop supports safe autocorrection (--autocorrect).
|
85
|
+
Lint/RedundantCopDisableDirective:
|
86
|
+
Exclude:
|
87
|
+
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
88
|
+
|
89
|
+
# Offense count: 2
|
90
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
84
91
|
Lint/RedundantRequireStatement:
|
85
92
|
Exclude:
|
86
93
|
- 'spec/spec_helper.rb'
|
@@ -133,6 +140,7 @@ Lint/UnusedMethodArgument:
|
|
133
140
|
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
134
141
|
|
135
142
|
# Offense count: 17
|
143
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
136
144
|
Lint/UselessAssignment:
|
137
145
|
Exclude:
|
138
146
|
- 'acceptance/tests/clone_git_repo_on_test.rb'
|
@@ -276,12 +284,13 @@ Performance/StringReplacement:
|
|
276
284
|
- 'lib/beaker-puppet/install_utils/windows_utils.rb'
|
277
285
|
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
278
286
|
|
279
|
-
# Offense count:
|
287
|
+
# Offense count: 6
|
280
288
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
281
289
|
RSpec/BeEq:
|
282
290
|
Exclude:
|
283
291
|
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
|
284
292
|
- 'spec/beaker-puppet/install_utils/ezbake_utils_spec.rb'
|
293
|
+
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
285
294
|
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'
|
286
295
|
|
287
296
|
# Offense count: 2
|
@@ -336,6 +345,12 @@ RSpec/EmptyLineAfterHook:
|
|
336
345
|
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
|
337
346
|
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
338
347
|
|
348
|
+
# Offense count: 1
|
349
|
+
# This cop supports safe autocorrection (--autocorrect).
|
350
|
+
RSpec/Eq:
|
351
|
+
Exclude:
|
352
|
+
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
353
|
+
|
339
354
|
# Offense count: 138
|
340
355
|
# Configuration parameters: CountAsOne.
|
341
356
|
RSpec/ExampleLength:
|
@@ -388,7 +403,7 @@ RSpec/HookArgument:
|
|
388
403
|
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
389
404
|
|
390
405
|
# Offense count: 2
|
391
|
-
# Configuration parameters: Max.
|
406
|
+
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
392
407
|
RSpec/IndexedLet:
|
393
408
|
Exclude:
|
394
409
|
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
@@ -494,6 +509,16 @@ RSpec/ReceiveCounts:
|
|
494
509
|
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
|
495
510
|
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
496
511
|
|
512
|
+
# Offense count: 66
|
513
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
514
|
+
RSpec/ReceiveMessages:
|
515
|
+
Exclude:
|
516
|
+
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
|
517
|
+
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
518
|
+
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'
|
519
|
+
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
520
|
+
- 'spec/helpers.rb'
|
521
|
+
|
497
522
|
# Offense count: 19
|
498
523
|
# This cop supports safe autocorrection (--autocorrect).
|
499
524
|
RSpec/ReceiveNever:
|
@@ -519,6 +544,24 @@ RSpec/ReturnFromStub:
|
|
519
544
|
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
520
545
|
- 'spec/beaker-puppet/install_utils/puppet5_spec.rb'
|
521
546
|
|
547
|
+
# Offense count: 11
|
548
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
549
|
+
# Include: **/*_spec.rb
|
550
|
+
RSpec/SpecFilePathFormat:
|
551
|
+
Exclude:
|
552
|
+
- '**/spec/routing/**/*'
|
553
|
+
- 'spec/beaker-puppet/helpers/facter_helpers_spec.rb'
|
554
|
+
- 'spec/beaker-puppet/helpers/host_helpers_spec.rb'
|
555
|
+
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
|
556
|
+
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
|
557
|
+
- 'spec/beaker-puppet/install_utils/ezbake_utils_spec.rb'
|
558
|
+
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
|
559
|
+
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'
|
560
|
+
- 'spec/beaker-puppet/install_utils/puppet5_spec.rb'
|
561
|
+
- 'spec/beaker-puppet/install_utils/puppet_utils_spec.rb'
|
562
|
+
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
563
|
+
- 'spec/beaker-puppet/wrappers_spec.rb'
|
564
|
+
|
522
565
|
# Offense count: 106
|
523
566
|
RSpec/StubbedMock:
|
524
567
|
Exclude:
|
@@ -642,11 +685,13 @@ Style/ClassAndModuleChildren:
|
|
642
685
|
|
643
686
|
# Offense count: 1
|
644
687
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
688
|
+
# Configuration parameters: AllowedReceivers.
|
645
689
|
Style/CollectionCompact:
|
646
690
|
Exclude:
|
647
691
|
- 'lib/beaker-puppet/install_utils/foss_utils.rb'
|
648
692
|
|
649
693
|
# Offense count: 1
|
694
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
650
695
|
Style/CombinableLoops:
|
651
696
|
Exclude:
|
652
697
|
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
|
@@ -694,7 +739,7 @@ Style/IdenticalConditionalBranches:
|
|
694
739
|
- 'lib/beaker-puppet/helpers/tk_helpers.rb'
|
695
740
|
- 'lib/beaker-puppet/install_utils/ezbake_utils.rb'
|
696
741
|
|
697
|
-
# Offense count:
|
742
|
+
# Offense count: 13
|
698
743
|
# This cop supports safe autocorrection (--autocorrect).
|
699
744
|
Style/IfUnlessModifier:
|
700
745
|
Exclude:
|
@@ -736,7 +781,7 @@ Style/NonNilCheck:
|
|
736
781
|
Exclude:
|
737
782
|
- 'lib/beaker-puppet/install_utils/foss_utils.rb'
|
738
783
|
|
739
|
-
# Offense count:
|
784
|
+
# Offense count: 11
|
740
785
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
741
786
|
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
742
787
|
# SupportedStyles: predicate, comparison
|
@@ -834,7 +879,7 @@ Style/ZeroLengthPredicate:
|
|
834
879
|
- 'lib/beaker-puppet/helpers/puppet_helpers.rb'
|
835
880
|
- 'lib/beaker-puppet/install_utils/foss_utils.rb'
|
836
881
|
|
837
|
-
# Offense count:
|
882
|
+
# Offense count: 122
|
838
883
|
# This cop supports safe autocorrection (--autocorrect).
|
839
884
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
840
885
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
@@ -2,13 +2,24 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [
|
5
|
+
## [3.0.0](https://github.com/puppetlabs/beaker-puppet/tree/3.0.0) (2024-02-14)
|
6
6
|
|
7
|
-
[Full Changelog](https://github.com/
|
7
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-puppet/compare/2.0.0...3.0.0)
|
8
|
+
|
9
|
+
**Breaking changes:**
|
10
|
+
|
11
|
+
- Beaker 5 compatibility [\#240](https://github.com/puppetlabs/beaker-puppet/pull/240) ([mhashizume](https://github.com/mhashizume))
|
8
12
|
|
9
13
|
**Implemented enhancements:**
|
10
14
|
|
11
|
-
-
|
15
|
+
- Add the ability to install puppet-agent from a local dev build [\#239](https://github.com/puppetlabs/beaker-puppet/pull/239) ([joshcooper](https://github.com/joshcooper))
|
16
|
+
- Add Amazon linux 2023 platform support [\#228](https://github.com/puppetlabs/beaker-puppet/pull/228) ([span786](https://github.com/span786))
|
17
|
+
|
18
|
+
**Fixed bugs:**
|
19
|
+
|
20
|
+
- Ensure post-suite and destroy execute [\#238](https://github.com/puppetlabs/beaker-puppet/pull/238) ([joshcooper](https://github.com/joshcooper))
|
21
|
+
- fix beaker exec when called from bundle exec [\#232](https://github.com/puppetlabs/beaker-puppet/pull/232) ([h0tw1r3](https://github.com/h0tw1r3))
|
22
|
+
- Loosen expectations while attempting to delete puppet related files [\#225](https://github.com/puppetlabs/beaker-puppet/pull/225) ([tvpartytonight](https://github.com/tvpartytonight))
|
12
23
|
|
13
24
|
## [2.0.0](https://github.com/voxpupuli/beaker-puppet/tree/2.0.0) (2023-05-05)
|
14
25
|
|
data/CODEOWNERS
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
* @puppetlabs/phoenix @puppetlabs/unicorn
|
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# beaker-puppet: The Puppet-Specific Beaker Library
|
2
2
|
|
3
|
-
[![License](https://img.shields.io/github/license/
|
4
|
-
[![Test](https://github.com/
|
5
|
-
[![codecov](https://codecov.io/gh/
|
6
|
-
[![Release](https://github.com/
|
3
|
+
[![License](https://img.shields.io/github/license/puppetlabs/beaker-puppet.svg)](https://github.com/puppetlabs/beaker-puppet/blob/master/LICENSE)
|
4
|
+
[![Test](https://github.com/puppetlabs/beaker-puppet/actions/workflows/test.yml/badge.svg)](https://github.com/puppetlabs/beaker-puppet/actions/workflows/test.yml)
|
5
|
+
[![codecov](https://codecov.io/gh/puppetlabs/beaker-puppet/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/puppetlabs/beaker-puppet)
|
6
|
+
[![Release](https://github.com/puppetlabs/beaker-puppet/actions/workflows/release.yml/badge.svg)](https://github.com/puppetlabs/beaker-puppet/actions/workflows/release.yml)
|
7
7
|
[![RubyGem Version](https://img.shields.io/gem/v/beaker-puppet.svg)](https://rubygems.org/gems/beaker-puppet)
|
8
8
|
[![RubyGem Downloads](https://img.shields.io/gem/dt/beaker-puppet.svg)](https://rubygems.org/gems/beaker-puppet)
|
9
|
-
[![Donated by Puppet Inc](https://img.shields.io/badge/donated%20by-Puppet%20Inc-fb7047.svg)](#transfer-notice)
|
10
9
|
|
11
10
|
The purpose of this library is to hold all puppet-specific info & DSL methods.
|
12
11
|
This includes all helper & installer methods.
|
@@ -79,14 +78,6 @@ file, or you can provide a beaker-hostgenerator value to the `TEST_TARGET`
|
|
79
78
|
environment variable. You can also specify the tests that get executed with the
|
80
79
|
`TESTS` environment variable.
|
81
80
|
|
82
|
-
## Transfer Notice
|
83
|
-
|
84
|
-
This plugin was originally authored by [Puppet Inc](http://puppet.com).
|
85
|
-
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
|
86
|
-
Existing pull requests and issues were transferred over, please fork and continue to contribute here.
|
87
|
-
|
88
|
-
Previously: https://github.com/puppetlabs/beaker
|
89
|
-
|
90
81
|
## License
|
91
82
|
|
92
83
|
This gem is licensed under the Apache-2 license.
|
data/beaker-puppet.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = 'For use for the Beaker acceptance testing tool'
|
12
12
|
s.license = 'Apache-2.0'
|
13
13
|
|
14
|
-
s.required_ruby_version = '>= 2.7'
|
14
|
+
s.required_ruby_version = '>= 2.7', '< 3.2'
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency 'rake', '~> 13.0'
|
24
24
|
s.add_development_dependency 'rspec', '~> 3.0'
|
25
25
|
s.add_development_dependency 'rspec-its', '~> 1.3'
|
26
|
-
s.add_development_dependency 'voxpupuli-rubocop', '~> 1.
|
26
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 2.1.0'
|
27
27
|
|
28
28
|
# Acceptance Testing Dependencies
|
29
29
|
s.add_development_dependency 'beaker-vmpooler', '~> 1.4'
|
30
30
|
|
31
31
|
# Run time dependencies
|
32
|
-
s.add_runtime_dependency 'beaker', '~>
|
32
|
+
s.add_runtime_dependency 'beaker', '~> 5.0'
|
33
33
|
s.add_runtime_dependency 'oga', '~> 3.4'
|
34
34
|
end
|
@@ -81,21 +81,13 @@ module Beaker
|
|
81
81
|
# Test Puppet running in a certain run mode with specific options.
|
82
82
|
# This ensures the following steps are performed:
|
83
83
|
# 1. The pre-test Puppet configuration is backed up
|
84
|
-
# 2.
|
84
|
+
# 2. Lay down a new Puppet configuraton file
|
85
85
|
# 3. Puppet is started or restarted in the specified run mode
|
86
86
|
# 4. Ensure Puppet has started correctly
|
87
87
|
# 5. Further tests are yielded to
|
88
88
|
# 6. Revert Puppet to the pre-test state
|
89
89
|
# 7. Testing artifacts are saved in a folder named for the test
|
90
90
|
#
|
91
|
-
# @note Whether Puppet is started or restarted depends on what kind of
|
92
|
-
# server you're running. Passenger and puppetserver are restarted before.
|
93
|
-
# Webrick is started before and stopped after yielding, unless you're using
|
94
|
-
# service scripts, then it'll behave like passenger & puppetserver.
|
95
|
-
# Passenger and puppetserver (or webrick using service scripts)
|
96
|
-
# restart after yielding by default. You can stop this from happening
|
97
|
-
# by setting the :restart_when_done flag of the conf_opts argument.
|
98
|
-
#
|
99
91
|
# @param [Host] host One object that act like Host
|
100
92
|
#
|
101
93
|
# @param [Hash{Symbol=>String}] conf_opts Represents puppet settings.
|
@@ -112,22 +104,11 @@ module Beaker
|
|
112
104
|
#
|
113
105
|
# These will only be applied when starting a FOSS
|
114
106
|
# master, as a pe master is just bounced.
|
115
|
-
# @option conf_opts [Hash] :__service_args__ A special setting of options
|
116
|
-
# for controlling how the puppet master service is
|
117
|
-
# handled. The only setting currently is
|
118
|
-
# :bypass_service_script, which if set true will
|
119
|
-
# force stopping and starting a webrick master
|
120
|
-
# using the start_puppet_from_source_* methods,
|
121
|
-
# even if it seems the host has passenger.
|
122
|
-
# This is needed in FOSS tests to initialize
|
123
|
-
# SSL.
|
124
107
|
# @option conf_opts [Boolean] :restart_when_done determines whether a restart
|
125
108
|
# should be run after the test has been yielded to.
|
126
109
|
# Will stop puppet if false. Default behavior
|
127
110
|
# is to restart, but you can override this on the
|
128
111
|
# host or with this option.
|
129
|
-
# (Note: only works for passenger & puppetserver
|
130
|
-
# masters (or webrick using the service scripts))
|
131
112
|
# @param [File] testdir The temporary directory which will hold backup
|
132
113
|
# configuration, and other test artifacts.
|
133
114
|
#
|
@@ -156,12 +137,11 @@ module Beaker
|
|
156
137
|
end
|
157
138
|
|
158
139
|
cmdline_args = conf_opts[:__commandline_args__]
|
159
|
-
service_args = conf_opts[:__service_args__] || {}
|
160
140
|
restart_when_done = true
|
161
141
|
restart_when_done = host[:restart_when_done] if host.has_key?(:restart_when_done)
|
162
142
|
restart_when_done = conf_opts.fetch(:restart_when_done, restart_when_done)
|
163
143
|
conf_opts = conf_opts.reject do |k, v|
|
164
|
-
%i[__commandline_args__
|
144
|
+
%i[__commandline_args__ restart_when_done].include?(k)
|
165
145
|
end
|
166
146
|
|
167
147
|
curl_retries = host['master-start-curl-retries'] || options['master-start-curl-retries']
|
@@ -202,13 +182,8 @@ module Beaker
|
|
202
182
|
puppet_config(host, 'confdir', section: 'master'),
|
203
183
|
testdir,
|
204
184
|
'puppet.conf')
|
205
|
-
lay_down_new_puppet_conf
|
206
|
-
|
207
|
-
if host.use_service_scripts? && !service_args[:bypass_service_script]
|
208
|
-
bounce_service(host, host['puppetservice'], curl_retries)
|
209
|
-
else
|
210
|
-
puppet_master_started = start_puppet_from_source_on!(host, cmdline_args)
|
211
|
-
end
|
185
|
+
lay_down_new_puppet_conf(host, conf_opts, testdir)
|
186
|
+
bounce_service(host, host['puppetservice'], curl_retries)
|
212
187
|
|
213
188
|
yield self if block_given?
|
214
189
|
|
@@ -229,20 +204,11 @@ module Beaker
|
|
229
204
|
raise(original_exception)
|
230
205
|
ensure
|
231
206
|
begin
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
bounce_service(host, host['puppetservice'], curl_retries)
|
236
|
-
else
|
237
|
-
host.exec puppet_resource('service', host['puppetservice'], 'ensure=stopped')
|
238
|
-
end
|
207
|
+
restore_puppet_conf_from_backup(host, backup_file)
|
208
|
+
if restart_when_done
|
209
|
+
bounce_service(host, host['puppetservice'], curl_retries)
|
239
210
|
else
|
240
|
-
|
241
|
-
stop_puppet_from_source_on(host)
|
242
|
-
else
|
243
|
-
dump_puppet_log(host)
|
244
|
-
end
|
245
|
-
restore_puppet_conf_from_backup(host, backup_file)
|
211
|
+
host.exec puppet_resource('service', host['puppetservice'], 'ensure=stopped')
|
246
212
|
end
|
247
213
|
rescue Exception => teardown_exception
|
248
214
|
begin
|
@@ -281,19 +247,6 @@ module Beaker
|
|
281
247
|
end
|
282
248
|
end
|
283
249
|
|
284
|
-
# @!visibility private
|
285
|
-
def start_puppet_from_source_on!(host, args = '')
|
286
|
-
host.exec(puppet('master', args))
|
287
|
-
|
288
|
-
logger.debug 'Waiting for the puppet master to start'
|
289
|
-
raise Beaker::DSL::FailTest, 'Puppet master did not start in a timely fashion' unless port_open_within?(
|
290
|
-
host, 8140, 10
|
291
|
-
)
|
292
|
-
|
293
|
-
logger.debug 'The puppet master has started'
|
294
|
-
true
|
295
|
-
end
|
296
|
-
|
297
250
|
# @!visibility private
|
298
251
|
def stop_puppet_from_source_on(host)
|
299
252
|
pid = host.exec(Command.new('cat `puppet config print --section master pidfile`')).stdout.chomp
|
@@ -355,19 +308,12 @@ module Beaker
|
|
355
308
|
def bounce_service(host, service, curl_retries = nil, port = nil)
|
356
309
|
curl_retries = 120 if curl_retries.nil?
|
357
310
|
port = options[:puppetserver_port] if port.nil?
|
358
|
-
|
359
|
-
|
360
|
-
apachectl_path = host.is_pe? ? "#{host['puppetsbindir']}/#{service}" : service
|
361
|
-
host.exec(Command.new("#{apachectl_path} graceful"))
|
362
|
-
else
|
363
|
-
result = host.exec(Command.new("service #{service} reload"),
|
364
|
-
acceptable_exit_codes: [0, 1, 3])
|
365
|
-
return result if result.exit_code == 0
|
311
|
+
result = host.exec(Command.new("service #{service} reload"), acceptable_exit_codes: [0, 1, 3])
|
312
|
+
return result if result.exit_code == 0
|
366
313
|
|
367
|
-
|
368
|
-
|
314
|
+
host.exec puppet_resource('service', service, 'ensure=stopped')
|
315
|
+
host.exec puppet_resource('service', service, 'ensure=running')
|
369
316
|
|
370
|
-
end
|
371
317
|
curl_with_retries(" #{service} ", host, "https://localhost:#{port}", [35, 60], curl_retries)
|
372
318
|
end
|
373
319
|
|
@@ -819,28 +765,17 @@ module Beaker
|
|
819
765
|
def sign_certificate_for(host = [])
|
820
766
|
hostnames = []
|
821
767
|
hosts = host.is_a?(Array) ? host : [host]
|
822
|
-
puppet_version = on(master, puppet('--version')).stdout.chomp
|
823
768
|
hosts.each do |current_host|
|
824
769
|
if [master, dashboard, database].include? current_host
|
825
|
-
on
|
826
|
-
|
827
|
-
if version_is_less(puppet_version, '5.99')
|
828
|
-
on master, puppet("cert --allow-dns-alt-names sign #{current_host}"), acceptable_exit_codes: [0, 24]
|
829
|
-
else
|
830
|
-
on master, "puppetserver ca sign --certname #{current_host}"
|
831
|
-
end
|
770
|
+
on(current_host, puppet('agent -t'), acceptable_exit_codes: [0, 1, 2])
|
771
|
+
on(master, "puppetserver ca sign --certname #{current_host}")
|
832
772
|
else
|
833
773
|
hostnames << Regexp.escape(current_host.node_name)
|
834
774
|
end
|
835
775
|
end
|
836
776
|
|
837
777
|
if hostnames.size < 1
|
838
|
-
|
839
|
-
on master, puppet('cert --sign --all --allow-dns-alt-names'),
|
840
|
-
acceptable_exit_codes: [0, 24]
|
841
|
-
else
|
842
|
-
on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]
|
843
|
-
end
|
778
|
+
on(master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24])
|
844
779
|
return
|
845
780
|
end
|
846
781
|
|
@@ -852,21 +787,11 @@ module Beaker
|
|
852
787
|
fail_test("Failed to sign cert for #{hostnames}")
|
853
788
|
hostnames.clear
|
854
789
|
end
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
hostnames.clear
|
861
|
-
break
|
862
|
-
end
|
863
|
-
else
|
864
|
-
on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]
|
865
|
-
out = on(master, 'puppetserver ca list --all').stdout
|
866
|
-
if out !~ /.*Requested.*/ && hostnames.all? { |hostname| out =~ /\b#{hostname}\b/ }
|
867
|
-
hostnames.clear
|
868
|
-
break
|
869
|
-
end
|
790
|
+
on(master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24])
|
791
|
+
out = on(master, 'puppetserver ca list --all').stdout
|
792
|
+
if out !~ /.*Requested.*/ && hostnames.all? { |hostname| out =~ /\b#{hostname}\b/ }
|
793
|
+
hostnames.clear
|
794
|
+
break
|
870
795
|
end
|
871
796
|
|
872
797
|
sleep next_sleep
|