Skip to content

Commit

Permalink
(sensu#638) Enable multiple Sensu Enterprise Dashboard API endpoints
Browse files Browse the repository at this point in the history
Without this patch it is not possible to manage multiple
sensu::enterprise::dashboard::api resources in the same datacenter
because the resources conflict over the namevar.  This patchset
addresses the problem by changing the namevar to the `host` and
establishing the `datacenter` attribute.

An example of how to exercise this behavior is located in
tests/sensu-enterprise-dashboard-multi-api.pp

resolves sensu#638
closes sensu#651
closes sensu#584
  • Loading branch information
jeffmccune committed Jul 6, 2017
1 parent 2f41951 commit d834e53
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/sensu-enterprise-dashboard-multi-api.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##
# This class exercises the Dashboard API behavior in
# https://github.com/sensu/sensu-puppet/issues/638
# https://github.com/sensu/sensu-puppet/pull/651
#
# Usage:
# Bring up the sensu-server Vagrant vm.
# After provisioning completes, run:
# puppet apply -v /vagrant/tests/sensu-dashboard-api.pp
node 'sensu-server' {
# This configuration is expected to produce /etc/sensu/dashboard.json with the values of:
# name: example-dc
# host: sensu.example.com

if ! ($facts['se_user'] or $facts['se_pass']) {
fail 'Provide Sensu Enterprise Credentials using FACTER_SE_USER and FACTER_SE_PASS environment variables.'
}

# Avoid /etc/sensu/dashboard.d/.keep from install of
# sensu-enterprise-dashboard-1:2.8.1-1.x86_64 conflicts with file from
# package uchiwa-1:0.25.2-1.x86_64
package { 'uchiwa':
ensure => absent,
before => Class['sensu'],
}

class { '::sensu':
enterprise_dashboard => true,
enterprise_user => $facts['se_user'],
enterprise_pass => $facts['se_pass'],
}

sensu::enterprise::dashboard::api { 'sensu.example.com':
datacenter => 'example-dc',
}

sensu::enterprise::dashboard::api { 'sensu.example.org':
datacenter => 'example-dc',
}
}

0 comments on commit d834e53

Please sign in to comment.