simp-beaker-helpers 1.13.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9229a2699ed6767059dee0f1b835dece7284420aabc219a0f195f6b9d0d0622
4
- data.tar.gz: 99f9de96732cd0e07f02fc29c1af20fc6390bf67a55d22046eb93f836b8a377c
3
+ metadata.gz: 8bd7cad880ca341adea6a150fffbf724759599f673a2164022e4b77d1fabec0e
4
+ data.tar.gz: d9dd6b4e5712556733a735bb0ad6e66c2e200075f14fd567f044facdc15f392c
5
5
  SHA512:
6
- metadata.gz: 2289cd0e1bff87e03cad29ee5f36d0f609b2ee2d0ccdff5101a22e5df5ba26a21b44e79d9bb228607d670e51a6c55dfad57d149179844cece4edbfdfc46fcbd7
7
- data.tar.gz: 84557eec4604ec94fec37c4a47415fdba716ccbc5c2c7d92f5d6f1e87f63774c9a6004006541aa58ed8f441ca3e8a86094c2892d90d3716b1a173e21bde1302f
6
+ metadata.gz: a50c5176e579f344d13fb86dcfeeb9c5e2b3bc59a69f4277824f3b8bec92baa38e52ed1085c1cc621b03e1d7087d7cdca05ae4665f466e0a8cb93719e345ad39
7
+ data.tar.gz: 85fc20afb96e3d4b157ed479d8d808e3bd7050de38018bb38ef0dd72a93c8ce66a78652da7f76b6cbe519b6a16c233d40304a71fb0434aa2cc80a940046b67c8
@@ -1,3 +1,9 @@
1
+ ### 1.13.1 / 2019-02-02
2
+ * Ensure that SUTs have an FQDN set and not just a short hostname
3
+ * Work around issue where the SSG doesn't build the STIG for CentOS any longer.
4
+ * Add a work around for getting the docker SUT ID due to breaking changes in
5
+ the beaker-docker gem
6
+
1
7
  ### 1.13.0 / 2018-11-09
2
8
  * Make the SSG reporting consistent with the InSpec reporting
3
9
  * Thanks to Liz Nemsick for the original result processing code
@@ -49,7 +49,13 @@ module Simp::BeakerHelpers
49
49
  end
50
50
  end
51
51
 
52
- %x(tar #{exclude_list.join(' ')} -hcf - -C "#{File.dirname(src)}" "#{File.basename(src)}" | docker exec -i "#{sut.host_hash[:docker_container].id}" tar -C "#{dest}" -xf -)
52
+ # Work around for breaking changes in beaker-docker
53
+ if sut.host_hash[:docker_container]
54
+ container_id = sut.host_hash[:docker_container].id
55
+ else
56
+ container_id = sut.host_hash[:docker_container_id]
57
+ end
58
+ %x(tar #{exclude_list.join(' ')} -hcf - -C "#{File.dirname(src)}" "#{File.basename(src)}" | docker exec -i "#{container_id}" tar -C "#{dest}" -xf -)
53
59
  elsif @has_rsync && sut.check_for_command('rsync')
54
60
  # This makes rsync_to work like beaker and scp usually do
55
61
  exclude_hack = %(__-__' -L --exclude '__-__)
@@ -376,7 +382,28 @@ module Simp::BeakerHelpers
376
382
  # We need to be able to flip between server and client without issue
377
383
  on sut, 'puppet resource group puppet gid=52'
378
384
  on sut, 'puppet resource user puppet comment="Puppet" gid="52" uid="52" home="/var/lib/puppet" managehome=true'
379
-
385
+
386
+ # Make sure we have a domain on our host
387
+ current_domain = fact_on(sut, 'domain').strip
388
+ hostname = fact_on(sut, 'hostname').strip
389
+
390
+ if current_domain.empty?
391
+ new_fqdn = hostname + '.beaker.test'
392
+
393
+ on(sut, "sed -i 's/#{hostname}.*/#{new_fqdn} #{hostname}/' /etc/hosts")
394
+ on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
395
+ on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
396
+
397
+ if sut.file_exist?('/etc/sysconfig/network')
398
+ on(sut, "sed -s '/HOSTNAME=/d' /etc/sysconfig/network")
399
+ on(sut, "echo 'HOSTNAME=#{new_fqdn}' >> /etc/sysconfig/network")
400
+ end
401
+ end
402
+
403
+ if fact_on(sut, 'domain').strip.empty?
404
+ fail("Error: hosts must have an FQDN, got domain='#{current_domain}'")
405
+ end
406
+
380
407
  # This may not exist in docker so just skip the whole thing
381
408
  if sut.file_exist?('/etc/ssh')
382
409
  # SIMP uses a central ssh key location so we prep that spot in case we
@@ -409,7 +436,7 @@ module Simp::BeakerHelpers
409
436
  on(sut, %{if [ -f "#{src_file}" ]; then cp -a -f "#{src_file}" "#{tgt_file}" && chmod 644 "#{tgt_file}"; fi}, :silent => true)
410
437
  end
411
438
  end
412
-
439
+
413
440
  # SIMP uses structured facts, therefore stringify_facts must be disabled
414
441
  unless ENV['BEAKER_stringify_facts'] == 'yes'
415
442
  on sut, 'puppet config set stringify_facts false'
@@ -64,7 +64,14 @@ module Simp::BeakerHelpers
64
64
  begin
65
65
  Dir.chdir(tmpdir) do
66
66
  if @sut[:hypervisor] == 'docker'
67
- %x(docker cp "#{@sut.host_hash[:docker_container].id}:#{sut_inspec_results}" .)
67
+ # Work around for breaking changes in beaker-docker
68
+ if @sut.host_hash[:docker_container]
69
+ container_id = @sut.host_hash[:docker_container].id
70
+ else
71
+ container_id = @sut.host_hash[:docker_container_id]
72
+ end
73
+
74
+ %x(docker cp "#{container_id}:#{sut_inspec_results}" .)
68
75
  else
69
76
  scp_from(@sut, sut_inspec_results, '.')
70
77
  end
@@ -277,6 +277,15 @@ module Simp::BeakerHelpers
277
277
  else
278
278
  on(@sut, %(cd scap-content; git checkout $(git describe --abbrev=0 --tags)))
279
279
  end
280
+
281
+ # Work around the issue where the profiles now strip out derivative
282
+ # content that isn't explicitlly approved for that OS. This means that
283
+ # we are unable to test CentOS builds against the STIG, etc...
284
+ #
285
+ # This isn't 100% correct but it's "good enough" for an automated CI
286
+ # environment to tell us if something is critically out of alignment.
287
+ on(@sut, %(cd scap-content/build-scripts; sed -i 's/ssg.build_derivatives.profile_handling/#ssg.build_derivatives.profile_handling/g' enable_derivatives.py))
288
+
280
289
  on(@sut, %(cd scap-content/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
281
290
  end
282
291
  end
@@ -1,5 +1,5 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.13.0'
4
+ VERSION = '1.13.1'
5
5
  end
@@ -31,11 +31,6 @@ Gem::Specification.new do |s|
31
31
  # TODO: Update this when we no longer support Ruby 2.1.9 (should be October 2018)
32
32
  s.add_runtime_dependency 'net-telnet', '~> 0.1.1'
33
33
 
34
- # Because net-telnet dropped support for Ruby < 2.2.0
35
- # TODO: Update this when we no longer support Ruby 2.1.9 (should be October 2018)
36
- s.add_runtime_dependency 'rubocop', '~> 0.57.2'
37
-
38
-
39
34
  ### s.files = Dir['Rakefile', '{bin,lib,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
40
35
  s.files = `git ls-files`.split("\n")
41
36
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-beaker-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-15 00:00:00.000000000 Z
12
+ date: 2019-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker
@@ -137,20 +137,6 @@ dependencies:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: 0.1.1
140
- - !ruby/object:Gem::Dependency
141
- name: rubocop
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - "~>"
145
- - !ruby/object:Gem::Version
146
- version: 0.57.2
147
- type: :runtime
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - "~>"
152
- - !ruby/object:Gem::Version
153
- version: 0.57.2
154
140
  description: " Beaker helper methods to help scaffold SIMP acceptance tests\n"
155
141
  email: simp@simp-project.org
156
142
  executables: []