1 change: 0 additions & 1 deletion .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- debian-10
- ubuntu-1804
- ubuntu-2004
- amazonlinux-2
- amazonlinux-201803
puppet:
- puppet6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ jobs:
bundler-cache: true
bundler: '2.1.0'
- name: Validate
run: bundle exec rake validate lint strings:generate reference
run: bundle exec rake sensu_validate lint strings:generate reference
- name: Run tests
run: bundle exec rake parallel_spec
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v5.10.0](https://github.com/sensu/sensu-puppet/tree/v5.10.0) (2023-02-27)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v5.9.0...v5.10.0)

### Added

- Allow disabling agent entity validation and API validation [\#1332](https://github.com/sensu/sensu-puppet/pull/1332) ([treydock](https://github.com/treydock))

## [v5.9.0](https://github.com/sensu/sensu-puppet/tree/v5.9.0) (2022-10-28)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v5.8.0...v5.9.0)
Expand Down Expand Up @@ -252,7 +260,6 @@

- Allow agents to have subscriptions defined as a resource [\#1227](https://github.com/sensu/sensu-puppet/pull/1227) ([treydock](https://github.com/treydock))
- Support bonsai version with v prefix [\#1223](https://github.com/sensu/sensu-puppet/pull/1223) ([treydock](https://github.com/treydock))
- Manage license through sensu\_license type [\#1218](https://github.com/sensu/sensu-puppet/pull/1218) ([treydock](https://github.com/treydock))

### Fixed

Expand All @@ -267,10 +274,6 @@

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.5.0...v4.5.1)

### Merged Pull Requests

- Fix release process [\#1216](https://github.com/sensu/sensu-puppet/pull/1216) ([treydock](https://github.com/treydock))

## [v4.5.0](https://github.com/sensu/sensu-puppet/tree/v4.5.0) (2020-02-08)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.4.1...v4.5.0)
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,20 @@ sensu::agent::annotation { 'ec2_access_key':
}
```

### Advanced agent - Disable validations

In some cases it might be desired to disable API and entity validations when agents are managing their own entity.

```puppet
class { 'sensu':
validate_api => false,
}
class { 'sensu::agent':
agent_managed_entity => true,
validate_entity => false,
}
```

### Advanced agent - Custom config entries

It is possible to define config entries for `agent.yml` in many locations in Puppet:
Expand Down Expand Up @@ -648,7 +662,7 @@ The following example will add a PostgreSQL server and database to the sensu-bac
```puppet
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.6',
version => '11',
}
class { 'postgresql::server': }
class { 'sensu::backend':
Expand Down
19 changes: 19 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ The following parameters are available in the `sensu` class:
* [`agent_password`](#-sensu--agent_password)
* [`agent_entity_config_password`](#-sensu--agent_entity_config_password)
* [`validate_namespaces`](#-sensu--validate_namespaces)
* [`validate_api`](#-sensu--validate_api)

##### <a name="-sensu--version"></a>`version`

Expand Down Expand Up @@ -279,6 +280,14 @@ Determines if sensuctl and sensu_api types will validate their namespace exists

Default value: `true`

##### <a name="-sensu--validate_api"></a>`validate_api`

Data type: `Boolean`

Determines if Sensu API is validated

Default value: `true`

### <a name="sensu--agent"></a>`sensu::agent`

Class to manage the Sensu agent.
Expand Down Expand Up @@ -323,6 +332,7 @@ The following parameters are available in the `sensu::agent` class:
* [`show_diff`](#-sensu--agent--show_diff)
* [`log_file`](#-sensu--agent--log_file)
* [`agent_entity_config_provider`](#-sensu--agent--agent_entity_config_provider)
* [`validate_entity`](#-sensu--agent--validate_entity)

##### <a name="-sensu--agent--version"></a>`version`

Expand Down Expand Up @@ -519,6 +529,15 @@ The provider to use when managing sensu_agent_entity_config resources

Default value: `'sensu_api'`

##### <a name="-sensu--agent--validate_entity"></a>`validate_entity`

Data type: `Boolean`

Sets whether to validate the agent's entity before attempting
to configure the entity

Default value: `true`

### <a name="sensu--api"></a>`sensu::api`

Class to manage the Sensu API.
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RSpec::Core::RakeTask.new(:acceptance) do |t|
end

desc 'Validate manifests, templates, ruby files and shell scripts'
task :validate do
task :sensu_validate do
# lib/* gets checked by puppetlabs_spec_helper, though it skips spec entirely
puts "\nValidating ruby files ignored by puppetlabs_spec_helper (Vagrantfile', 'spec/**/*.rb)"
Dir['Vagrantfile', 'spec/**/*.rb'].each do |ruby_file|
Expand Down
13 changes: 4 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,16 @@ install:
test_script:
- bundle exec rake acceptance:windows
image:
# Windows 2012 R2
- Visual Studio 2015
# Windows 2016
- Visual Studio 2017
# Only test newest build images to avoid transient errors with older builds
# Windows 2019
- Visual Studio 2019
environment:
matrix:
- PUPPET_GEM_VERSION: '~>6.x'
FACTER_GEM_VERSION: '~>2.x'
PUPPET_REPO: puppet6
RUBY_VERSION: 25-x64
# Seen transient errors with Ruby 2.5 used with Puppet 6
# so just test Puppet 7 and Ruby 2.7
- PUPPET_GEM_VERSION: '~>7.x'
FACTER_GEM_VERSION: '~>4.x'
PUPPET_REPO: puppet7
RUBY_VERSION: 26-x64
RUBY_VERSION: 27-x64
matrix:
fast_finish: false
6 changes: 3 additions & 3 deletions examples/postgresql-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Adjustments will have to be made for IP addresses and password.
Once the primary and standby have applied their Puppet catalog you must bootstrap the standby:

```
systemctl stop postgresql-9.6.service
rm -rf /var/lib/pgsql/9.6/data/*
sudo -u postgres pg_basebackup -h 192.168.52.11 -D /var/lib/pgsql/9.6/data -P -U repl -R --xlog-method=stream
systemctl stop postgresql-11.service
rm -rf /var/lib/pgsql/11/data/*
sudo -u postgres pg_basebackup -h 192.168.52.11 -D /var/lib/pgsql/11/data -P -U repl -R --xlog-method=stream
```

Once the bootstrap is done, re-run Puppet.
Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql-replication/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class { 'postgresql::globals':
manage_package_repo => true,
version => '9.6',
version => '11',
}
class { 'postgresql::server':
listen_addresses => '*',
Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql-ssl/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class { 'postgresql::globals':
manage_package_repo => true,
version => '9.6',
version => '11',
}

class { 'postgresql::server':
Expand Down
14 changes: 10 additions & 4 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
# Defaults to `C:\ProgramData\sensu\log\sensu-agent.log`
# @param agent_entity_config_provider
# The provider to use when managing sensu_agent_entity_config resources
# @param validate_entity
# Sets whether to validate the agent's entity before attempting
# to configure the entity
#
class sensu::agent (
Optional[String] $version = undef,
Expand All @@ -98,6 +101,7 @@
Boolean $show_diff = true,
Optional[Stdlib::Absolutepath] $log_file = undef,
Enum['sensuctl','sensu_api'] $agent_entity_config_provider = 'sensu_api',
Boolean $validate_entity = true,
) {

include sensu
Expand Down Expand Up @@ -295,9 +299,11 @@
subscribe => $service_subscribe,
}

sensu_agent_entity_validator { $config['name']:
ensure => 'present',
namespace => $config['namespace'],
provider => 'sensu_api',
if $validate_entity {
sensu_agent_entity_validator { $config['name']:
ensure => 'present',
namespace => $config['namespace'],
provider => 'sensu_api',
}
}
}
12 changes: 7 additions & 5 deletions manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
validate_namespaces => $sensu::validate_namespaces,
}

sensu_api_validator { 'sensu':
ensure => 'present',
sensu_api_server => $sensu::api_host,
sensu_api_port => $sensu::api_port,
use_ssl => $sensu::use_ssl,
if $sensu::validate_api {
sensu_api_validator { 'sensu':
ensure => 'present',
sensu_api_server => $sensu::api_host,
sensu_api_port => $sensu::api_port,
use_ssl => $sensu::use_ssl,
}
}
}
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
# Defaults to value used for `agent_password`.
# @param validate_namespaces
# Determines if sensuctl and sensu_api types will validate their namespace exists
# @param validate_api
# Determines if Sensu API is validated
class sensu (
String $version = 'installed',
Stdlib::Absolutepath $etc_dir = '/etc/sensu',
Expand All @@ -80,6 +82,7 @@
String $agent_password = 'P@ssw0rd!',
Optional[String] $agent_entity_config_password = undef,
Boolean $validate_namespaces = true,
Boolean $validate_api = true,
) {

if $ssl_ca_content {
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sensu-sensu",
"version": "5.9.0",
"version": "5.10.0",
"author": "sensu",
"summary": "A module to install the Sensu monitoring framework",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/06_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class { 'sensu::agent':
pp = <<-EOS
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.6',
version => '11',
}
class { 'postgresql::server':}
class { 'sensu::backend':
Expand Down
35 changes: 0 additions & 35 deletions spec/acceptance/nodesets/amazonlinux-2.yml

This file was deleted.

6 changes: 6 additions & 0 deletions spec/acceptance/nodesets/centos-7-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ HOSTS:
docker_image_commands:
- "sed -i -r '/^tsflags/d' /etc/yum.conf"
- 'yum install -y wget which iproute'
- 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo'
- 'yum update -y systemd'
docker_container_name: 'sensu-backend1-el7'
sensu-backend2:
roles:
Expand All @@ -28,6 +30,8 @@ HOSTS:
docker_image_commands:
- "sed -i -r '/^tsflags/d' /etc/yum.conf"
- 'yum install -y wget which iproute'
- 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo'
- 'yum update -y systemd'
docker_container_name: 'sensu-backend2-el7'
sensu-backend3:
roles:
Expand All @@ -42,6 +46,8 @@ HOSTS:
docker_image_commands:
- "sed -i -r '/^tsflags/d' /etc/yum.conf"
- 'yum install -y wget which iproute'
- 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo'
- 'yum update -y systemd'
docker_container_name: 'sensu-backend3-el7'
CONFIG:
log_level: debug
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/nodesets/centos-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ HOSTS:
docker_image_commands:
- "sed -i -r '/^tsflags/d' /etc/yum.conf"
- 'yum install -y wget which iproute'
- 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo'
- 'yum update -y systemd'
docker_env:
- LANG=en_US.UTF-8
- LANGUAGE=en_US.UTF-8
Expand All @@ -32,6 +34,8 @@ HOSTS:
docker_image_commands:
- "sed -i -r '/^tsflags/d' /etc/yum.conf"
- 'yum install -y wget which initscripts iproute'
- 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo'
- 'yum update -y systemd'
docker_env:
- LANG=en_US.UTF-8
- LANGUAGE=en_US.UTF-8
Expand Down
Loading