Skip to content

Commit a02ee79

Browse files
committed
Add cleanup and fix deps
1 parent c77f748 commit a02ee79

13 files changed

+272
-11
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2014-10-29 Release 0.2.0
2+
- Add support for bundle patch
13
2014-10-23 Release 0.1.3
24
- Doc improvements and metadata added
35
2014-10-23 Release 0.1.2

Modulefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name 'elibus-oracle_webgate'
2-
version '0.1.3'
2+
version '0.2.0'
33
source 'https://github.com/elibus/puppet-oracle_webgate'
44
author 'Marco Tizzoni'
55
license 'Apache 2.0'

README.markdown

+19
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ The very basic steps needed for a user to get the module up and running.
5959
installPackage => 'Oracle_Access_Manager10_1_4_3_0_linux64_APACHE24_WebGate.zip',
6060
}
6161

62+
This is a full example with bundle patch for Apache 2.2.
63+
64+
class { 'oracle_webgate':
65+
serverId => 'oamServerId',
66+
hostname => 'oam.example.com',
67+
webgateId => 'thisServer',
68+
port => '5575',
69+
password => 'password',
70+
passphrase => 'passphrase',
71+
remoteRepo => 'https://www.example.com/repo/oracle',
72+
installPackage => 'Oracle_Access_Manager10_1_4_3_0_linux64_APACHE22_WebGate.zip',
73+
patchPackage => 'Oracle_Access_Manager10_1_4_3_0_BP13_Patch_linux64_APACHE22_WebGate.zip',
74+
patchVersion => '13',
75+
}
6276

6377
Defaults:
6478

@@ -71,6 +85,11 @@ Defaults:
7185
|defaultLang | en-us | |
7286
|installLang | en-us | |
7387
|securityMode | cert | See Oracle docs |
88+
|patchVersion | 0 | Version of the bundle patch |
89+
90+
###Removing oracle_webgate
91+
92+
To fully remove the Oracle Webgate just include the class `oracle_webgate:uninstall`.
7493

7594

7695
##Usage

files/webgate_patch.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -e
3+
4+
INSTALL_LOCATION="$1"
5+
BASEDIR="$(dirname $0)"
6+
7+
removeBackupDirs() {
8+
[ ! x"" = "$INSTALL_LOCATION/backup-Oracle*" ] && rm -fr "$INSTALL_LOCATION"/backup-Oracle*
9+
}
10+
11+
removeBackupDirs
12+
# Install binary first
13+
PATCHINST=$(find "$BASEDIR" -type f -wholename "*binary*/patchinst")
14+
for p in $PATCHINST; do
15+
cd "$(dirname $p)"
16+
"$p" -i -d "$INSTALL_LOCATION"
17+
done
18+
19+
removeBackupDirs
20+
# Install messages
21+
PATCHINST=$(find "$BASEDIR" -type f -wholename "*message*/patchinst")
22+
for p in $PATCHINST; do
23+
cd "$(dirname $p)"
24+
"$p" -i -d "$INSTALL_LOCATION"
25+
done
26+

lib/facter/oracle_webgate_exists.rb

+14
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@
77
end
88
end
99
end
10+
11+
Facter.add("oracle_webgate_patch") do
12+
setcode do
13+
if !Dir.glob('/opt/netpoint/webgate/access/oblix/config/np*.txt').empty?
14+
np = Dir['/opt/netpoint/webgate/access/oblix/config/np*.txt'][0]
15+
str = IO.read(np)
16+
match = str.match(/^Release: .* BP(\d+)$/)
17+
match[1].to_i
18+
else
19+
'0'.to_i
20+
end
21+
end
22+
end
23+

manifests/cleanup.pp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# == Class oracle_webgate::cleanup
2+
#
3+
class oracle_webgate::cleanup {
4+
$execPath = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:'
5+
6+
exec { "removing temp files: ${oracle_webgate::downloadDir}/":
7+
command => "rm -fr ${oracle_webgate::downloadDir}",
8+
path => $execPath,
9+
unless => "! test -d ${oracle_webgate::downloadDir}"
10+
}
11+
12+
}

manifests/dependencies.pp

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
#
55
class oracle_webgate::dependencies {
66
notify { 'oracle_webgate not found!': }
7-
ensure_packages($oracle_webgate::params::deps, {
8-
ensure => 'installed'
9-
}
10-
)
7+
ensure_packages($oracle_webgate::params::deps)
118
}

manifests/init.pp

+16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
$keyFile = $oracle_webgate::params::keyFile,
4545
$chainFile = $oracle_webgate::params::chainFile,
4646
$installPackage = $oracle_webgate::params::installPackage,
47+
$patchPackage = $oracle_webgate::params::patchPackage,
48+
$patchVersion = $oracle_webgate::params::patchVersion,
4749
$remoteRepo = $oracle_webgate::params::remoteRepo,
4850
$downloadDir = $oracle_webgate::params::downloadDir,
4951
$user = $oracle_webgate::params::user,
@@ -65,6 +67,7 @@
6567
validate_string($oracle_webgate::keyFile)
6668
validate_string($oracle_webgate::chainFile)
6769
validate_string($oracle_webgate::installPackage)
70+
validate_re($oracle_webgate::patchVersion, '\d+')
6871
validate_string($oracle_webgate::remoteRepo)
6972
validate_absolute_path($oracle_webgate::downloadDir)
7073
validate_string($oracle_webgate::user)
@@ -76,6 +79,19 @@
7679
class { 'oracle_webgate::dependencies': } ->
7780
class { 'oracle_webgate::install': } ->
7881
class { 'oracle_webgate::config': } ->
82+
class { 'oracle_webgate::cleanup': } ->
7983
Class['oracle_webgate']
84+
85+
if ( $patchVersion > 0 ) {
86+
validate_string($oracle_webgate::patchPackage)
87+
validate_re($oracle_webgate::patchPackage, '.+')
88+
$actualPatchVersion = ($::oracle_webgate_patch)
89+
if ( $patchVersion > $actualPatchVersion ) {
90+
notify { "Found patch version: ${actualPatchVersion}, required is ${patchVersion}. Installing... ": }
91+
92+
Class['oracle_webgate::config'] ->
93+
class { 'oracle_webgate::patch': }
94+
}
95+
}
8096
}
8197
}

manifests/params.pp

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
$passphrase = undef,
1313
$remoteRepo = undef,
1414
$installPackage = undef,
15+
$patchPackage = undef,
16+
$patchVersion = '0',
1517
$certFile = 'puppet:///modules/oracle_webgate/certFile.pem',
1618
$keyFile = 'puppet:///modules/oracle_webgate/keyFile.pem',
1719
$chainFile = 'puppet:///modules/oracle_webgate/chainFile.pem',
@@ -42,11 +44,11 @@
4244
case $::architecture {
4345
'x86_64': {
4446
$libdir = 'lib64'
45-
$deps = [ 'libstdc++.x86_64', 'libstdc++.i686' ]
47+
$deps = [ 'libstdc++.x86_64', 'libstdc++.i686', 'tcsh' ]
4648
}
4749
'i686': {
4850
$libdir = 'lib'
49-
$deps = 'libstdc++.i686'
51+
$deps = [ 'libstdc++.i686', 'tcsh']
5052
}
5153
default: {
5254
fail("${::architecture} architecture not supported")

manifests/patch.pp

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# == Class oracle_webgate::patch
2+
#
3+
class oracle_webgate::patch {
4+
$execPath = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:'
5+
$patchDownloadDir = "${oracle_webgate::downloadDir}/patch"
6+
7+
# Retrieve installation package
8+
exec { "retrieve ${oracle_webgate::remoteRepo}/${oracle_webgate::patchPackage}":
9+
command => "wget \
10+
-q ${oracle_webgate::remoteRepo}/${oracle_webgate::patchPackage} \
11+
-O ${oracle_webgate::downloadDir}/${oracle_webgate::patchPackage}",
12+
creates => "${oracle_webgate::downloadDir}/${oracle_webgate::patchPackage}",
13+
path => $execPath
14+
}
15+
16+
exec { "extract ${oracle_webgate::downloadDir}/${oracle_webgate::patchPackage}":
17+
command => "unzip \
18+
-o ${oracle_webgate::downloadDir}/${oracle_webgate::patchPackage} \
19+
-d ${patchDownloadDir}",
20+
timeout => 0,
21+
path => $execPath,
22+
logoutput => false,
23+
}
24+
25+
file { "${patchDownloadDir}/webgate_patch.sh":
26+
ensure => file,
27+
source => 'puppet:///modules/oracle_webgate/webgate_patch.sh',
28+
mode => '0750',
29+
owner => 'root',
30+
group => 'root',
31+
}
32+
33+
exec { "patch webgate: ${patchDownloadDir}/webgate_patch.sh":
34+
command => "${patchDownloadDir}/webgate_patch.sh ${oracle_webgate::installLocation}",
35+
path => $execPath,
36+
logoutput => true
37+
}
38+
39+
# Dependencies
40+
Exec["retrieve ${oracle_webgate::remoteRepo}/${oracle_webgate::patchPackage}"] ->
41+
Exec["extract ${oracle_webgate::downloadDir}/${oracle_webgate::patchPackage}"] ->
42+
File["${patchDownloadDir}/webgate_patch.sh"] ->
43+
Exec["patch webgate: ${patchDownloadDir}/webgate_patch.sh"]
44+
}

manifests/uninstall.pp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# == Class oracle_webgate::uninstall
2+
#
3+
class oracle_webgate::uninstall {
4+
$execPath = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:'
5+
6+
exec { 'remove directory /opt/netpoint':
7+
command => 'rm -fr /opt/netpoint',
8+
path => $execPath,
9+
unless => '! test -d /opt/netpoint'
10+
}
11+
12+
}

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "marco-oracle_webgate",
3-
"version": "0.1.4",
3+
"version": "0.2.0",
44
"author": "Marco Tizzoni",
55
"summary": "Install and configure Oracle Webgate",
66
"license": "Apache 2.0",

0 commit comments

Comments
 (0)