Skip to content

Commit

Permalink
(Maint) Set enterprise: true in enterprise Vagrant VM
Browse files Browse the repository at this point in the history
Without this patch the sensu-server-enterprise Vagrant VM is not managing the
Service[sensu-enterprise] resource.  This is a problem for testing the behavior
changes made in sensu#720.

This patch addresses the problem by changing the class parameters of the
provisioning manifest for sensu-server-enterprise.  The credentials for the
Sensu Enterprise repository are expected to be set in the shell environment
where `vagrant up` is executed.

For example, the following direnv `.envrc` is sufficient for this project:

```
export FACTER_SE_USER='1234567890'
export FACTER_SE_PASS='Password1'
```
  • Loading branch information
jeffmccune committed Jul 7, 2017
1 parent 54219c6 commit 1d694e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
server.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true
server.vm.network :forwarded_port, guest: 15672, host: 15672, auto_correct: true
server.vm.provision :shell, :path => "tests/provision_basic_el.sh"
server.vm.provision :shell, :path => "tests/provision_enterprise_server.sh"
server.vm.provision :shell,
:path => "tests/provision_enterprise_server.sh",
:env => {
'FACTER_SE_USER' => ENV['FACTER_SE_USER'].to_s,
'FACTER_SE_PASS' => ENV['FACTER_SE_PASS'].to_s,
}

server.vm.provision :shell, :path => "tests/rabbitmq.sh"
end

Expand Down
7 changes: 7 additions & 0 deletions tests/provision_enterprise_server.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

if [ -z "${FACTER_SE_USER:-}" ]; then
echo "ERROR: You must export FACTER_SE_USER and FACTER_SE_PASS" >&2
echo "ERROR: In the shell that executes vagrant up" >&2
exit 1
fi
echo "FACTER_SE_USER=$FACTER_SE_USER"

# setup module dependencies
puppet module install puppetlabs/rabbitmq

Expand Down
11 changes: 6 additions & 5 deletions tests/sensu-server-enterprise.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@
mode => '0600',
}

# NOTE: When testing sensu enterprise, provide the SE_USER and SE_PASS to use
# with the online repository using the FACTER_SE_USER and FACTER_SE_PASS
# environment variables. An effective way to manage this is with `direnv`
class { '::sensu':
install_repo => true,
server => true,
enterprise => true,
enterprise_user => $facts['se_user'],
enterprise_pass => $facts['se_pass'],
manage_services => true,
manage_user => true,
rabbitmq_password => 'correct-horse-battery-staple',
rabbitmq_vhost => '/sensu',
api => true,
api_user => 'admin',
api_password => 'secret',
client_address => $::ipaddress_eth1,
# enterprise options
api_ssl_port => '4568',
api_ssl_keystore_file => '/etc/sensu/api.keystore',
api_ssl_keystore_password => 'sensutest',
Expand Down

0 comments on commit 1d694e4

Please sign in to comment.