facter 3.9.6.cfacter.20180612 → 3.11.0.cfacter.20180319
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/facter/facter/CMakeLists.txt +1 -1
- data/ext/facter/facter/acceptance/Gemfile +3 -4
- data/ext/facter/facter/acceptance/Rakefile +342 -2
- data/ext/facter/facter/acceptance/config/aio/options.rb +6 -0
- data/ext/facter/facter/acceptance/config/git/options.rb +5 -1
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/010_Install.rb +22 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/021_InstallAristaModule.rb +12 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/022_Remove_LD_PRELOAD.rb +11 -0
- data/ext/facter/facter/acceptance/setup/common/00_EnvSetup.rb +64 -0
- data/ext/facter/facter/acceptance/setup/common/pre-suite/000-delete-puppet-when-none.rb +11 -0
- data/ext/facter/facter/acceptance/setup/git/pre-suite/01_TestSetup.rb +31 -0
- data/ext/facter/facter/acceptance/tests/ticket_1238_hostname_fqdn.rb +20 -0
- data/ext/facter/facter/lib/CMakeLists.txt +3 -2
- data/ext/facter/facter/lib/Doxyfile +1 -1
- data/ext/facter/facter/lib/inc/facter/facts/fact.hpp +5 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/linux/fips_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/osx/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/posix/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/fips_resolver.hpp +46 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/networking_resolver.hpp +2 -3
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ssh_resolver.hpp +6 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/schema/facter.yaml +38 -18
- data/ext/facter/facter/lib/src/cwrapper.cc +5 -0
- data/ext/facter/facter/lib/src/facts/aix/disk_resolver.cc +2 -11
- data/ext/facter/facter/lib/src/facts/aix/networking_resolver.cc +0 -5
- data/ext/facter/facter/lib/src/facts/freebsd/dmi_resolver.cc +5 -1
- data/ext/facter/facter/lib/src/facts/freebsd/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/freebsd/virtualization_resolver.cc +1 -4
- data/ext/facter/facter/lib/src/facts/linux/collection.cc +2 -0
- data/ext/facter/facter/lib/src/facts/linux/fips_resolver.cc +31 -0
- data/ext/facter/facter/lib/src/facts/linux/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/openbsd/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/osx/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/posix/networking_resolver.cc +2 -3
- data/ext/facter/facter/lib/src/facts/posix/ssh_resolver.cc +3 -2
- data/ext/facter/facter/lib/src/facts/resolvers/fips_resolver.cc +23 -0
- data/ext/facter/facter/lib/src/facts/resolvers/networking_resolver.cc +7 -23
- data/ext/facter/facter/lib/src/facts/resolvers/ssh_resolver.cc +1 -0
- data/ext/facter/facter/lib/src/facts/solaris/networking_resolver.cc +0 -5
- data/ext/facter/facter/lib/tests/facts/resolvers/ssh_resolver.cc +8 -1
- data/ext/facter/facter/lib/tests/facts/schema.cc +17 -0
- data/ext/facter/facter/locales/FACTER.pot +2 -23
- data/ext/facter/leatherman/CHANGELOG.md +16 -9
- data/ext/facter/leatherman/CMakeLists.txt +1 -2
- data/ext/facter/leatherman/appveyor.yml +26 -19
- data/ext/facter/leatherman/catch/CMakeLists.txt +1 -1
- data/ext/facter/leatherman/curl/tests/client_test.cc +396 -398
- data/ext/facter/leatherman/curl/tests/mock_curl.cc +2 -0
- data/ext/facter/leatherman/curl/tests/request_test.cc +66 -68
- data/ext/facter/leatherman/curl/tests/response_test.cc +50 -52
- data/ext/facter/leatherman/dynamic_library/tests/dynamic_library_tests.cc +71 -75
- data/ext/facter/leatherman/execution/src/execution.cc +3 -0
- data/ext/facter/leatherman/execution/src/posix/execution.cc +5 -6
- data/ext/facter/leatherman/execution/src/windows/execution.cc +2 -0
- data/ext/facter/leatherman/execution/tests/windows/execution.cc +4 -2
- data/ext/facter/leatherman/file_util/tests/directory_utils_test.cc +66 -68
- data/ext/facter/leatherman/file_util/tests/file_utils_test.cc +175 -177
- data/ext/facter/leatherman/json_container/inc/leatherman/json_container/json_container.hpp +7 -0
- data/ext/facter/leatherman/json_container/src/json_container.cc +10 -1
- data/ext/facter/leatherman/json_container/tests/json_container_test.cc +152 -8
- data/ext/facter/leatherman/locale/CMakeLists.txt +0 -7
- data/ext/facter/leatherman/locales/leatherman.pot +8 -13
- data/ext/facter/leatherman/logging/src/logging.cc +2 -0
- data/ext/facter/leatherman/util/tests/timer.cc +1 -3
- data/ext/facter/leatherman/vendor/Catch-1.10.0.zip +0 -0
- data/ext/facter/leatherman/vendor/nowide/doc/Doxyfile +4 -4
- data/ext/facter/leatherman/vendor/nowide/doc/LICENSE_1_0.txt +23 -0
- data/ext/facter/leatherman/vendor/nowide/doc/main.txt +62 -54
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/convert.hpp +16 -16
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/cstdio.hpp +4 -4
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/utf8_codecvt.hpp +1 -1
- data/ext/facter/leatherman/vendor/nowide/src/iostream.cpp +32 -30
- data/ext/facter/leatherman/vendor/nowide/standalone/convert +6 -6
- data/ext/facter/leatherman/vendor/nowide/standalone/encoding_utf.hpp +1 -1
- data/ext/facter/leatherman/vendor/nowide/standalone/run_convert_and_build.sh +1 -3
- metadata +15 -6
- data/ext/facter/leatherman/cmake/FindICU.cmake +0 -690
- data/ext/facter/leatherman/scripts/travis_target.sh +0 -79
- data/ext/facter/leatherman/vendor/catch-1.4.0.zip +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c75c160e89555f9e5232eaa405511ef7e2373125
|
4
|
+
data.tar.gz: 8d53785a4ecfb3a633b16c71b7da89358a9c9f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7cd794ebc4a66951feaa32d073f1943dd231015624558f332378f66b8602985bace9de2eb6f12df8a37aab522a5354b191eb808bbc68bda115153507bf5925
|
7
|
+
data.tar.gz: 94ba348c6ee4432a69a9fec3995517a5e98524aca13736873771018d16412405a7f475b8150c05547bb763b5e3da41a4c8ef3c852392f94dea9445e981e1c444
|
@@ -10,10 +10,9 @@ def location_for(place, fake_version = nil)
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || "~> 3.
|
14
|
-
gem
|
15
|
-
gem "beaker-
|
16
|
-
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.5")
|
13
|
+
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || "~> 3.10")
|
14
|
+
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 0.3")
|
15
|
+
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.2")
|
17
16
|
gem 'rake', "~> 10.1.0"
|
18
17
|
gem "multi_json", "~> 1.8"
|
19
18
|
|
@@ -1,2 +1,342 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'pp'
|
3
|
+
require 'yaml'
|
4
|
+
require 'securerandom'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'beaker-hostgenerator'
|
7
|
+
|
8
|
+
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
|
9
|
+
require 'puppet/acceptance/git_utils'
|
10
|
+
extend Puppet::Acceptance::GitUtils
|
11
|
+
|
12
|
+
ONE_DAY_IN_SECS = 24 * 60 * 60
|
13
|
+
REPO_CONFIGS_DIR = "repo-configs"
|
14
|
+
CLEAN.include('*.tar', REPO_CONFIGS_DIR, 'merged_options.rb')
|
15
|
+
|
16
|
+
module HarnessOptions
|
17
|
+
|
18
|
+
DEFAULTS = {
|
19
|
+
:type => 'git',
|
20
|
+
:helper => ['lib/helper.rb'],
|
21
|
+
:tests => ['tests'],
|
22
|
+
:log_level => 'debug',
|
23
|
+
:color => false,
|
24
|
+
:root_keys => true,
|
25
|
+
:ssh => {
|
26
|
+
:keys => ["~/.ssh/id_rsa-acceptance"],
|
27
|
+
},
|
28
|
+
:xml => true,
|
29
|
+
:timesync => false,
|
30
|
+
:repo_proxy => true,
|
31
|
+
:add_el_extras => false,
|
32
|
+
:preserve_hosts => 'onfail',
|
33
|
+
}
|
34
|
+
|
35
|
+
class Aggregator
|
36
|
+
attr_reader :mode
|
37
|
+
|
38
|
+
def initialize(mode)
|
39
|
+
@mode = mode
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_options(file_path)
|
43
|
+
puts file_path
|
44
|
+
if File.exists? file_path
|
45
|
+
options = eval(File.read(file_path), binding)
|
46
|
+
else
|
47
|
+
puts "No options file found at #{File.expand_path(file_path)}"
|
48
|
+
end
|
49
|
+
options || {}
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_mode_options
|
53
|
+
get_options("./config/#{mode}/options.rb")
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_local_options
|
57
|
+
get_options("./local_options.rb")
|
58
|
+
end
|
59
|
+
|
60
|
+
def final_options(intermediary_options = {})
|
61
|
+
mode_options = get_mode_options
|
62
|
+
local_overrides = get_local_options
|
63
|
+
final_options = DEFAULTS.merge(mode_options)
|
64
|
+
final_options.merge!(intermediary_options)
|
65
|
+
final_options.merge!(local_overrides)
|
66
|
+
return final_options
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.options(mode, options)
|
71
|
+
final_options = Aggregator.new(mode).final_options(options)
|
72
|
+
final_options
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def beaker_test(mode = :aio, options = {})
|
77
|
+
final_options = HarnessOptions.options(mode, options)
|
78
|
+
|
79
|
+
if mode == :git
|
80
|
+
final_options[:install] ||= []
|
81
|
+
final_options[:install] << "#{build_giturl('facter')}##{sha}"
|
82
|
+
end
|
83
|
+
|
84
|
+
options_file = 'merged_options.rb'
|
85
|
+
File.open(options_file, 'w') do |merged|
|
86
|
+
merged.puts <<-EOS
|
87
|
+
# Copy this file to local_options.rb and adjust as needed if you wish to run
|
88
|
+
# with some local overrides.
|
89
|
+
EOS
|
90
|
+
merged.puts(final_options.pretty_inspect)
|
91
|
+
end
|
92
|
+
|
93
|
+
tests = ENV['TESTS'] || ENV['TEST']
|
94
|
+
tests_opt = "--tests=#{tests}" if tests
|
95
|
+
|
96
|
+
target = ENV['TEST_TARGET']
|
97
|
+
if config and File.exists?(config)
|
98
|
+
config_opt = "--hosts=#{config}"
|
99
|
+
elsif target
|
100
|
+
cli = BeakerHostGenerator::CLI.new([target, '--disable-default-role', '--osinfo-version', '1'])
|
101
|
+
ENV['BEAKER_HOSTS'] = "tmp/#{target}-#{SecureRandom.uuid}.yaml"
|
102
|
+
FileUtils.mkdir_p('tmp')
|
103
|
+
File.open(config, 'w') do |fh|
|
104
|
+
fh.print(cli.execute)
|
105
|
+
end
|
106
|
+
config_opt = "--hosts=#{config}"
|
107
|
+
end
|
108
|
+
|
109
|
+
overriding_options = ENV['OPTIONS']
|
110
|
+
|
111
|
+
args = ["--options-file", options_file, config_opt, tests_opt, overriding_options].compact
|
112
|
+
|
113
|
+
begin
|
114
|
+
sh("beaker", *args)
|
115
|
+
ensure
|
116
|
+
if (hosts_file = config || final_options[:hosts_file]) && hosts_file !~ /preserved_config/
|
117
|
+
cp(hosts_file, "log/latest/config.yml")
|
118
|
+
generate_config_for_latest_hosts if final_options[:preserve_hosts] || overriding_options =~ /--preserve-hosts/
|
119
|
+
end
|
120
|
+
mv(options_file, "log/latest")
|
121
|
+
puts "\n\n"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def generate_config_for_latest_hosts
|
126
|
+
preserved_config_hash = { 'HOSTS' => {} }
|
127
|
+
|
128
|
+
config_hash = YAML.load_file('log/latest/config.yml').to_hash
|
129
|
+
nodes = config_hash['HOSTS'].map do |node_label,hash|
|
130
|
+
{ :node_label => node_label, :platform => hash['platform'] }
|
131
|
+
end
|
132
|
+
|
133
|
+
pre_suite_log = File.read('log/latest/pre_suite-run.log')
|
134
|
+
nodes.each do |node_info|
|
135
|
+
possible_hostname_match = /^(\w+) \(#{node_info[:node_label]}\)/.match(pre_suite_log)
|
136
|
+
hostname = (possible_hostname_match || Array.new)[1]
|
137
|
+
fqdn = hostname ? "#{hostname}.delivery.puppetlabs.net" : "unknown"
|
138
|
+
preserved_config_hash['HOSTS'][fqdn] = {
|
139
|
+
'roles' => [ 'agent'],
|
140
|
+
'platform' => node_info[:platform],
|
141
|
+
}
|
142
|
+
preserved_config_hash['HOSTS'][fqdn]['roles'].unshift('master') if node_info[:node_label] =~ /master/
|
143
|
+
end
|
144
|
+
|
145
|
+
puts "\n\n"
|
146
|
+
pp preserved_config_hash
|
147
|
+
puts "\n\n"
|
148
|
+
|
149
|
+
File.open('log/latest/preserved_config.yaml', 'w') do |config_file|
|
150
|
+
YAML.dump(preserved_config_hash, config_file)
|
151
|
+
end
|
152
|
+
rescue Errno::ENOENT => e
|
153
|
+
puts "Couldn't generate log #{e}"
|
154
|
+
end
|
155
|
+
|
156
|
+
def list_preserved_configurations(secs_ago = ONE_DAY_IN_SECS)
|
157
|
+
preserved = {}
|
158
|
+
Dir.glob('log/*_*').each do |dir|
|
159
|
+
preserved_config_path = "#{dir}/preserved_config.yaml"
|
160
|
+
yesterday = Time.now - secs_ago.to_i
|
161
|
+
if preserved_config = File.exists?(preserved_config_path)
|
162
|
+
directory = File.new(dir)
|
163
|
+
if directory.ctime > yesterday
|
164
|
+
hosts = []
|
165
|
+
preserved_config = YAML.load_file(preserved_config_path).to_hash
|
166
|
+
preserved_config['HOSTS'].each do |hostname,values|
|
167
|
+
hosts << "#{hostname}: #{values['platform']}, #{values['roles']}"
|
168
|
+
end
|
169
|
+
preserved[hosts] = directory.to_path
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
preserved.map { |k,v| [v,k] }.sort { |a,b| a[0] <=> b[0] }.reverse
|
174
|
+
end
|
175
|
+
|
176
|
+
def list_preserved_hosts(secs_ago = ONE_DAY_IN_SECS)
|
177
|
+
hosts = Set.new
|
178
|
+
Dir.glob('log/**/pre*suite*run.log').each do |log|
|
179
|
+
yesterday = Time.now - secs_ago.to_i
|
180
|
+
File.open(log, 'r') do |file|
|
181
|
+
if file.ctime > yesterday
|
182
|
+
file.each_line do |line|
|
183
|
+
matchdata = /^(\w+) \(.*?\) \$/.match(line.encode!('UTF-8', 'UTF-8', :invalid => :replace))
|
184
|
+
hosts.add(matchdata[1]) if matchdata
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
hosts
|
190
|
+
end
|
191
|
+
|
192
|
+
# Plagiarized from Beaker::Vcloud#cleanup
|
193
|
+
def destroy_preserved_hosts(hosts = nil, secs_ago = ONE_DAY_IN_SECS)
|
194
|
+
secs_ago ||= ONE_DAY_IN_SECS
|
195
|
+
hosts ||= list_preserved_hosts(secs_ago)
|
196
|
+
|
197
|
+
require 'beaker/hypervisor/vsphere_helper'
|
198
|
+
vsphere_credentials = VsphereHelper.load_config("#{ENV['HOME']}/.fog")
|
199
|
+
|
200
|
+
puts "Connecting to vSphere at #{vsphere_credentials[:server]}" +
|
201
|
+
" with credentials for #{vsphere_credentials[:user]}"
|
202
|
+
|
203
|
+
vsphere_helper = VsphereHelper.new( vsphere_credentials )
|
204
|
+
|
205
|
+
vm_names = hosts.to_a
|
206
|
+
pp vm_names
|
207
|
+
vms = vsphere_helper.find_vms vm_names
|
208
|
+
vm_names.each do |name|
|
209
|
+
unless vm = vms[name]
|
210
|
+
puts "Couldn't find VM #{name} in vSphere!"
|
211
|
+
next
|
212
|
+
end
|
213
|
+
|
214
|
+
if vm.runtime.powerState == 'poweredOn'
|
215
|
+
puts "Shutting down #{vm.name}"
|
216
|
+
start = Time.now
|
217
|
+
vm.PowerOffVM_Task.wait_for_completion
|
218
|
+
puts "Spent %.2f seconds halting #{vm.name}" % (Time.now - start)
|
219
|
+
end
|
220
|
+
|
221
|
+
start = Time.now
|
222
|
+
vm.Destroy_Task
|
223
|
+
puts "Spent %.2f seconds destroying #{vm.name}" % (Time.now - start)
|
224
|
+
end
|
225
|
+
|
226
|
+
vsphere_helper.close
|
227
|
+
end
|
228
|
+
|
229
|
+
def print_preserved(preserved)
|
230
|
+
preserved.each_with_index do |entry,i|
|
231
|
+
puts "##{i}: #{entry[0]}"
|
232
|
+
entry[1].each { |h| puts " #{h}" }
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def beaker_run_type
|
237
|
+
type = ENV['TYPE'] || :aio
|
238
|
+
type = type.to_sym
|
239
|
+
end
|
240
|
+
|
241
|
+
def sha
|
242
|
+
ENV['SHA']
|
243
|
+
end
|
244
|
+
|
245
|
+
def config
|
246
|
+
ENV['BEAKER_HOSTS']
|
247
|
+
end
|
248
|
+
|
249
|
+
namespace :ci do
|
250
|
+
|
251
|
+
task :check_env do
|
252
|
+
raise(USAGE) unless sha
|
253
|
+
end
|
254
|
+
|
255
|
+
namespace :test do
|
256
|
+
|
257
|
+
USAGE = <<-EOS
|
258
|
+
Requires commit SHA to be put under test as environment variable: SHA='<sha>'.
|
259
|
+
Also must set BEAKER_HOSTS=config/nodes/foo.yaml or include it in an options.rb for Beaker,
|
260
|
+
or specify TEST_TARGET in a form beaker-hostgenerator accepts, e.g. ubuntu1504-64a.
|
261
|
+
You may set TESTS=path/to/test,and/more/tests.
|
262
|
+
You may set additional Beaker OPTIONS='--more --options'
|
263
|
+
If testing from git checkouts, you may optionally set the github fork to checkout from using FORK='other-puppet-fork'.
|
264
|
+
You may also optionally set the git server to checkout from using GIT_SERVER='my.host.with.git.daemon', if you have set up a `git daemon` to pull local commits from. (In this case, the FORK should be set to the path to the repository, and you will need to allow the git daemon to serve the repo (see `git help daemon`)).
|
265
|
+
If there is a Beaker options hash in a ./local_options.rb, it will be included. Commandline options set through the above environment variables will override settings in this file.
|
266
|
+
EOS
|
267
|
+
|
268
|
+
desc <<-EOS
|
269
|
+
Run the acceptance tests through Beaker and install packages as part of the AIO puppet-agent installation.
|
270
|
+
#{USAGE}
|
271
|
+
EOS
|
272
|
+
task :aio => 'ci:check_env' do
|
273
|
+
beaker_test(:aio)
|
274
|
+
end
|
275
|
+
|
276
|
+
desc <<-EOS
|
277
|
+
Run the acceptance tests through Beaker and install from git on the configuration targets.
|
278
|
+
#{USAGE}
|
279
|
+
EOS
|
280
|
+
task :git => 'ci:check_env' do
|
281
|
+
beaker_test(:git)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
desc "Capture the master and agent hostname from the latest log and construct a preserved_config.yaml for re-running against preserved hosts without provisioning."
|
286
|
+
task :extract_preserved_config do
|
287
|
+
generate_config_for_latest_hosts
|
288
|
+
end
|
289
|
+
|
290
|
+
desc <<-EOS
|
291
|
+
Run an acceptance test for a given node configuration and preserve the hosts.
|
292
|
+
Defaults to a packages run, but you can set it to 'git' with TYPE='git'.
|
293
|
+
#{USAGE}
|
294
|
+
EOS
|
295
|
+
task :test_and_preserve_hosts => 'ci:check_env' do
|
296
|
+
beaker_test(beaker_run_type, :preserve_hosts => 'always', :__preserve_config__ => true)
|
297
|
+
end
|
298
|
+
|
299
|
+
desc "List acceptance runs from the past day which had hosts preserved."
|
300
|
+
task :list_preserved do
|
301
|
+
preserved = list_preserved_configurations
|
302
|
+
print_preserved(preserved)
|
303
|
+
end
|
304
|
+
|
305
|
+
desc <<-EOS
|
306
|
+
Shutdown and destroy any hosts that we have preserved for testing. These should be reaped daily by scripts, but this will free up resources immediately.
|
307
|
+
Specify a list of comma separated HOST_NAMES if you have a set of dynamic vcloud host names you want to purge outside of what can be grepped from the logs.
|
308
|
+
You can go back through the last SECS_AGO logs. Default is one day ago in secs.
|
309
|
+
EOS
|
310
|
+
task :destroy_preserved_hosts do
|
311
|
+
host_names = ENV['HOST_NAMES'].split(',') if ENV['HOST_NAMES']
|
312
|
+
secs_ago = ENV['SECS_AGO']
|
313
|
+
destroy_preserved_hosts(host_names, secs_ago)
|
314
|
+
end
|
315
|
+
|
316
|
+
desc <<-EOS
|
317
|
+
Rerun an acceptance test using the last captured preserved_config.yaml to skip provisioning.
|
318
|
+
Or specify a CONFIG_NUMBER from `rake ci:list_preserved`.
|
319
|
+
Uses the setup/rsync/pre-suite to rsync the local puppet source onto master and agent.
|
320
|
+
You may specify an RSYNC_FILTER_FILE as well.
|
321
|
+
You may skip purging and reinstalling puppet packages by including SKIP_PACKAGE_REINSTALL.
|
322
|
+
You may skip rsyncing local puppet files over to the tests hosts by including SKIP_RSYNC.
|
323
|
+
Defaults to an aio run, but you can set it to 'git' with TYPE='git'.
|
324
|
+
EOS
|
325
|
+
task :test_against_preserved_hosts do
|
326
|
+
config_number = (ENV['CONFIG_NUMBER'] || 0).to_i
|
327
|
+
preserved = list_preserved_configurations
|
328
|
+
print_preserved(preserved)
|
329
|
+
config_path = preserved[config_number][0]
|
330
|
+
puts "Using ##{config_number}: #{config_path}"
|
331
|
+
beaker_test(beaker_run_type,
|
332
|
+
:hosts_file => "#{config_path}/preserved_config.yaml",
|
333
|
+
:no_provision => true,
|
334
|
+
:preserve_hosts => 'always',
|
335
|
+
:pre_suite => ['setup/rsync/pre-suite']
|
336
|
+
)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
task :default do
|
341
|
+
sh('rake -T')
|
342
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'puppet/acceptance/common_utils'
|
2
|
+
require 'beaker/dsl/install_utils'
|
3
|
+
extend Beaker::DSL::InstallUtils
|
4
|
+
|
5
|
+
test_name "Install Packages"
|
6
|
+
|
7
|
+
step "Install puppet-agent..." do
|
8
|
+
opts = {
|
9
|
+
:puppet_collection => 'PC1',
|
10
|
+
:puppet_agent_sha => ENV['SHA'],
|
11
|
+
:puppet_agent_version => ENV['SUITE_VERSION'] || ENV['SHA']
|
12
|
+
}
|
13
|
+
install_puppet_agent_dev_repo_on(hosts, opts)
|
14
|
+
end
|
15
|
+
|
16
|
+
# make sure install is sane, beaker has already added puppet and ruby
|
17
|
+
# to PATH in ~/.ssh/environment
|
18
|
+
agents.each do |agent|
|
19
|
+
on agent, puppet('--version')
|
20
|
+
ruby = Puppet::Acceptance::CommandUtils.ruby_command(agent)
|
21
|
+
on agent, "#{ruby} --version"
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
platforms = hosts.map{|val| val[:platform]}
|
2
|
+
skip_test "No arista hosts present" unless platforms.any? { |val| /^eos-/ =~ val }
|
3
|
+
test_name 'Arista Switch Pre-suite' do
|
4
|
+
switchs = select_hosts({:platform => ['eos-4-i386']})
|
5
|
+
|
6
|
+
step 'add puppet user to switch' do
|
7
|
+
switchs.each do |switch|
|
8
|
+
on(switch, "/opt/puppetlabs/bin/puppet config --confdir /etc/puppetlabs/puppet set user root")
|
9
|
+
on(switch, "/opt/puppetlabs/bin/puppet config --confdir /etc/puppetlabs/puppet set group root")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
platforms = hosts.map{|val| val[:platform]}
|
2
|
+
skip_test "No Cisco XR hosts present" unless platforms.any? { |val| /^cisco_ios_xr-/ =~ val }
|
3
|
+
test_name 'Cisco XR Switch Pre-suite' do
|
4
|
+
switchs = select_hosts({:platform => ['cisco_ios_xr-6-x86_64']})
|
5
|
+
|
6
|
+
step 'remove LD_PRELOAD setting from switch' do
|
7
|
+
switchs.each do |switch|
|
8
|
+
on(switch, "echo 'unset LD_PRELOAD' >> /etc/profile")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|