Showing with 122 additions and 45 deletions.
  1. +6 −5 .sync.yml
  2. +16 −8 .travis.yml
  3. +14 −0 CHANGELOG.md
  4. +1 −0 data/defaults.yaml
  5. +1 −0 manifests/config.pp
  6. +4 −1 manifests/daemon.pp
  7. +3 −0 manifests/init.pp
  8. +1 −1 manifests/scrape_job.pp
  9. +18 −17 metadata.json
  10. +44 −12 spec/classes/prometheus_spec.rb
  11. +9 −1 spec/defines/daemon_spec.rb
  12. +3 −0 spec/spec_helper_acceptance.rb
  13. +2 −0 spec/spec_helper_methods.rb
11 changes: 6 additions & 5 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
.travis.yml:
secure: "M9rOa2lFaOagSRKNWb6BtS90yj8+8jk0tjeNGxxk73RoSfldKbxczZYY/U+nxGbLAvsDDHqQhMXXhRXxHKngl+Lg+dD6O0qT51ArGBtjSiMnVY00dC/+0nF932oS2skPbgzMGszK+u4o2Efjd6h18q9dT0WTGka2aOv9eJ18pwyESB7vyWbEDgxQ6Bk4J02EeFGhp/is1MlcK5rXpEYUGSPwJJCgEkbWuJek4ZDyT+qG5TTEUJMovNu4Oxy6HVGCDrM65hjK79oT9BVKM5xkgJoxN1trdqpmIEu8KOZck/+Iokcz+mHJfx62dJ2fg6bcOhQFSbW2UdPAYW4f1YaViHuwWWXgT58hPtB1PdEKPI/6HnAKBSLA2Fr3fA26BKbT/0CcRbSLMTjmbd9csEb5VE0eoCoTtVItVEsRkqm0BNvQ8oLRmQgFht2hGwwoczwBAj9aF80MjuDUzG2WjM/WjNIWfIFmeNoWTy/u+/58Q9wj6vIX2EyTJDEOorlP+4RXK+xub3QXntfmqkIlyB5qE6QxMDTAZN8aqBjo/771Ky7pIKAthWLVdDHPKhPHD2bMzilSqoFzNFtCkIbYp8w/eJUCfXhPpFEpt/9QzPLtP4/3KrJ/KUMt3hWfEGWOhUXlbalF5cFCP5aWkDDnoKxWILGS94xkXV2qyEGEMY2tn5o="
docker_sets:
- set: ubuntu1604-64
- set: ubuntu1804-64
- set: debian8-64
- set: debian9-64
- set: centos7-64
- set: centos8-64
- set: debian8-64
- set: debian9-64
- set: debian10-64
- set: ubuntu1604-64
- set: ubuntu1804-64
secure: "M9rOa2lFaOagSRKNWb6BtS90yj8+8jk0tjeNGxxk73RoSfldKbxczZYY/U+nxGbLAvsDDHqQhMXXhRXxHKngl+Lg+dD6O0qT51ArGBtjSiMnVY00dC/+0nF932oS2skPbgzMGszK+u4o2Efjd6h18q9dT0WTGka2aOv9eJ18pwyESB7vyWbEDgxQ6Bk4J02EeFGhp/is1MlcK5rXpEYUGSPwJJCgEkbWuJek4ZDyT+qG5TTEUJMovNu4Oxy6HVGCDrM65hjK79oT9BVKM5xkgJoxN1trdqpmIEu8KOZck/+Iokcz+mHJfx62dJ2fg6bcOhQFSbW2UdPAYW4f1YaViHuwWWXgT58hPtB1PdEKPI/6HnAKBSLA2Fr3fA26BKbT/0CcRbSLMTjmbd9csEb5VE0eoCoTtVItVEsRkqm0BNvQ8oLRmQgFht2hGwwoczwBAj9aF80MjuDUzG2WjM/WjNIWfIFmeNoWTy/u+/58Q9wj6vIX2EyTJDEOorlP+4RXK+xub3QXntfmqkIlyB5qE6QxMDTAZN8aqBjo/771Ky7pIKAthWLVdDHPKhPHD2bMzilSqoFzNFtCkIbYp8w/eJUCfXhPpFEpt/9QzPLtP4/3KrJ/KUMt3hWfEGWOhUXlbalF5cFCP5aWkDDnoKxWILGS94xkXV2qyEGEMY2tn5o="
spec/spec_helper.rb:
spec_overrides: "require 'spec_helper_methods'"
spec/spec_helper_acceptance.rb:
Expand Down
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ matrix:
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos8-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos8-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
Expand All @@ -56,19 +56,27 @@ matrix:
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos8-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos8-64 CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
services: docker
branches:
only:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.5.0](https://github.com/voxpupuli/puppet-prometheus/tree/v8.5.0) (2020-05-21)

[Full Changelog](https://github.com/voxpupuli/puppet-prometheus/compare/v8.4.0...v8.5.0)

**Implemented enhancements:**

- Allow hiding of prom config file [\#451](https://github.com/voxpupuli/puppet-prometheus/pull/451) ([hooten](https://github.com/hooten))
- Allow extract\_path to be modified [\#449](https://github.com/voxpupuli/puppet-prometheus/pull/449) ([treydock](https://github.com/treydock))
- Add support for Debian 10 [\#447](https://github.com/voxpupuli/puppet-prometheus/pull/447) ([dhoppe](https://github.com/dhoppe))

**Merged pull requests:**

- Fix scrape job file names to ensure job\_name is prefix [\#450](https://github.com/voxpupuli/puppet-prometheus/pull/450) ([treydock](https://github.com/treydock))

## [v8.4.0](https://github.com/voxpupuli/puppet-prometheus/tree/v8.4.0) (2020-04-17)

[Full Changelog](https://github.com/voxpupuli/puppet-prometheus/compare/v8.3.0...v8.4.0)
Expand Down
1 change: 1 addition & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ prometheus::alertmanager::version: '0.18.0'
prometheus::alerts: {}
prometheus::config_dir: '/etc/prometheus'
prometheus::config_mode: '0640'
prometheus::config_show_diff: true
prometheus::config_template: 'prometheus/prometheus.yaml.erb'
prometheus::consul_exporter::consul_health_summary: true
prometheus::consul_exporter::consul_server: 'localhost:8500'
Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
group => $prometheus::server::group,
mode => $prometheus::server::config_mode,
notify => Class['prometheus::service_reload'],
show_diff => $prometheus::config_show_diff,
content => template($prometheus::server::config_template),
validate_cmd => "${prometheus::server::bin_dir}/promtool ${cfg_verify_cmd} %",
}
Expand Down
5 changes: 4 additions & 1 deletion manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
# Should puppet manage the service? (default true)
# @param extract_command
# Custom command passed to the archive resource to extract the downloaded archive.
# @param extract_path
# Path where to find extracted binary
# @param archive_bin_path
# Path to the binary in the downloaded archive.
# @param init_style
Expand Down Expand Up @@ -69,6 +71,7 @@
Hash[String, Scalar] $env_vars = {},
Optional[String] $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $extract_command = $prometheus::extract_command,
Stdlib::Absolutepath $extract_path = '/opt',
Stdlib::Absolutepath $archive_bin_path = "/opt/${name}-${version}.${os}-${arch}/${name}",
Boolean $export_scrape_job = false,
Stdlib::Host $scrape_host = $facts['networking']['fqdn'],
Expand Down Expand Up @@ -97,7 +100,7 @@
archive { "/tmp/${name}-${version}.${download_extension}":
ensure => present,
extract => true,
extract_path => '/opt',
extract_path => $extract_path,
source => $real_download_url,
checksum_verify => false,
creates => $archive_bin_path,
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@
# @param log_format
# --log.format=logfmt
# Output format of log messages. One of: [logfmt, json]
# @param config_show_diff
# Whether to show prometheus configuration file diff in the Puppet logs.
class prometheus (
String $user,
String $group,
Expand Down Expand Up @@ -291,6 +293,7 @@
Boolean $manage_group = true,
Boolean $purge_config_dir = true,
Boolean $manage_user = true,
Boolean $config_show_diff = true,
) {

case $arch {
Expand Down
2 changes: 1 addition & 1 deletion manifests/scrape_job.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
labels => $labels,
},
])
file { "${collect_dir}/${name}.yaml":
file { "${collect_dir}/${job_name}_${name}.yaml":
ensure => file,
owner => 'root',
group => $prometheus::group,
Expand Down
35 changes: 18 additions & 17 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-prometheus",
"version": "8.4.0",
"version": "8.5.0",
"author": "Vox Pupuli",
"summary": "This module installs, configures and manages the Prometheus service.",
"license": "Apache-2.0",
Expand All @@ -23,29 +23,15 @@
],
"operatingsystem_support": [
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
]
},
{
"operatingsystem": "CentOS",
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7",
"8"
]
},
{
"operatingsystem": "RedHat",
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6",
"7",
Expand All @@ -59,6 +45,21 @@
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9",
"10"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
]
},
{
"operatingsystem": "Archlinux"
}
Expand Down
56 changes: 44 additions & 12 deletions spec/classes/prometheus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
'content' => File.read(fixtures('files', "prometheus#{prom_major}.sysv"))
)
}
elsif ['centos-7-x86_64', 'centos-8-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'ubuntu-16.04-x86_64', 'ubuntu-18.04-x86_64', 'virtuozzolinux-7-x86_64'].include?(os)
elsif ['centos-7-x86_64', 'centos-8-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'debian-10-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'ubuntu-16.04-x86_64', 'ubuntu-18.04-x86_64', 'virtuozzolinux-7-x86_64'].include?(os)
# 'archlinux-5-x86_64' got removed from that list. It has systemd, but we use the repo packages and their shipped unit files.
# init_style = 'systemd'

Expand Down Expand Up @@ -170,12 +170,13 @@

it {
is_expected.to contain_file('prometheus.yaml').with(
'ensure' => 'file',
'path' => configpath,
'owner' => 'root',
'group' => 'prometheus',
'mode' => '0640',
'content' => File.read(fixtures('files', "prometheus#{prom_major}.yaml"))
'ensure' => 'file',
'path' => configpath,
'owner' => 'root',
'group' => 'prometheus',
'mode' => '0640',
'show_diff' => true,
'content' => File.read(fixtures('files', "prometheus#{prom_major}.yaml"))
).that_notifies('Class[prometheus::service_reload]')
}

Expand Down Expand Up @@ -300,11 +301,12 @@
it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_file('prometheus.yaml').with(
'ensure' => 'file',
'path' => configpath,
'owner' => 'root',
'group' => 'prometheus',
'content' => %r{http://domain.tld/path}
'ensure' => 'file',
'path' => configpath,
'owner' => 'root',
'group' => 'prometheus',
'show_diff' => true,
'content' => %r{http://domain.tld/path}
)
}
end
Expand Down Expand Up @@ -333,6 +335,36 @@
end
end
end

context 'with config_show_diff set' do
[
{
manage_prometheus_server: true,
config_show_diff: true
},
{
manage_prometheus_server: true,
config_show_diff: false
}
].each do |parameters|
context "to #{parameters[:config_show_diff]}" do
let(:params) do
parameters
end

it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_file('prometheus.yaml').with(
'ensure' => 'file',
'path' => configpath,
'owner' => 'root',
'group' => 'prometheus',
'show_diff' => parameters[:config_show_diff]
)
}
end
end
end
context 'command-line flags' do
context 'prometheus v2' do
version = '2.13.0'
Expand Down
10 changes: 9 additions & 1 deletion spec/defines/daemon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
)
}

context 'with overidden extract_path' do
let(:params) do
parameters.merge(extract_path: '/opt/foo')
end

it { is_expected.to contain_archive("/tmp/smurf_exporter-#{parameters[:version]}.tar.gz").with_extract_path('/opt/foo') }
end

# prometheus::config
if ['debian-7-x86_64'].include?(os)
# init_style = 'debian'
Expand Down Expand Up @@ -134,7 +142,7 @@
)
}
end
elsif ['centos-7-x86_64', 'centos-8-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'ubuntu-16.04-x86_64', 'ubuntu-18.04-x86_64', 'archlinux-5-x86_64', 'virtuozzolinux-7-x86_64'].include?(os)
elsif ['centos-7-x86_64', 'centos-8-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'debian-10-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'ubuntu-16.04-x86_64', 'ubuntu-18.04-x86_64', 'archlinux-5-x86_64', 'virtuozzolinux-7-x86_64'].include?(os)
# init_style = 'systemd'

it { is_expected.to contain_class('systemd') }
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is completely managed via modulesync
require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }
2 changes: 2 additions & 0 deletions spec/spec_helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def os_specific_facts(facts)
{ service_provider: 'systemd' }
when '9'
{ service_provider: 'systemd' }
when '10'
{ service_provider: 'systemd' }
when '16.04'
{ service_provider: 'systemd' }
when '18.04'
Expand Down