Skip to content

Commit f459b08

Browse files
committed
add 'content' parameter to zend_common::license
1 parent b716238 commit f459b08

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

REFERENCE.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,27 @@ class { 'zend_common::license':
2626
subscribe => Class['zendhq::package'],
2727
}
2828
```
29+
```puppet
30+
$license = Deferred('vault_lookup::lookup',["licenses/zendhq"], 'https://vault.server.lcl:8200',)
31+
class { 'zend_common::license':
32+
content => $license,
33+
}
34+
```
2935

3036
#### Parameters
3137

3238
The following parameters are available in the `zend_common::license` class:
3339

34-
* [`source`](#-zend_common--license--source)
40+
41+
* Optional [`content`](#-zend_common--license--content)
42+
43+
##### <a name="-zend_common--license--content"></a>`source`
44+
45+
Data type: `String[10]`
46+
47+
The contents (text) of the license file. If this parameter is specified, the parameter `source` will be ignored.
48+
49+
* Optional [`source`](#-zend_common--license--source)
3550

3651
##### <a name="-zend_common--license--source"></a>`source`
3752

manifests/license.pp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
11
# @summary Upload a Zend product license to the proper directory
22
#
3-
# @example
3+
# @example With license URL
44
# class { 'zend_common::license':
55
# source => 'puppet:///modules/<MODULE_NAME>/zend/license',
66
# notify => Class['zendhq::service'],
77
# subscribe => Class['zendhq::package'],
88
# }
99
#
10+
# @example With license text
11+
# $license = Deferred('vault_lookup::lookup',["licenses/zendhq"], 'https://vault.server.lcl:8200',)
12+
# class { 'zend_common::license':
13+
# content => $license,
14+
# }
15+
#
1016
# @param source
1117
# Source path or puppet URL to license file
1218
#
19+
# @param content
20+
# Contents of the license file
21+
#
1322
class zend_common::license (
14-
String[1] $source,
23+
Optional[String[10]] $content = undef,
24+
Optional[String[1]] $source = undef,
1525
) {
16-
file { '/opt/zend/zendphp/etc/license':
17-
source => $source,
26+
if $content {
27+
file { '/opt/zend/zendphp/etc/license':
28+
content => $content,
29+
}
30+
} elsif $source {
31+
file { '/opt/zend/zendphp/etc/license':
32+
source => $source,
33+
}
34+
} else {
35+
notify { 'no license':
36+
message => 'Neither "content", nor "source" of the license file have been specified. License file has not been updated.',
37+
loglevel => 'warning',
38+
}
1839
}
1940
}

0 commit comments

Comments
 (0)