Skip to content

Commit 8f224ab

Browse files
treydockTrey Dockendorf
authored andcommitted
Remove namespace validation for agents
Ensure entity config validator actually gets included Update unit test fixtures to use HTTPS Remove EOL OSes Update default resources to match latest Sensu Go Skip enterprise tests Add test for agent working while backend is down
1 parent 9f6abce commit 8f224ab

17 files changed

+80
-134
lines changed

.fixtures-latest.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
fixtures:
22
repositories:
33
apt:
4-
repo: git://github.com/puppetlabs/puppetlabs-apt.git
4+
repo: https://github.com/puppetlabs/puppetlabs-apt.git
55
stdlib:
6-
repo: git://github.com/puppetlabs/puppetlabs-stdlib.git
6+
repo: https://github.com/puppetlabs/puppetlabs-stdlib.git
77
datacat:
8-
repo: git://github.com/richardc/puppet-datacat.git
8+
repo: https://github.com/richardc/puppet-datacat.git
99
yumrepo_core:
10-
repo: git://github.com/puppetlabs/puppetlabs-yumrepo_core
10+
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core
1111
puppet_version: ">= 6.0.0"
1212
chocolatey:
13-
repo: git://github.com/puppetlabs/puppetlabs-chocolatey.git
13+
repo: https://github.com/puppetlabs/puppetlabs-chocolatey.git
1414
# Needed by chocolatey
1515
registry:
16-
repo: git://github.com/puppetlabs/puppetlabs-registry.git
16+
repo: https://github.com/puppetlabs/puppetlabs-registry.git
1717
# Needed by chocolatey
1818
powershell:
19-
repo: git://github.com/puppetlabs/puppetlabs-powershell.git
19+
repo: https://github.com/puppetlabs/puppetlabs-powershell.git
2020
# Need by postgresql
2121
augeas_core:
22-
repo: git://github.com/puppetlabs/puppetlabs-augeas_core
22+
repo: https://github.com/puppetlabs/puppetlabs-augeas_core
2323
puppet_version: ">= 6.0.0"
2424
# Need by postgresql
2525
concat:
26-
repo: git://github.com/puppetlabs/puppetlabs-concat.git
26+
repo: https://github.com/puppetlabs/puppetlabs-concat.git
2727
postgresql:
28-
repo: git://github.com/puppetlabs/puppetlabs-postgresql.git
28+
repo: https://github.com/puppetlabs/puppetlabs-postgresql.git
2929
archive:
30-
repo: git://github.com/voxpupuli/puppet-archive.git
30+
repo: https://github.com/voxpupuli/puppet-archive.git
3131
windows_env:
32-
repo: git://github.com/voxpupuli/puppet-windows_env.git
32+
repo: https://github.com/voxpupuli/puppet-windows_env.git
3333
systemd:
34-
repo: git://github.com/camptocamp/puppet-systemd.git
34+
repo: https://github.com/camptocamp/puppet-systemd.git
3535
symlinks:
3636
sensu: "#{source_dir}"

.fixtures.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
fixtures:
22
repositories:
33
apt:
4-
repo: git://github.com/puppetlabs/puppetlabs-apt.git
4+
repo: https://github.com/puppetlabs/puppetlabs-apt.git
55
ref: 5.0.1
66
stdlib:
7-
repo: git://github.com/puppetlabs/puppetlabs-stdlib.git
7+
repo: https://github.com/puppetlabs/puppetlabs-stdlib.git
88
ref: 5.1.0
99
datacat:
10-
repo: git://github.com/richardc/puppet-datacat.git
10+
repo: https://github.com/richardc/puppet-datacat.git
1111
ref: 0.6.2
1212
yumrepo_core:
13-
repo: git://github.com/puppetlabs/puppetlabs-yumrepo_core
13+
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core
1414
ref: 1.0.1
1515
puppet_version: ">= 6.0.0"
1616
chocolatey:
17-
repo: git://github.com/puppetlabs/puppetlabs-chocolatey.git
17+
repo: https://github.com/puppetlabs/puppetlabs-chocolatey.git
1818
ref: 3.0.0
1919
# Needed by chocolatey
2020
registry:
21-
repo: git://github.com/puppetlabs/puppetlabs-registry.git
21+
repo: https://github.com/puppetlabs/puppetlabs-registry.git
2222
ref: 1.0.0
2323
# Needed by chocolatey
2424
powershell:
25-
repo: git://github.com/puppetlabs/puppetlabs-powershell.git
25+
repo: https://github.com/puppetlabs/puppetlabs-powershell.git
2626
ref: 1.0.1
2727
# Need by postgresql
2828
augeas_core:
29-
repo: git://github.com/puppetlabs/puppetlabs-augeas_core
29+
repo: https://github.com/puppetlabs/puppetlabs-augeas_core
3030
ref: 1.0.4
3131
puppet_version: ">= 6.0.0"
3232
# Need by postgresql
3333
concat:
34-
repo: git://github.com/puppetlabs/puppetlabs-concat.git
34+
repo: https://github.com/puppetlabs/puppetlabs-concat.git
3535
ref: v6.0.0
3636
postgresql:
37-
repo: git://github.com/puppetlabs/puppetlabs-postgresql.git
37+
repo: https://github.com/puppetlabs/puppetlabs-postgresql.git
3838
ref: v6.4.0
3939
archive:
40-
repo: git://github.com/voxpupuli/puppet-archive.git
40+
repo: https://github.com/voxpupuli/puppet-archive.git
4141
ref: 'v3.0.0'
4242
windows_env:
43-
repo: git://github.com/voxpupuli/puppet-windows_env.git
43+
repo: https://github.com/voxpupuli/puppet-windows_env.git
4444
ref: 'v3.0.0'
4545
systemd:
46-
repo: git://github.com/camptocamp/puppet-systemd.git
46+
repo: https://github.com/camptocamp/puppet-systemd.git
4747
ref: '2.0.0'
4848
symlinks:
4949
sensu: "#{source_dir}"

.github/workflows/acceptance.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ jobs:
1616
matrix:
1717
set:
1818
- centos-7
19-
- centos-8
20-
- debian-9
19+
- rocky-8
2120
- debian-10
22-
- ubuntu-1604
2321
- ubuntu-1804
2422
- ubuntu-2004
2523
- amazonlinux-2

.github/workflows/unit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
puppet: 6
2121
fixtures: .fixtures.yml
2222
allow_failure: false
23-
- ruby: 2.7.0
23+
- ruby: 2.7.6
2424
puppet: 7
2525
fixtures: .fixtures.yml
2626
allow_failure: false
2727
- ruby: 2.5.7
2828
puppet: 6
2929
fixtures: .fixtures-latest.yml
3030
allow_failure: true
31-
- ruby: 2.7.0
31+
- ruby: 2.7.6
3232
puppet: 7
3333
fixtures: .fixtures-latest.yml
3434
allow_failure: true

lib/puppet/type/sensu_agent_entity_config.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,5 @@ def pre_run_check
181181
if !config.is_a?(Hash) && self[:value].nil?
182182
fail "You must provide a value for the value property"
183183
end
184-
PuppetX::Sensu::Type.validate_namespace(self)
185184
end
186185
end

manifests/agent.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
}
297297

298298
sensu_agent_entity_validator { $config['name']:
299+
ensure => 'present',
299300
namespace => $config['namespace'],
300301
provider => 'sensu_api',
301302
}

manifests/api.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
}
1717

1818
sensu_api_validator { 'sensu':
19+
ensure => 'present',
1920
sensu_api_server => $sensu::api_host,
2021
sensu_api_port => $sensu::api_port,
2122
use_ssl => $sensu::use_ssl,

manifests/backend/default_resources.pp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
'assets',
1818
'checks',
1919
'entities',
20-
'extensions',
2120
'events',
2221
'filters',
2322
'handlers',
@@ -52,7 +51,6 @@
5251
'assets',
5352
'checks',
5453
'entities',
55-
'extensions',
5654
'events',
5755
'filters',
5856
'handlers',
@@ -94,7 +92,6 @@
9492
'assets',
9593
'checks',
9694
'entities',
97-
'extensions',
9895
'events',
9996
'filters',
10097
'handlers',

metadata.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,26 @@
2929
{
3030
"operatingsystem": "RedHat",
3131
"operatingsystemrelease": [
32-
"6",
3332
"7",
3433
"8"
3534
]
3635
},
3736
{
3837
"operatingsystem": "CentOS",
3938
"operatingsystemrelease": [
40-
"6",
4139
"7",
4240
"8"
4341
]
4442
},
4543
{
4644
"operatingsystem": "Debian",
4745
"operatingsystemrelease": [
48-
"9",
4946
"10"
5047
]
5148
},
5249
{
5350
"operatingsystem": "Ubuntu",
5451
"operatingsystemrelease": [
55-
"16.04",
5652
"18.04",
5753
"20.04"
5854
]

spec/acceptance/01_agent_spec.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,4 +374,47 @@ class { 'sensu::agent':
374374
end
375375
end
376376
end
377+
378+
context 'when backend is down' do
379+
it 'should work with errors' do
380+
pp = <<-EOS
381+
class { '::sensu': }
382+
class { 'sensu::agent':
383+
backends => ['sensu-backend:8081'],
384+
entity_name => 'sensu-agent',
385+
subscriptions => ['base'],
386+
labels => { 'foo' => 'bar' },
387+
annotations => { 'contacts' => '[email protected]' },
388+
service_env_vars => { 'SENSU_API_PORT' => '4041' },
389+
config_hash => {
390+
'log-level' => 'info',
391+
'keepalive-interval' => 30,
392+
}
393+
}
394+
sensu::agent::subscription { 'linux': }
395+
sensu::agent::label { 'cpu.warning': value => '90' }
396+
sensu::agent::label { 'cpu.critical': value => '95' }
397+
sensu::agent::label { 'bar': value => 'baz2', redact => true }
398+
sensu::agent::annotation { 'foobar': value => 'bar' }
399+
sensu::agent::annotation { 'cpu.message': value => 'bar' }
400+
sensu::agent::config_entry { 'keepalive-interval': value => 20 }
401+
file { '/tmp/test': ensure => 'file' }
402+
EOS
403+
404+
on backend, 'puppet resource service sensu-backend ensure=stopped'
405+
if RSpec.configuration.sensu_use_agent
406+
site_pp = "node 'sensu-agent' { #{pp} }"
407+
puppetserver = hosts_as('puppetserver')[0]
408+
create_remote_file(puppetserver, "/etc/puppetlabs/code/environments/production/manifests/site.pp", site_pp)
409+
on node, puppet("agent -t --detailed-exitcodes"), acceptable_exit_codes: [1,4,6]
410+
else
411+
apply_manifest_on(node, pp, :catch_failures => false)
412+
end
413+
on backend, 'puppet resource service sensu-backend ensure=running'
414+
end
415+
416+
describe file('/tmp/test'), :node => node do
417+
it { is_expected.to be_file }
418+
end
419+
end
377420
end

0 commit comments

Comments
 (0)