Refactor mistral::notifier
Change-Id: I3438cc6d9b473ff774fc8e68a3f9df65c792bfc6
This commit is contained in:
@@ -5,42 +5,44 @@
|
||||
# === Parameters
|
||||
#
|
||||
# [*type*]
|
||||
# Type of notifier. Use local to run the notifier within the
|
||||
# engine server. Use remote if the notifier is launched as
|
||||
# a separate server to process events.
|
||||
# (Optional) Type of notifier. Use local to run the notifier within
|
||||
# the engine server. Use remote if the notifier is launched as a separate
|
||||
# server to process events.
|
||||
# (string value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*host*]
|
||||
# Name of the notifier node. This can be an opaque
|
||||
# identifier. It is not necessarily a hostname,
|
||||
# FQDN, or IP address.
|
||||
# (Optional) Name of the notifier node. This can be an opaque identifier.
|
||||
# It is not necessarily a hostname, FQDN, or IP address.
|
||||
# (string value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*topic*]
|
||||
# The message topic that the notifier server listens on.
|
||||
# (Optional) The message topic that the notifier server listens on.
|
||||
# (string value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*notify_publishers*]
|
||||
# List of publishers to publish notification.
|
||||
# (Optional) List of publishers to publish notification.
|
||||
# Note: This maps to the mistral config option `notify` but this is reserved
|
||||
# in Puppet.
|
||||
# (list of dicts)
|
||||
# Defaults to $::os_service_default.
|
||||
|
||||
#
|
||||
class mistral::notifier(
|
||||
$type = $::os_service_default,
|
||||
$host = $::os_service_default,
|
||||
$topic = $::os_service_default,
|
||||
$notify_publishers = $::os_service_default,
|
||||
$type = $::os_service_default,
|
||||
$host = $::os_service_default,
|
||||
$topic = $::os_service_default,
|
||||
$notify_publishers = $::os_service_default,
|
||||
) {
|
||||
|
||||
include mistral::deps
|
||||
include mistral::params
|
||||
|
||||
mistral_config {
|
||||
'notifier/type': value => $type;
|
||||
'notifier/host': value => $host;
|
||||
'notifier/topic': value => $topic;
|
||||
'notifier/notify': value => $notify_publishers;
|
||||
'notifier/type': value => $type;
|
||||
'notifier/host': value => $host;
|
||||
'notifier/topic': value => $topic;
|
||||
'notifier/notify': value => $notify_publishers;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe 'mistral::notifier' do
|
||||
|
||||
shared_examples_for 'mistral notifier' do
|
||||
shared_examples_for 'mistral::notifier' do
|
||||
it 'configure notifier default params' do
|
||||
is_expected.to contain_mistral_config('notifier/type').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_mistral_config('notifier/host').with_value('<SERVICE DEFAULT>')
|
||||
@@ -12,9 +12,9 @@ describe 'mistral::notifier' do
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{ :type => "remote",
|
||||
:host => "localhost",
|
||||
:topic => "mistral-event-stream",
|
||||
{ :type => "remote",
|
||||
:host => "localhost",
|
||||
:topic => "mistral-event-stream",
|
||||
:notify_publishers => "[{'type': 'noop'}]",
|
||||
}
|
||||
end
|
||||
@@ -36,7 +36,7 @@ describe 'mistral::notifier' do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'mistral notifier'
|
||||
it_configures 'mistral::notifier'
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user