Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,27 @@ class { 'zend_common::license':
subscribe => Class['zendhq::package'],
}
```
```puppet
$license = Deferred('vault_lookup::lookup',["licenses/zendhq"], 'https://vault.server.lcl:8200',)
class { 'zend_common::license':
content => $license,
}
```

#### Parameters

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

* [`source`](#-zend_common--license--source)

* Optional [`content`](#-zend_common--license--content)

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

Data type: `String[10]`

The contents (text) of the license file. If this parameter is specified, the parameter `source` will be ignored.

* Optional [`source`](#-zend_common--license--source)

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

Expand Down
29 changes: 25 additions & 4 deletions manifests/license.pp
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
# @summary Upload a Zend product license to the proper directory
#
# @example
# @example With license URL
# class { 'zend_common::license':
# source => 'puppet:///modules/<MODULE_NAME>/zend/license',
# notify => Class['zendhq::service'],
# subscribe => Class['zendhq::package'],
# }
#
# @example With license text
# $license = Deferred('vault_lookup::lookup',["licenses/zendhq"], 'https://vault.server.lcl:8200',)
# class { 'zend_common::license':
# content => $license,
# }
#
# @param source
# Source path or puppet URL to license file
#
# @param content
# Contents of the license file
#
class zend_common::license (
String[1] $source,
Optional[String[10]] $content = undef,
Optional[String[1]] $source = undef,
) {
file { '/opt/zend/zendphp/etc/license':
source => $source,
if $content {
file { '/opt/zend/zendphp/etc/license':
content => $content,
}
} elsif $source {
file { '/opt/zend/zendphp/etc/license':
source => $source,
}
} else {
notify { 'no license':
message => 'Neither "content", nor "source" of the license file have been specified. License file has not been updated.',
loglevel => 'warning',
}
}
}