This pull request will prepare the module for data-in-modules and provide a REFERENCE.md. Unfortunately this module uses a lot of classes and I need to figure out which one are private. Because some variables are named or used badly, this change will be backwards incompatible and end up in a major release.
TL;DR
This PR fixes the defaults in params.pp for the webhook, adds a dependency to fix a first-run failure, adds a spec test for the defaults and an acceptance test.
Details:
When in a manifest classes are declared like this:
puppet
class { 'r10k': }
-> class { 'r10k::webhook': }
a simple test with it { is_expected.to compile.with_all_deps }
fails with:
```
1) template on debian-10-x8664 is expected to compile into a catalogue without dependency cycles
Failure/Error: it { isexpected.to compile.withalldeps }
error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Class[R10k::Webhook]:
parameter 'chatops' entry 'service' expects an undef value or a match for Enum['rocketchat', 'slack'], got ''
parameter 'chatops' entry 'channel' expects a value of type Undef or String[1], got String
parameter 'chatops' entry 'user' expects a value of type Undef or String[1], got String
parameter 'chatops' entry 'authtoken' expects a value of type Undef or String[1], got String
parameter 'chatops' entry 'serveruri' expects a value of type Undef or String[1], got String
parameter 'r10k' entry 'prefix' expects a value of type Undef or String[1], got String
parameter 'config' entry 'chatops' entry 'service' expects an undef value or a match for Enum['rocketchat', 'slack'], got ''
parameter 'config' entry 'chatops' entry 'channel' expects a value of type Undef or String[1], got String
parameter 'config' entry 'chatops' entry 'user' expects a value of type Undef or String[1], got String
parameter 'config' entry 'chatops' entry 'authtoken' expects a value of type Undef or String[1], got String
parameter 'config' entry 'chatops' entry 'serveruri' expects a value of type Undef or String[1], got String
parameter 'config' entry 'r10k' entry 'prefix' expects a value of type Undef or String[1], got String (file: /home/tmu/git/template/spec/fixtures/modules/template/manifests/init.pp, line: 6, column: 6) on node computer.example.com
# ./spec/classes/init_spec.rb:21:in block (4 levels) in <top (required)>'
`
Optional[Enum]
Cause: The type isor
Optional[String[1]], but in params.pp the defaults for above values are empty strings
''`.
This PR changes those defaults to undef
, which fixes this.
Additionally at the first Puppet run, Puppet fails with an error, because it tries to manages the file /etc/voxpupuli/webhook.yml
, before the package webhook-go
is being installed, which creates the directory /etc/voxpupuli/
.
This PR adds the requirement to install the package to create the directory first before the file is being managed.
The unit test for the webhook is being changed to test, if the defaults do not fail.
An acceptance test is added to check, if the service is running with defaults.
<!--
Thank you for contributing to this project!
-->
<!--
Add support for logging parameters in r10k.yml.
-->
<!--
n/a
-->
modulesync 5.4.0
<!--
Thank you for contributing to this project!
-->
<!--
Replace this comment with a description of your pull request.
-->
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->