17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'manifests/tungsten/replicator.pp', line 17
class tungsten::tungsten::replicator (
$location = true,
) inherits tungsten::params {
include tungsten::prereq
if $location == true {
# Install the tungsten-replicator package using configured repositories
Class["tungsten::prereq"] ->
package { 'tungsten-replicator':
ensure => present,
}
} elsif $location != false {
case fileextension($location) {
".rpm": {
# Install the tungsten-replicator package from the provided location
Class["tungsten::prereq"] ->
package { "tungsten-replicator":
ensure => present,
provider => rpm,
source => $location,
}
}
".gz": {
# Get the true basename of the file in case it is a .tar.gz file
if fileextension(filebasename($location)) == ".tar" {
$basename = filebasename(filebasename($location))
$arguments = "zxf"
} else {
$basename = filebasename($location)
$arguments = "xf"
}
# Unpack the tungsten-replicator package from the provided location
Class["tungsten::prereq"] ->
exec { "unpack-tungsten-replicator":
path => ["/bin", "/usr/bin"],
cwd => "/opt/continuent/software",
command => "tar $arguments $location",
user => $tungsten::prereq::systemUserName,
creates => "/opt/continuent/software/$basename",
} ~>
exec { "install-tungsten-replicator":
path => ["/bin", "/usr/bin"],
command => "sudo -i -u $tungsten::prereq::systemUserName /opt/continuent/software/$basename/tools/tpm update --tty --log=/opt/replicator/service_logs/tungsten-configure.log > /opt/replicator/service_logs/rpm.output 2>&1",
onlyif => "test -f /etc/tungsten/tungsten.ini",
refreshonly => true,
returns => [0, 1],
}
}
default: {
fail("Unable to install the Tungsten Replicator from $location because the file type is not recognized.")
}
}
}
}
|