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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'manifests/war.pp', line 24
define tomcat::war (
Optional[Stdlib::Absolutepath] $catalina_base = undef,
Optional[String[1]] $app_base = undef,
Optional[String[1]] $deployment_path = undef,
Enum['present','absent'] $war_ensure = 'present',
Optional[String[1]] $war_name = undef,
Boolean $war_purge = true,
Optional[String[1]] $war_source = undef,
Boolean $allow_insecure = false,
String[1] $user = 'tomcat',
String[1] $group = 'tomcat',
) {
include tomcat
$_catalina_base = pick($catalina_base, $tomcat::catalina_home)
tag(sha1($_catalina_base))
if $app_base and $deployment_path {
fail('Only one of $app_base and $deployment_path can be specified.')
}
if $war_name {
$_war_name = $war_name
} else {
$_war_name = $name
}
if $_war_name !~ /\.war$/ {
fail('war_name must end with .war')
}
if $deployment_path {
$_deployment_path = $deployment_path
} else {
if $app_base {
$_app_base = $app_base
} else {
$_app_base = 'webapps'
}
$_deployment_path = "${_catalina_base}/${_app_base}"
}
if $war_ensure == 'absent' {
file { "${_deployment_path}/${_war_name}":
ensure => absent,
force => false,
}
if $war_purge {
$war_dir_name = regsubst($_war_name, '\.war$', '')
if $war_dir_name != '' {
file { "${_deployment_path}/${war_dir_name}":
ensure => absent,
force => true,
}
}
}
} else {
if ! $war_source {
fail('$war_source must be specified if you aren\'t removing the WAR')
}
archive { "tomcat::war ${name}":
extract => false,
source => $war_source,
path => "${_deployment_path}/${_war_name}",
allow_insecure => $allow_insecure,
}
file { "tomcat::war ${name}":
ensure => file,
path => "${_deployment_path}/${_war_name}",
owner => $user,
group => $group,
mode => '0640',
subscribe => Archive["tomcat::war ${name}"],
}
}
}
|