beaker 3.3.0 → 3.4.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGEwYTM4MDM4OGExZmVmN2ExZjI4NGRjM2RjNmJlOGIyNDk0MWQ0MA==
4
+ MjUxN2I4ODkyOTg4MjI0YzI0MGVkNjEwNWU5NzFiNjZkMzc0MzgzYw==
5
5
  data.tar.gz: !binary |-
6
- ZWE4NGY3ZDgzZWVmYzY3YTQ2ZTlkNjhmY2Y1ZGY4YjRlOTk1MTI3MA==
6
+ YjdmY2JmOTI1YTMyYjQxMzM3MDBhZjMzYTIwOWUwMjg3MWViYmE2Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDIwMjY0OTIwMjgwYzljZWQzMTRmMjgyOGQ2YzE4OWViZjJhYWNiM2JkNDli
10
- MTE1YTVmZjBkYWQ1OWJkMTg2M2JkOWUzNjdkOWM1M2ZlMGQzOGQ3NTY4MDE0
11
- YWNhYTgzODViYWJjMjEwOWM0NDEyY2VjOWY3ZmJmYTQ3OTk4ZTY=
9
+ MWU2MTdkYWRlYmNjM2I1NmQ2MjM5MzJlNWNiYTc5MGFhYjc2MDg0ZjZmMTg2
10
+ MGRlNzU0Y2YyNDFiMDI5NWIyNzQ4MmRhZmEyYTMxYjYzODNjYmEyZDRhMTM1
11
+ MWY3ZTFjZDE5NWY2MDQ0ZjJiZDlhYmE5OTFkZWI0NDExY2E1YzE=
12
12
  data.tar.gz: !binary |-
13
- ZWIxOGNkYjgyZTc2OTc2ZWRiMDczYjI2OGNhYmY3ZTA2ZjY0MjdhMWU4MGY2
14
- NDIyMjhkZDUyM2ZhNWVjYmZiOGQ1NWU2ZDNjMTdkZjYzMGUzZWVjNzk3NzBl
15
- N2IyMDYwMzk0OTk5Y2IyMDcyYWE1OTNkYTlmN2FiMmMwODc5Njc=
13
+ MWY5M2I4ZjIxMDA0NzUwNGM2MTU0MDcwMmNmMzcyYjI3NDY3YWNiY2VjMjdh
14
+ NDBiNTRhNmRjZGYzNzQ2YjQ0MTc3NTNkZjU1MWNlYTg4MmU1M2YwYTY1NmUz
15
+ MzY2ZGMzM2ZjZjI4Nzk4YWU5Y2E1YzhkOTNlMGVjYzAxMWJhYmY=
@@ -19,17 +19,29 @@ test_name "dsl::helpers::host_helpers #archive_file_from" do
19
19
  assert_equal(true, Dir.exists?('archive/sut-files'))
20
20
  end
21
21
 
22
- step "file is copied to local <archiveroot>/<host name> directory" do
22
+ step "fails archive_file_from when from_path is non-existant" do
23
+ filepath = "foo-filepath-should-not-exist"
24
+ assert_raises IOError do
25
+ archive_file_from(default, filepath)
26
+ end
27
+ end
28
+
29
+ step "archive is copied to local <archiveroot>/<hostname>/<filepath> directory" do
23
30
  # Create a remote file to archive
24
31
  filepath = default.tmpfile('archive-file-test')
25
32
  create_remote_file(default, filepath, 'number of the beast')
33
+ assert_equal(false, Dir.exists?(filepath))
26
34
 
27
35
  # Test that the file is copied locally to <archiveroot>/<hostname>/<filepath>
28
36
  Dir.mktmpdir do |tmpdir|
29
- archive_file_from(default, filepath, {}, tmpdir)
30
- expected_path = File.join(tmpdir, default, filepath)
31
- assert(File.exists?(expected_path))
32
- assert_equal('number of the beast', File.read(expected_path).strip)
37
+ tar_path = File.join(tmpdir, default, filepath + '.tgz')
38
+ archive_file_from(default, filepath, {}, tmpdir, tar_path)
39
+ assert(File.exists?(tar_path))
40
+ expected_path = File.join(tmpdir, default)
41
+
42
+ tgz = Zlib::GzipReader.new(File.open(tar_path, 'rb'))
43
+ Archive::Tar::Minitar.unpack(tgz, expected_path)
44
+ assert_equal('number of the beast', File.read(expected_path + '/' + filepath).strip)
33
45
  end
34
46
  end
35
47
  end
@@ -32,12 +32,13 @@ Gem::Specification.new do |s|
32
32
 
33
33
  # Run time dependencies
34
34
  s.add_runtime_dependency 'minitest', '~> 5.4'
35
+ s.add_runtime_dependency 'minitar', '~> 0.5.4'
35
36
  s.add_runtime_dependency 'json', '~> 1.8'
36
37
  ## json: will stay <2.0 while aws-sdk-v1 is in use
37
38
  ## aws-sdk-2 doesn't require json, so we can give this up when we move
38
39
 
39
40
  s.add_runtime_dependency 'hocon', '~> 1.0'
40
- s.add_runtime_dependency 'net-ssh', '~> 3.2'
41
+ s.add_runtime_dependency 'net-ssh', '3.3.0.beta1'
41
42
  s.add_runtime_dependency 'net-scp', '~> 1.2'
42
43
  s.add_runtime_dependency 'inifile', '~> 2.0'
43
44
  ## inifile: keep <3.0, breaks puppet_helpers.rb:puppet_conf_for when updated
@@ -254,15 +254,34 @@ module Beaker
254
254
  # @option [String] archive_root The local directory to store the copied
255
255
  # file under. Defaults to
256
256
  # 'archive/sut-files'.
257
+ # @option [String] archive_name The name of the archive to be copied to
258
+ # archive_root. Defaults to
259
+ # 'sut-files.tgz'.
257
260
  #
258
261
  # @return [Result] Returns the result of the #scp_from operation.
259
- def archive_file_from(host, from_path, opts = {}, archive_root = 'archive/sut-files')
262
+ def archive_file_from(host, from_path, opts = {}, archive_root = 'archive/sut-files', archive_name = 'sut-files.tgz')
263
+ require 'archive/tar/minitar'
260
264
  filedir = File.dirname(from_path)
261
265
  targetdir = File.join(archive_root, host.hostname, filedir)
266
+ # full path to check for existance later
267
+ filename = "#{targetdir}/" + File.basename(from_path)
262
268
  FileUtils.mkdir_p(targetdir)
263
269
  scp_from(host, from_path, targetdir, opts)
270
+ # scp_from does succeed on a non-existant file, checking if the file/folder actually exists
271
+ if not File.exists?(filename)
272
+ raise IOError, "No such file or directory - #{filename}"
273
+ end
274
+ create_tarball(archive_root, archive_name)
264
275
  end
265
276
 
277
+ # @visibility private
278
+ def create_tarball(path, archive_name)
279
+ tgz = Zlib::GzipWriter.new(File.open(archive_name, 'wb'))
280
+ Archive::Tar::Minitar.pack(path, tgz)
281
+ end
282
+ private :create_tarball
283
+
284
+
266
285
  # Deploy packaging configurations generated by
267
286
  # https://github.com/puppetlabs/packaging to a host.
268
287
  #
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '3.3.0'
3
+ STRING = '3.4.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '5.4'
125
+ - !ruby/object:Gem::Dependency
126
+ name: minitar
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 0.5.4
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 0.5.4
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: json
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +168,16 @@ dependencies:
154
168
  name: net-ssh
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ~>
171
+ - - '='
158
172
  - !ruby/object:Gem::Version
159
- version: '3.2'
173
+ version: 3.3.0.beta1
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ~>
178
+ - - '='
165
179
  - !ruby/object:Gem::Version
166
- version: '3.2'
180
+ version: 3.3.0.beta1
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: net-scp
169
183
  requirement: !ruby/object:Gem::Requirement