File: notifications.pp

package info (click to toggle)
puppet-module-oslo 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 992 kB
  • sloc: ruby: 2,436; python: 33; sh: 10; makefile: 10
file content (58 lines) | stat: -rw-r--r-- 2,224 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# == Define: oslo::messaging::notifications
#
# Configure oslo_messaging_notifications options
#
# This resource configures Oslo Notifications resources for an OpenStack service.
# It will manage the [oslo_messaging_notifications] section in the given config resource.
#
# === Parameters:
#
# [*driver*]
#   (Optional) The Driver(s) to handle sending notifications.
#   Possible values are messaging, messagingv2, routing, log, test, noop.
#   (list value or string value)
#   Defaults to $facts['os_service_default'].
#
# [*transport_url*]
#   (Optional) A URL representing the messaging driver to use for
#   notifications. If not set, we fall back to the same
#   configuration used for RPC.
#   Transport URLs take the form::
#      transport://user:pass@host1:port[,hostN:portN]/virtual_host
#   (string value)
#   Defaults to $facts['os_service_default'].
#
# [*topics*]
#   (Optional) AMQP topic(s) used for OpenStack notifications
#   (list value)
#   Defaults to $facts['os_service_default'].
#
# [*retry*]
#   (Optional) The maximum number of attempts to re-sent a notification
#   message, which failed to be delivered due to a recoverable error.
#   Defaults to $facts['os_service_default'].
#
define oslo::messaging::notifications (
  $driver                           = $facts['os_service_default'],
  Oslo::TransportURL $transport_url = $facts['os_service_default'],
  $topics                           = $facts['os_service_default'],
  $retry                            = $facts['os_service_default'],
) {
  # When we have a string value for driver,  we keep passing it as string
  # to reduce any chance of breaking things in a backwards incompatible way
  $driver_real = $driver ? {
    String  => $driver,
    default => any2array($driver)
  }

  $topics_real = join(any2array($topics), ',')

  $notification_options = {
    'oslo_messaging_notifications/driver'        => { value => $driver_real },
    'oslo_messaging_notifications/transport_url' => { value => $transport_url, secret => true },
    'oslo_messaging_notifications/topics'        => { value => $topics_real },
    'oslo_messaging_notifications/retry'         => { value => $retry },
  }

  create_resources($name, $notification_options)
}