Puppet Class: pscobol::microfocus::license

Defined in:
manifests/microfocus/license.pp

Summary

Private class to register the Micro Focus Visual Cobol license

Overview

Examples:

include pscobol::microfocus::license

Parameters:

  • ensure (Any) (defaults to: undef)
  • license (Any) (defaults to: undef)
  • lmpath (Any) (defaults to: undef)


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
70
71
72
73
74
75
76
77
78
79
# File 'manifests/microfocus/license.pp', line 6

class pscobol::microfocus::license (
  $ensure    = undef,
  $license   = undef,
  $lmpath    = undef,
) {

  debug ("Ensure 'pscobol::microfocus::license' to be '${ensure}' using '${license}'")

  if ($facts['operatingsystem'] == 'windows') {

    exec { 'Verify License source' :
      command   => Sensitive(@("EOT")),
          Try {
            If ( Test-Path -Path ${regsubst("\'${license}\'", '(/|\\\\)', '\\', 'G')} ) {
              Exit 0
            }
            Exit 1
          } Catch {
            Exit 1
          }
          |-EOT
      provider  => powershell,
      logoutput => true,
      onlyif    => "If ('${license}' -ne '') { Exit 0 } Else { Exit 1 }"
    }

    if ($ensure == 'present') {

      exec { 'License Micro Focus Visual COBOL' :
        command   => Sensitive("
          ${file('pscobol/pscobol.psm1')}
          Set-MicroFocusVisualCobolLicense `
            -Source ${regsubst("\'${license}\'", '(/|\\\\)', '\\', 'G')} `
            -CesAdminToolPath ${regsubst("\'${lmpath}\'", '(/|\\\\)', '\\', 'G')}
        "),
        provider  => powershell,
        logoutput => true,
        require   => Exec['Verify License source'],
        onlyif    => Sensitive(@("EOT")),
          Try {
            If ('${license}' -ne '') {
              If ( Test-Path -Path ${regsubst("\'${lmpath}\'", '(/|\\\\)', '\\', 'G')} ) {
                Exit 0
              } 
            }
            Exit 1
          } Catch {
            Exit 1
          }
          |-EOT
      }

    } else {
      exec { 'Remove Sentinel RMS License Manager' :
        command   => Sensitive('cmd /c "MsiExec.exe/X{A6C99F57-4EAE-4A25-898D-EFD9AF3DA23D} /quiet"'),
        provider  => powershell,
        logoutput => true,
        onlyif    => Sensitive(@("EOT")),
          Try {
            If ( Test-Path -Path ${regsubst("\'${lmpath}\'", '(/|\\\\)', '\\', 'G')} ) {
              Exit 0
            }
            Exit 1
          } Catch {
            Exit 1
          }
          |-EOT
      }
    }

  } else {
    fail("Unsupported Platform - ${$facts['operatingsystem']}")
  }
}