Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update webhook code with some basic fixes #603

Merged
merged 1 commit into from
Jun 8, 2023
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
5 changes: 3 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@
}

# 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 = ''
$webhook_tls_key = ''
$webhook_tls_cert_path = undef
$webhook_tls_key_path = undef
$webhook_chatops_enabled = false
$webhook_chatops_service = ''
$webhook_chatops_channel = ''
Expand Down
2 changes: 1 addition & 1 deletion manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
chatops => $chatops,
r10k => $r10k,
},
) {
) inherits r10k::params {
contain r10k::webhook::package
contain r10k::webhook::config
contain r10k::webhook::service
Expand Down
10 changes: 9 additions & 1 deletion manifests/webhook/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@
case $facts['os']['family'] {
'RedHat': {
$provider = 'rpm'
$pkg_file = '/tmp/webhook-go.rpm'
$package_url = "https://github.com/voxpupuli/webhook-go/releases/download/v${r10k::webhook::version}/webhook-go_${r10k::webhook::version}_linux_amd64.rpm"
}
'Debian', 'Ubuntu': {
$provider = 'dpkg'
$pkg_file = '/tmp/webhook-go.deb'
$package_url = "https://github.com/voxpupuli/webhook-go/releases/download/v${r10k::webhook::version}/webhook-go_${r10k::webhook::version}_linux_amd64.deb"
}
default: {
fail("Operating system ${facts['os']['name']} not supported for packages")
}
}

file { $pkg_file:
ensure => file,
source => $package_url,
before => Package['webhook-go'],
}

package { 'webhook-go':
ensure => 'present',
source => $package_url,
source => $pkg_file,
provider => $provider,
}
}
27 changes: 19 additions & 8 deletions spec/classes/webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@
config_ensure: 'file',
config_path: '/etc/voxpupuli/webhook.yml',
chatops: {
enabled: false,
},
tls: {
enabled: false,
enabled: true,
service: 'slack',
channel: '#channel',
user: 'root',
auth_token: 'ABCDEF123456789',
server_uri: 'https://webhook.slack.com/endpoint',
},
server: {
protected: true,
user: 'puppet',
password: 'puppet',
port: 4000,
tls: {
enabled: false,
}
enabled: true,
certificate: '/path/to/cert',
key: '/path/to/key',
},
},
r10k: {
command_path: '/opt/puppetlabs/puppet/bin/r10k',
Expand All @@ -51,9 +55,16 @@
password: puppet
port: 4000
tls:
enabled: false
enabled: true
certificate: "/path/to/cert"
key: "/path/to/key"
chatops:
enabled: false
enabled: true
service: slack
channel: "#channel"
user: root
auth_token: ABCDEF123456789
server_uri: https://webhook.slack.com/endpoint
r10k:
command_path: "/opt/puppetlabs/puppet/bin/r10k"
config_path: "/etc/puppetlabs/r10k/r10k.yaml"
Expand Down