Skip to content

Commit

Permalink
webhook-go: Move static data from params to webhook class
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Aug 29, 2023
1 parent 4eb3ca6 commit 4c57cf9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 227 deletions.
175 changes: 0 additions & 175 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* [`r10k::params`](#r10k--params): Reasonable defaults for all classes
* [`r10k::postrun_command`](#r10k--postrun_command): This class will configure r10k to run as part of the masters agent run
* [`r10k::prerun_command`](#r10k--prerun_command): This class will configure r10k to run as part of the masters agent run
* [`r10k::webhook`](#r10k--webhook): install and configure the webhook-go package as local webhook receiver to trigger r10k runs
* [`r10k::webhook::config`](#r10k--webhook--config): Class: r10k::webhook::config
* [`r10k::webhook::package`](#r10k--webhook--package): Class: r10k::webhook::package
* [`r10k::webhook::service`](#r10k--webhook--service): Class: r10k::webhook::service
Expand Down Expand Up @@ -549,180 +548,6 @@ Data type: `Enum['present', 'absent']`

Default value: `'present'`

### <a name="r10k--webhook"></a>`r10k::webhook`

install and configure the webhook-go package as local webhook receiver to trigger r10k runs

#### Parameters

The following parameters are available in the `r10k::webhook` class:

* [`install_method`](#-r10k--webhook--install_method)
* [`ensure`](#-r10k--webhook--ensure)
* [`version`](#-r10k--webhook--version)
* [`service_ensure`](#-r10k--webhook--service_ensure)
* [`service_enabled`](#-r10k--webhook--service_enabled)
* [`config_ensure`](#-r10k--webhook--config_ensure)
* [`config_path`](#-r10k--webhook--config_path)
* [`chatops`](#-r10k--webhook--chatops)
* [`tls`](#-r10k--webhook--tls)
* [`server`](#-r10k--webhook--server)
* [`r10k`](#-r10k--webhook--r10k)
* [`config`](#-r10k--webhook--config)

##### <a name="-r10k--webhook--install_method"></a>`install_method`

Data type: `Enum['package', 'repo', 'none']`

how the package should be installed

Default value: `'package'`

##### <a name="-r10k--webhook--ensure"></a>`ensure`

Data type: `Boolean`



Default value: `$r10k::params::webhook_ensure`

##### <a name="-r10k--webhook--version"></a>`version`

Data type: `String`



Default value: `$r10k::params::webhook_version`

##### <a name="-r10k--webhook--service_ensure"></a>`service_ensure`

Data type:

```puppet
Variant[
Enum['running', 'stopped'],
Boolean
]
```



Default value: `$r10k::params::webhook_service_ensure`

##### <a name="-r10k--webhook--service_enabled"></a>`service_enabled`

Data type: `Boolean`



Default value: `$r10k::params::webhook_service_enabled`

##### <a name="-r10k--webhook--config_ensure"></a>`config_ensure`

Data type: `String`



Default value: `'file'`

##### <a name="-r10k--webhook--config_path"></a>`config_path`

Data type: `String`



Default value: `'/etc/voxpupuli/webhook.yml'`

##### <a name="-r10k--webhook--chatops"></a>`chatops`

Data type: `R10k::Webhook::Config::ChatOps`



Default value:

```puppet
{
enabled => $r10k::params::webhook_chatops_enabled,
service => $r10k::params::webhook_chatops_service,
channel => $r10k::params::webhook_chatops_channel,
user => $r10k::params::webhook_chatops_user,
auth_token => $r10k::params::webhook_chatops_token,
server_uri => $r10k::params::webhook_chatops_uri,
}
```

##### <a name="-r10k--webhook--tls"></a>`tls`

Data type: `R10k::Webhook::Config::Server::Tls`



Default value:

```puppet
{
enabled => $r10k::params::webhook_tls_enabled,
certificate => $r10k::params::webhook_tls_cert_path,
key => $r10k::params::webhook_tls_key_path,
}
```

##### <a name="-r10k--webhook--server"></a>`server`

Data type: `R10k::Webhook::Config::Server`



Default value:

```puppet
{
protected => $r10k::params::webhook_protected,
user => $r10k::params::webhook_user,
password => $r10k::params::webhook_password,
port => $r10k::params::webhook_port,
tls => $tls,
}
```

##### <a name="-r10k--webhook--r10k"></a>`r10k`

Data type: `R10k::Webhook::Config::R10k`



Default value:

```puppet
{
command_path => $r10k::params::webhook_r10k_command_path,
config_path => $r10k::params::webhook_r10k_config_path,
default_branch => $r10k::params::webhook_r10k_default_branch,
prefix => $r10k::params::webhook_r10k_branch_prefix,
allow_uppercase => $r10k::params::webhook_r10k_allow_uppercase,
verbose => $r10k::params::webhook_r10k_verbose,
deploy_modules => $r10k::params::webhook_r10k_deploy_modules,
generate_types => $r10k::params::webhook_r10k_generate_types,
}
```

##### <a name="-r10k--webhook--config"></a>`config`

Data type: `R10k::Webhook::Config`



Default value:

```puppet
{
server => $server,
chatops => $chatops,
r10k => $r10k,
}
```

### <a name="r10k--webhook--config"></a>`r10k::webhook::config`

Class: r10k::webhook::config
Expand Down
27 changes: 0 additions & 27 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,4 @@
$is_pe_server = false
$modulepath = "${r10k_basedir}/\$environment/modules"
}

# Webhook Go parameters
$webhook_ensure = false
$webhook_protected = true
$webhook_version = '2.1.0'
$webhook_user = 'puppet'
$webhook_password = 'puppet'
$webhook_port = 4000
$webhook_tls_enabled = false
$webhook_tls_cert_path = undef
$webhook_tls_key_path = undef
$webhook_chatops_enabled = false
$webhook_chatops_service = ''
$webhook_chatops_channel = ''
$webhook_chatops_user = ''
$webhook_chatops_token = ''
$webhook_chatops_uri = ''
$webhook_r10k_command_path = "/opt/puppetlabs/puppet/bin/${r10k_binary}"
$webhook_r10k_config_path = '/etc/puppetlabs/r10k/r10k.yaml'
$webhook_r10k_default_branch = 'production'
$webhook_r10k_branch_prefix = ''
$webhook_r10k_allow_uppercase = false
$webhook_r10k_verbose = true
$webhook_r10k_deploy_modules = true
$webhook_r10k_generate_types = true
$webhook_service_ensure = 'running'
$webhook_service_enabled = true
}
50 changes: 25 additions & 25 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
#
class r10k::webhook (
Enum['package', 'repo', 'none'] $install_method = 'package',
Boolean $ensure = $r10k::params::webhook_ensure,
String $version = $r10k::params::webhook_version,
Boolean $ensure = $r10k::params::webhook_ensure = false,
String $version = $r10k::params::webhook_version = '2.1.0',
Variant[
Enum['running', 'stopped'],
Boolean
] $service_ensure = $r10k::params::webhook_service_ensure,
Boolean $service_enabled = $r10k::params::webhook_service_enabled,
] $service_ensure = $r10k::params::webhook_service_ensure = 'running',
Boolean $service_enabled = $r10k::params::webhook_service_enabled = true,
String $config_ensure = 'file',
String $config_path = '/etc/voxpupuli/webhook.yml',
R10k::Webhook::Config::ChatOps $chatops = {
enabled => $r10k::params::webhook_chatops_enabled,
service => $r10k::params::webhook_chatops_service,
channel => $r10k::params::webhook_chatops_channel,
user => $r10k::params::webhook_chatops_user,
auth_token => $r10k::params::webhook_chatops_token,
server_uri => $r10k::params::webhook_chatops_uri,
enabled => false
service => '',
channel => '',
user => '',
auth_token => '',
server_uri => '',
},
R10k::Webhook::Config::Server::Tls $tls = {
enabled => $r10k::params::webhook_tls_enabled,
certificate => $r10k::params::webhook_tls_cert_path,
key => $r10k::params::webhook_tls_key_path,
enabled => false,
certificate => undef,
key => undef,
},
R10k::Webhook::Config::Server $server = {
protected => $r10k::params::webhook_protected,
user => $r10k::params::webhook_user,
password => $r10k::params::webhook_password,
port => $r10k::params::webhook_port,
protected => true,
user => 'puppet',
password => 'puppet',
port => 4000,
tls => $tls,
},
R10k::Webhook::Config::R10k $r10k = {
command_path => $r10k::params::webhook_r10k_command_path,
config_path => $r10k::params::webhook_r10k_config_path,
default_branch => $r10k::params::webhook_r10k_default_branch,
prefix => $r10k::params::webhook_r10k_branch_prefix,
allow_uppercase => $r10k::params::webhook_r10k_allow_uppercase,
verbose => $r10k::params::webhook_r10k_verbose,
deploy_modules => $r10k::params::webhook_r10k_deploy_modules,
generate_types => $r10k::params::webhook_r10k_generate_types,
command_path => '/opt/puppetlabs/puppet/bin/r10k',
config_path => '/etc/puppetlabs/r10k/r10k.yaml',
default_branch => 'production',
prefix => '',
allow_uppercase => false,
verbose => true,
deploy_modules => true,
generate_types => true,
},
R10k::Webhook::Config $config = {
server => $server,
Expand Down

0 comments on commit 4c57cf9

Please sign in to comment.