beaker 2.34.0 → 2.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +95 -2
- data/README.md +1 -1
- data/lib/beaker/dsl/install_utils/foss_utils.rb +15 -62
- data/lib/beaker/host.rb +36 -7
- data/lib/beaker/host/mac.rb +0 -42
- data/lib/beaker/host/mac/pkg.rb +80 -0
- data/lib/beaker/host/unix.rb +0 -95
- data/lib/beaker/host/unix/pkg.rb +212 -0
- data/lib/beaker/host/windows.rb +0 -22
- data/lib/beaker/host/windows/pkg.rb +44 -0
- data/lib/beaker/hypervisor.rb +4 -2
- data/lib/beaker/hypervisor/docker.rb +1 -1
- data/lib/beaker/network_manager.rb +1 -0
- data/lib/beaker/options/command_line_parser.rb +0 -1
- data/lib/beaker/result.rb +7 -0
- data/lib/beaker/ssh_connection.rb +4 -11
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +1 -36
- data/spec/beaker/host/unix/pkg_spec.rb +87 -0
- data/spec/beaker/host/unix_spec.rb +20 -0
- data/spec/beaker/host_spec.rb +18 -19
- data/spec/beaker/hypervisor/docker_spec.rb +10 -0
- data/spec/beaker/hypervisor/hypervisor_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzUxMTk0ODg1NjgxNDFkYzQ2ZDMzZTc5MjYxMDNkOTg1ODc1YmZlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2Q4ZTQ3MjcyZmE3ZTA5YTdlMmYyYjdkMzFjZTAxMDMxMTRkMDUwNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDljNGJlOWRkNTI2NDkyM2JiZGI0ODY2YWVjYWZmZWEyYjRjMGIyMDE2YTZm
|
10
|
+
OTMwYzJkOTQ4M2VmNmExYzQ5ZTI3YzkwMTkwMDMwZDIxOTFlYWI3Y2RmZDky
|
11
|
+
ZGEzNTcxMWUzODljODA1MTA0YTFkMDZhMzczZjE3MjE0ZjVjZDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjE1MDQxMWYyYmMzMWM2NjdlZjFmYzQ5ZmU4YWE5YWEyNDQ4MzRkZGYzZTcw
|
14
|
+
NDAxM2YxZTdjYTZjYmIwYjBkMmI5NWE0OGM3N2IwYzljZDgwMzJlZTc3NGIx
|
15
|
+
YzJjNzI1ZDJhMDVlY2FmZGRiNDcwNTRmNGE3ZDgwNGUzMDc2MWU=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 24 Feb, 2016 (e714b1eb)](#LATEST)
|
4
|
+
* [2.34.0 - 10 Feb, 2016 (b897a98a)](#2.34.0)
|
4
5
|
* [2.33.0 - 27 Jan, 2016 (0dd8505a)](#2.33.0)
|
5
6
|
* [2.32.1 - 14 Jan, 2016 (8c394fdb)](#2.32.1)
|
6
7
|
* [2.32.0 - 12 Jan, 2016 (80e153cc)](#2.32.0)
|
@@ -109,7 +110,99 @@
|
|
109
110
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
110
111
|
|
111
112
|
## Details
|
112
|
-
### <a name = "LATEST">LATEST -
|
113
|
+
### <a name = "LATEST">LATEST - 24 Feb, 2016 (e714b1eb)
|
114
|
+
|
115
|
+
* (GEM) update beaker version to 2.35.0 (e714b1eb)
|
116
|
+
|
117
|
+
* Merge pull request #1067 from kevpl/bkr693_solaris_install (539de014)
|
118
|
+
|
119
|
+
|
120
|
+
```
|
121
|
+
Merge pull request #1067 from kevpl/bkr693_solaris_install
|
122
|
+
|
123
|
+
(BKR-693) solaris install puppet-agent from PE promoted repo fix
|
124
|
+
```
|
125
|
+
* Merge pull request #1069 from pinkypie/BKR-99 (875f984f)
|
126
|
+
|
127
|
+
|
128
|
+
```
|
129
|
+
Merge pull request #1069 from pinkypie/BKR-99
|
130
|
+
|
131
|
+
(BKR-99) - Populate host[:timesync] with host configured value.
|
132
|
+
```
|
133
|
+
* Merge pull request #1065 from op-ct/BKR-704_relative_docker_mount_folders (70805173)
|
134
|
+
|
135
|
+
|
136
|
+
```
|
137
|
+
Merge pull request #1065 from op-ct/BKR-704_relative_docker_mount_folders
|
138
|
+
|
139
|
+
(BKR-704) Allow relative `mount_folders` in docker
|
140
|
+
```
|
141
|
+
* Merge pull request #1059 from jordane/master (28047b44)
|
142
|
+
|
143
|
+
|
144
|
+
```
|
145
|
+
Merge pull request #1059 from jordane/master
|
146
|
+
|
147
|
+
point install link to docs/
|
148
|
+
```
|
149
|
+
* (BKR-99) - Populate host[:timesync] with host configured value if it has been set. (d1454372)
|
150
|
+
|
151
|
+
|
152
|
+
```
|
153
|
+
(BKR-99) - Populate host[:timesync] with host configured value if it has been set.
|
154
|
+
Add spec tests.
|
155
|
+
```
|
156
|
+
* (BKR-693) refactored duplicate install logic into separate method (0a1075dc)
|
157
|
+
|
158
|
+
* (BKR-693) refactored pe promoted puppet-agent install (0370c4b5)
|
159
|
+
|
160
|
+
* Merge pull request #1063 from pinkypie/BKR-48 (b2b9ad6e)
|
161
|
+
|
162
|
+
|
163
|
+
```
|
164
|
+
Merge pull request #1063 from pinkypie/BKR-48
|
165
|
+
|
166
|
+
(BKR-48) Change how --dry_run is defined - should not be global variable.
|
167
|
+
```
|
168
|
+
* (BKR-693) fixed solaris 10/11 install_puppet_agent_pe_promoted_repo_on (8f1f3a58)
|
169
|
+
|
170
|
+
* (BKR-48) implementing Null object pattern for Beaker::NullResult (7499df05)
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
(BKR-48) implementing Null object pattern for Beaker::NullResult
|
175
|
+
This is so that calling methods can handle a dry-run more gracefully.
|
176
|
+
```
|
177
|
+
* (BKR-704) Allow relative `mount_folders` in docker (2a30987c)
|
178
|
+
|
179
|
+
|
180
|
+
```
|
181
|
+
(BKR-704) Allow relative `mount_folders` in docker
|
182
|
+
|
183
|
+
Without this patch, a nodeset using relative `from:` paths under
|
184
|
+
`mount_folders:` with the `docker` hypervisor will encounter a
|
185
|
+
test-halting `Docker::Error::ClientError`. This is a problem because
|
186
|
+
it forces docker-based nodesets to specify host-side mounts with
|
187
|
+
absolute paths, which isn't portable.
|
188
|
+
|
189
|
+
This patch fixes the issue by using Ruby's `File.expand_path()` method to
|
190
|
+
translate any relative `mount_folders:`/`from:` entries into absolute
|
191
|
+
paths before passing them on to docker.
|
192
|
+
```
|
193
|
+
* (BKR-48) Change how --dry_run is defined (f27e4803)
|
194
|
+
|
195
|
+
|
196
|
+
```
|
197
|
+
(BKR-48) Change how --dry_run is defined
|
198
|
+
We should not be using a global variable, and we should make it possible to overide the value from calling methods (as per other options).
|
199
|
+
Also returning result before we attempt a host connection.
|
200
|
+
```
|
201
|
+
* (MAINT) point install link to docs/ (0348b29a)
|
202
|
+
|
203
|
+
### <a name = "2.34.0">2.34.0 - 10 Feb, 2016 (b897a98a)
|
204
|
+
|
205
|
+
* (HISTORY) update beaker history for gem release 2.34.0 (b897a98a)
|
113
206
|
|
114
207
|
* (GEM) update beaker version to 2.34.0 (78b7dd79)
|
115
208
|
|
data/README.md
CHANGED
@@ -1068,13 +1068,7 @@ module Beaker
|
|
1068
1068
|
when /^osx$/
|
1069
1069
|
host.install_package("puppet-agent-#{opts[:puppet_agent_version]}*")
|
1070
1070
|
when /^solaris$/
|
1071
|
-
|
1072
|
-
noask_text = host.noask_file_text
|
1073
|
-
create_remote_file host, File.join(onhost_copy_base, 'noask'), noask_text
|
1074
|
-
on host, "gunzip -c #{release_file} | pkgadd -d /dev/stdin -a noask -n all"
|
1075
|
-
elsif version == '11'
|
1076
|
-
on host, "pkg install -g #{release_file} puppet-agent"
|
1077
|
-
end
|
1071
|
+
host.solaris_install_local_package( release_file, onhost_copy_base )
|
1078
1072
|
end
|
1079
1073
|
configure_type_defaults_on( host )
|
1080
1074
|
end
|
@@ -1110,7 +1104,6 @@ module Beaker
|
|
1110
1104
|
|
1111
1105
|
block_on hosts do |host|
|
1112
1106
|
pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
|
1113
|
-
variant, version, arch, codename = host['platform'].to_array
|
1114
1107
|
opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
|
1115
1108
|
opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos"
|
1116
1109
|
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
|
@@ -1122,70 +1115,30 @@ module Beaker
|
|
1122
1115
|
copy_dir_local = File.join(opts[:copy_base_local], variant)
|
1123
1116
|
onhost_copy_base = opts[:copy_dir_external]
|
1124
1117
|
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
when /^(debian|ubuntu|cumulus)$/
|
1131
|
-
if arch == 'x86_64'
|
1132
|
-
arch = 'amd64'
|
1133
|
-
end
|
1134
|
-
version = version[0,2] + '.' + version[2,2] if (variant =~ /ubuntu/ && !version.include?("."))
|
1135
|
-
release_file = "/repos/apt/#{codename}/pool/#{opts[:puppet_collection]}/p/puppet-agent/puppet-agent*#{arch}.deb"
|
1136
|
-
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
1137
|
-
when /^windows$/
|
1138
|
-
is_config_32 = host['ruby_arch'] == 'x86' || host['install_32'] || opts['install_32']
|
1139
|
-
should_install_64bit = host.is_x86_64? && !is_config_32
|
1140
|
-
# only install 64bit builds if
|
1141
|
-
# - we do not have install_32 set on host
|
1142
|
-
# - we do not have install_32 set globally
|
1143
|
-
arch_suffix = should_install_64bit ? '64' : '86'
|
1144
|
-
release_path += "/windows"
|
1145
|
-
release_file = "/puppet-agent-x#{arch_suffix}.msi"
|
1146
|
-
download_file = "puppet-agent-x#{arch_suffix}.msi"
|
1147
|
-
when /^osx$/
|
1148
|
-
release_file = "/repos/apple/#{opts[:puppet_collection]}/puppet-agent-*"
|
1149
|
-
download_file = "puppet-agent-#{variant}-#{version}.tar.gz"
|
1150
|
-
when /^solaris$/
|
1151
|
-
if arch == 'x86_64'
|
1152
|
-
arch = 'i386'
|
1153
|
-
end
|
1154
|
-
release_file = "/repos/solaris/#{version}/#{opts[:puppet_collection]}/puppet-agent-*#{arch}.pkg.gz"
|
1155
|
-
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
1156
|
-
else
|
1157
|
-
raise "No pe-promoted installation step for #{variant} yet..."
|
1158
|
-
end
|
1118
|
+
release_path_end, release_file, download_file =
|
1119
|
+
host.pe_puppet_agent_promoted_package_info(
|
1120
|
+
opts[:puppet_collection], opts
|
1121
|
+
)
|
1122
|
+
release_path << release_path_end
|
1159
1123
|
|
1160
1124
|
onhost_copied_download = File.join(onhost_copy_base, download_file)
|
1161
1125
|
onhost_copied_file = File.join(onhost_copy_base, release_file)
|
1162
1126
|
fetch_http_file( release_path, download_file, copy_dir_local)
|
1163
1127
|
scp_to host, File.join(copy_dir_local, download_file), onhost_copy_base
|
1164
1128
|
|
1165
|
-
|
1166
|
-
when /^(fedora-22)$/
|
1167
|
-
on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
|
1168
|
-
on host, "dnf --nogpgcheck localinstall -y #{onhost_copied_file}"
|
1169
|
-
when /^(fedora|el|centos)$/
|
1170
|
-
on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
|
1171
|
-
on host, "yum --nogpgcheck localinstall -y #{onhost_copied_file}"
|
1172
|
-
when /^(sles)$/
|
1173
|
-
on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
|
1174
|
-
on host, "rpm -ihv #{onhost_copied_file}"
|
1175
|
-
when /^(debian|ubuntu|cumulus)$/
|
1176
|
-
on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
|
1177
|
-
on host, "dpkg -i --force-all #{onhost_copied_file}"
|
1178
|
-
on host, "apt-get update"
|
1179
|
-
when /^windows$/
|
1129
|
+
if variant == 'windows'
|
1180
1130
|
result = on host, "echo #{onhost_copied_file}"
|
1181
1131
|
onhost_copied_file = result.raw_output.chomp
|
1182
1132
|
opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
|
1133
|
+
# couldn't pull this out, because it's relying on
|
1134
|
+
# {Beaker::DSL::InstallUtils::WindowsUtils} methods,
|
1135
|
+
# which I didn't want to attack right now. TODO
|
1183
1136
|
install_msi_on(host, onhost_copied_file, {}, opts)
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1137
|
+
else
|
1138
|
+
host.pe_puppet_agent_promoted_package_install(
|
1139
|
+
onhost_copy_base, onhost_copied_download,
|
1140
|
+
onhost_copied_file, download_file, opts
|
1141
|
+
)
|
1189
1142
|
end
|
1190
1143
|
configure_type_defaults_on( host )
|
1191
1144
|
end
|
data/lib/beaker/host.rb
CHANGED
@@ -265,9 +265,20 @@ module Beaker
|
|
265
265
|
end
|
266
266
|
|
267
267
|
def exec command, options={}
|
268
|
+
result = nil
|
268
269
|
# I've always found this confusing
|
269
270
|
cmdline = command.cmd_line(self)
|
270
271
|
|
272
|
+
# use the value of :dry_run passed to the method unless
|
273
|
+
# undefined, then use parsed @options hash.
|
274
|
+
options[:dry_run] ||= @options[:dry_run]
|
275
|
+
|
276
|
+
if options[:dry_run]
|
277
|
+
@logger.debug "\n Running in :dry_run mode. Command #{cmdline} not executed."
|
278
|
+
result = Beaker::NullResult.new(self, command)
|
279
|
+
return result
|
280
|
+
end
|
281
|
+
|
271
282
|
if options[:silent]
|
272
283
|
output_callback = nil
|
273
284
|
else
|
@@ -279,11 +290,10 @@ module Beaker
|
|
279
290
|
end
|
280
291
|
end
|
281
292
|
|
282
|
-
unless
|
293
|
+
unless options[:dry_run]
|
283
294
|
# is this returning a result object?
|
284
295
|
# the options should come at the end of the method signature (rubyism)
|
285
296
|
# and they shouldn't be ssh specific
|
286
|
-
result = nil
|
287
297
|
|
288
298
|
@logger.step_in()
|
289
299
|
seconds = Benchmark.realtime {
|
@@ -320,9 +330,8 @@ module Beaker
|
|
320
330
|
raise CommandFailure, "Host '#{self}' exited with #{result.exit_code} running:\n #{cmdline}\nLast #{@options[:trace_limit]} lines of output were:\n#{result.formatted_output(@options[:trace_limit])}"
|
321
331
|
end
|
322
332
|
end
|
323
|
-
# Danger, so we have to return this result?
|
324
|
-
result
|
325
333
|
end
|
334
|
+
result
|
326
335
|
end
|
327
336
|
|
328
337
|
# scp files from the localhost to this test host, if a directory is provided it is recursively copied.
|
@@ -344,6 +353,17 @@ module Beaker
|
|
344
353
|
# -> will result in not files copyed to the host, all are ignored
|
345
354
|
def do_scp_to source, target_path, options
|
346
355
|
target = self.scp_path( target_path )
|
356
|
+
|
357
|
+
# use the value of :dry_run passed to the method unless
|
358
|
+
# undefined, then use parsed @options hash.
|
359
|
+
options[:dry_run] ||= @options[:dry_run]
|
360
|
+
|
361
|
+
if options[:dry_run]
|
362
|
+
scp_cmd = "scp #{source} #{@name}:#{target}"
|
363
|
+
@logger.debug "\n Running in :dry_run mode. localhost $ #{scp_cmd} not executed."
|
364
|
+
return NullResult.new(self, scp_cmd)
|
365
|
+
end
|
366
|
+
|
347
367
|
@logger.notify "localhost $ scp #{source} #{@name}:#{target} {:ignore => #{options[:ignore]}}"
|
348
368
|
|
349
369
|
result = Result.new(@name, [source, target])
|
@@ -371,7 +391,7 @@ module Beaker
|
|
371
391
|
result.exit_code = 1
|
372
392
|
end
|
373
393
|
if source_file
|
374
|
-
result = connection.scp_to(source_file, target, options
|
394
|
+
result = connection.scp_to(source_file, target, options)
|
375
395
|
@logger.trace result.stdout
|
376
396
|
end
|
377
397
|
else # a directory with ignores
|
@@ -406,7 +426,7 @@ module Beaker
|
|
406
426
|
else
|
407
427
|
file_path = File.join(target, File.dirname(s))
|
408
428
|
end
|
409
|
-
result = connection.scp_to(s, file_path, options
|
429
|
+
result = connection.scp_to(s, file_path, options)
|
410
430
|
@logger.trace result.stdout
|
411
431
|
end
|
412
432
|
end
|
@@ -416,9 +436,18 @@ module Beaker
|
|
416
436
|
end
|
417
437
|
|
418
438
|
def do_scp_from source, target, options
|
439
|
+
# use the value of :dry_run passed to the method unless
|
440
|
+
# undefined, then use parsed @options hash.
|
441
|
+
options[:dry_run] ||= @options[:dry_run]
|
442
|
+
|
443
|
+
if options[:dry_run]
|
444
|
+
scp_cmd = "scp #{@name}:#{source} #{target}"
|
445
|
+
@logger.debug "\n Running in :dry_run mode. localhost $ #{scp_cmd} not executed."
|
446
|
+
return NullResult.new(self, scp_cmd)
|
447
|
+
end
|
419
448
|
|
420
449
|
@logger.debug "localhost $ scp #{@name}:#{source} #{target}"
|
421
|
-
result = connection.scp_from(source, target, options
|
450
|
+
result = connection.scp_from(source, target, options)
|
422
451
|
@logger.debug result.stdout
|
423
452
|
return result
|
424
453
|
end
|
data/lib/beaker/host/mac.rb
CHANGED
@@ -23,48 +23,6 @@ module Mac
|
|
23
23
|
})
|
24
24
|
end
|
25
25
|
|
26
|
-
# Gets the path & file name for the puppet agent dev package on OSX
|
27
|
-
#
|
28
|
-
# @param [String] puppet_collection Name of the puppet collection to use
|
29
|
-
# @param [String] puppet_agent_version Version of puppet agent to get
|
30
|
-
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
31
|
-
#
|
32
|
-
# @note OSX doesn't use any additional options at this time, but does require
|
33
|
-
# both puppet_collection & puppet_agent_version, & will fail without them
|
34
|
-
#
|
35
|
-
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
|
36
|
-
# puppet_agent_version) is either not passed or set to nil
|
37
|
-
#
|
38
|
-
# @return [String, String] Path to the directory and filename of the package, respectively
|
39
|
-
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
|
40
|
-
error_message = "Must provide %s argument to get puppet agent dev package information"
|
41
|
-
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
42
|
-
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
43
|
-
|
44
|
-
variant, version, arch, codename = self['platform'].to_array
|
45
|
-
|
46
|
-
mac_pkg_name = "puppet-agent-#{puppet_agent_version}"
|
47
|
-
version = version[0,2] + '.' + version[2,2] unless version.include?(".")
|
48
|
-
# newest hotness
|
49
|
-
path_chunk = "apple/#{version}/#{puppet_collection}/#{arch}"
|
50
|
-
release_path_end = path_chunk
|
51
|
-
# moved to doing this when 'el capitan' came out & the objection was
|
52
|
-
# raised that the code name wasn't a fact, & as such can be hard to script
|
53
|
-
# example: puppet-agent-0.1.0-1.osx10.9.dmg
|
54
|
-
release_file = "#{mac_pkg_name}-1.osx#{version}.dmg"
|
55
|
-
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # new hotness
|
56
|
-
# little older change involved the code name as only difference from above
|
57
|
-
# example: puppet-agent-0.1.0-1.mavericks.dmg
|
58
|
-
release_file = "#{mac_pkg_name}-1.#{codename}.dmg"
|
59
|
-
end
|
60
|
-
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # oops, try the old stuff
|
61
|
-
release_path_end = "apple/#{puppet_collection}"
|
62
|
-
# example: puppet-agent-0.1.0-osx-10.9-x86_64.dmg
|
63
|
-
release_file = "#{mac_pkg_name}-#{variant}-#{version}-x86_64.dmg"
|
64
|
-
end
|
65
|
-
return release_path_end, release_file
|
66
|
-
end
|
67
|
-
|
68
26
|
attr_reader :external_copy_base
|
69
27
|
def initialize name, host_hash, options
|
70
28
|
super
|
data/lib/beaker/host/mac/pkg.rb
CHANGED
@@ -41,4 +41,84 @@ module Mac::Pkg
|
|
41
41
|
result.exit_code == 0
|
42
42
|
end
|
43
43
|
|
44
|
+
# Gets the path & file name for the puppet agent dev package on OSX
|
45
|
+
#
|
46
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
47
|
+
# @param [String] puppet_agent_version Version of puppet agent to get
|
48
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
49
|
+
#
|
50
|
+
# @note OSX doesn't use any additional options at this time, but does require
|
51
|
+
# both puppet_collection & puppet_agent_version, & will fail without them
|
52
|
+
#
|
53
|
+
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
|
54
|
+
# puppet_agent_version) is either not passed or set to nil
|
55
|
+
#
|
56
|
+
# @return [String, String] Path to the directory and filename of the package, respectively
|
57
|
+
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
|
58
|
+
error_message = "Must provide %s argument to get puppet agent dev package information"
|
59
|
+
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
60
|
+
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
61
|
+
|
62
|
+
variant, version, arch, codename = self['platform'].to_array
|
63
|
+
|
64
|
+
mac_pkg_name = "puppet-agent-#{puppet_agent_version}"
|
65
|
+
version = version[0,2] + '.' + version[2,2] unless version.include?(".")
|
66
|
+
# newest hotness
|
67
|
+
path_chunk = "apple/#{version}/#{puppet_collection}/#{arch}"
|
68
|
+
release_path_end = path_chunk
|
69
|
+
# moved to doing this when 'el capitan' came out & the objection was
|
70
|
+
# raised that the code name wasn't a fact, & as such can be hard to script
|
71
|
+
# example: puppet-agent-0.1.0-1.osx10.9.dmg
|
72
|
+
release_file = "#{mac_pkg_name}-1.osx#{version}.dmg"
|
73
|
+
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # new hotness
|
74
|
+
# little older change involved the code name as only difference from above
|
75
|
+
# example: puppet-agent-0.1.0-1.mavericks.dmg
|
76
|
+
release_file = "#{mac_pkg_name}-1.#{codename}.dmg"
|
77
|
+
end
|
78
|
+
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # oops, try the old stuff
|
79
|
+
release_path_end = "apple/#{puppet_collection}"
|
80
|
+
# example: puppet-agent-0.1.0-osx-10.9-x86_64.dmg
|
81
|
+
release_file = "#{mac_pkg_name}-#{variant}-#{version}-x86_64.dmg"
|
82
|
+
end
|
83
|
+
return release_path_end, release_file
|
84
|
+
end
|
85
|
+
|
86
|
+
# Gets host-specific information for PE promoted puppet-agent packages
|
87
|
+
#
|
88
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
89
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
90
|
+
#
|
91
|
+
# @return [String, String, String] Host-specific information for packages
|
92
|
+
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
|
93
|
+
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
|
94
|
+
# 2. release_file Path to the file on release build servers
|
95
|
+
# 3. download_file Filename for the package itself
|
96
|
+
def pe_puppet_agent_promoted_package_info( puppet_collection = nil, opts = {} )
|
97
|
+
error_message = "Must provide %s argument to get puppet agent dev package information"
|
98
|
+
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
99
|
+
|
100
|
+
variant, version, arch, codename = self['platform'].to_array
|
101
|
+
release_file = "/repos/apple/#{puppet_collection}/puppet-agent-*"
|
102
|
+
download_file = "puppet-agent-#{variant}-#{version}.tar.gz"
|
103
|
+
return '', release_file, download_file
|
104
|
+
end
|
105
|
+
|
106
|
+
# Installs a given PE promoted package on a host
|
107
|
+
#
|
108
|
+
# @param [String] onhost_copy_base Base copy directory on the host
|
109
|
+
# @param [String] onhost_copied_download Downloaded file path on the host
|
110
|
+
# @param [String] onhost_copied_file Copied file path once un-compressed
|
111
|
+
# @param [String] download_file File name of the downloaded file
|
112
|
+
# @param [Hash{Symbol=>String}] opts additional options
|
113
|
+
#
|
114
|
+
# @return nil
|
115
|
+
def pe_puppet_agent_promoted_package_install(
|
116
|
+
onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, opts
|
117
|
+
)
|
118
|
+
execute("tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}")
|
119
|
+
# move to better location
|
120
|
+
execute("mv #{onhost_copied_file}.dmg .")
|
121
|
+
self.install_package("puppet-agent-*")
|
122
|
+
end
|
123
|
+
|
44
124
|
end
|