6
7
8
9
10
11
12
13
14
15
16
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
|
# File 'manifests/microfocus/update.pp', line 6
class pscobol::microfocus::update (
$ensure = undef,
$installdir = undef,
$patches = undef,
) {
debug ("Ensure 'pscobol::microfocus::update' to be '${ensure}' using '${patches}' on '${installdir}'")
if ($facts['operatingsystem'] == 'windows') {
if (!empty($patches) and ($ensure == 'present')) {
$patches.each | String $patch | {
exec { "Verify ${patch}" :
command => Sensitive(@("EOT")),
Try {
If (Test-Path -Path ${regsubst("\'${patch}\'", '(/|\\\\)', '\\', 'G')}) {
Exit 0
}
Exit 1
} Catch {
Exit 1
}
|-EOT
provider => powershell,
logoutput => true,
onlyif => "If ('${patch}' -ne '') { Exit 0 } Else { Exit 1 }"
}
debug ("Updating 'Microfocus Micro Focus Visual COBOL' using '${patch}''")
exec { "Install patch ${patch}" :
command => Sensitive("
${file('pscobol/pscobol.psm1')}
Install-MicroFocusVisualCobol `
-Source ${regsubst("\'${patch}\'", '(/|\\\\)', '\\', 'G')} `
-InstallDir ${regsubst("\'${installdir}\'", '(/|\\\\)', '\\', 'G')}
"),
provider => powershell,
logoutput => true,
require => Exec["Verify ${patch}"],
onlyif => Sensitive(@("EOT")),
Try {
If ('${patch}' -ne '') {
If (Test-Path -Path ${regsubst("\'${installdir}/bin/cobol.exe\'", '(/|\\\\)', '\\', 'G')}) {
Exit 0
}
}
Exit 1
} Catch {
Exit 1
}
|-EOT
}
}
} else {
debug ("No-Op 'Microfocus Micro Focus Visual COBOL' using '${patches}'")
}
} else {
fail("Unsupported Platform - ${$facts['operatingsystem']}")
}
}
|