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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
Description: Allow multiple gnocchi.conf
Author: Thomas Goirand <zigo@debian.org>
Forwarded: not-needed
Last-Update: 2025-03-27
Index: puppet-module-gnocchi/manifests/config.pp
===================================================================
--- puppet-module-gnocchi.orig/manifests/config.pp
+++ puppet-module-gnocchi/manifests/config.pp
@@ -24,11 +24,15 @@
# or Puppet catalog compilation will fail with duplicate resources.
#
class gnocchi::config (
- Hash $gnocchi_config = {},
- Hash $gnocchi_api_paste_ini = {},
+ Hash $gnocchi_config = {},
+ Hash $gnocchi_api_config = {},
+ Hash $gnocchi_metricd_config = {},
+ Hash $gnocchi_api_paste_ini = {},
) {
include gnocchi::deps
create_resources('gnocchi_config', $gnocchi_config)
+ create_resources('gnocchi_api_config', $gnocchi_api_config)
+ create_resources('gnocchi_metricd_config', $gnocchi_metricd_config)
create_resources('gnocchi_api_paste_ini', $gnocchi_api_paste_ini)
}
Index: puppet-module-gnocchi/manifests/init.pp
===================================================================
--- puppet-module-gnocchi.orig/manifests/init.pp
+++ puppet-module-gnocchi/manifests/init.pp
@@ -28,33 +28,90 @@
class gnocchi (
Stdlib::Ensure::Package $package_ensure = 'present',
$coordination_url = $facts['os_service_default'],
+ $coordination_url_metricd = $facts['os_service_default'],
Boolean $purge_config = false,
Boolean $manage_backend_package = true,
Stdlib::Ensure::Package $backend_package_ensure = present,
+ Boolean $use_multiple_config_files = false,
) inherits gnocchi::params {
include gnocchi::deps
- package { 'gnocchi':
- ensure => $package_ensure,
- name => $gnocchi::params::common_package_name,
- tag => ['openstack', 'gnocchi-package'],
+ if $use_multiple_config_files {
+ package { 'gnocchi':
+ ensure => $package_ensure,
+ name => $::gnocchi::params::common_package_name,
+ tag => ['openstack', 'gnocchi-package'],
+ }
+ ~> exec { 'copy /etc/gnocchi/gnocchi-metricd.conf':
+ command => '/usr/bin/cp /usr/share/gnocchi-common/gnocchi.conf /etc/gnocchi/gnocchi-metricd.conf && /usr/bin/chown root:gnocchi /etc/gnocchi/gnocchi-metricd.conf && /usr/bin/chmod 640 /etc/gnocchi/gnocchi-metricd.conf',
+ creates => '/etc/gnocchi/gnocchi-metricd.conf',
+ }
+ ~> exec { 'copy /etc/gnocchi/gnocchi-api.conf':
+ command => '/usr/bin/cp /usr/share/gnocchi-common/gnocchi.conf /etc/gnocchi/gnocchi-api.conf && /usr/bin/chown root:gnocchi /etc/gnocchi/gnocchi-api.conf && /usr/bin/chmod 640 /etc/gnocchi/gnocchi-api.conf',
+ creates => '/etc/gnocchi/gnocchi-api.conf',
+ }
+ } else {
+ package { 'gnocchi':
+ ensure => $package_ensure,
+ name => $::gnocchi::params::common_package_name,
+ tag => ['openstack', 'gnocchi-package'],
+ }
+ ~> file{ '/etc/gnocchi/gnocchi-api.conf':
+ ensure => absent,
+ }
+ ~> file{ '/etc/gnocchi/gnocchi-metricd.conf':
+ ensure => absent,
+ }
}
resources { 'gnocchi_config':
purge => $purge_config,
}
- oslo::coordination { 'gnocchi_config':
- backend_url => $coordination_url,
- manage_backend_package => $manage_backend_package,
- package_ensure => $backend_package_ensure,
- manage_config => false,
- }
- gnocchi_config {
- 'DEFAULT/coordination_url' : value => $coordination_url, secret => true;
- }
+ if $use_multiple_config_files == true {
+ oslo::coordination{ 'gnocchi_api_config':
+ backend_url => $coordination_url,
+ manage_config => false,
+ }
+ gnocchi_api_config {
+ 'DEFAULT/coordination_url' : value => $coordination_url, secret => true;
+ }
+ # all coordination settings should be applied and all packages should be
+ # installed before service startup
+ Oslo::Coordination['gnocchi_api_config'] -> Anchor['gnocchi::service::begin']
+
+ oslo::coordination{ 'gnocchi_metricd_config':
+ backend_url => $coordination_url_metricd,
+ manage_config => false,
+ }
+ gnocchi_metricd_config {
+ 'DEFAULT/coordination_url' : value => $coordination_url_metricd, secret => true;
+ }
+ # all coordination settings should be applied and all packages should be
+ # installed before service startup
+ Oslo::Coordination['gnocchi_metricd_config'] -> Anchor['gnocchi::service::begin']
- # all coordination settings should be applied and all packages should be
- # installed before service startup
- Oslo::Coordination['gnocchi_config'] -> Anchor['gnocchi::service::begin']
+ oslo::coordination{ 'gnocchi_config':
+ backend_url => $facts['os_service_default'],
+ manage_config => false,
+ }
+ gnocchi_config {
+ 'DEFAULT/coordination_url' : value => $facts['os_service_default'], secret => true;
+ }
+ # all coordination settings should be applied and all packages should be
+ # installed before service startup
+ Oslo::Coordination['gnocchi_config'] -> Anchor['gnocchi::service::begin']
+
+ } else {
+ oslo::coordination{ 'gnocchi_config':
+ backend_url => $coordination_url,
+ manage_config => false,
+ }
+ gnocchi_config {
+ 'DEFAULT/coordination_url' : value => $coordination_url, secret => true;
+ }
+ # all coordination settings should be applied and all packages should be
+ # installed before service startup
+ Oslo::Coordination['gnocchi_config'] -> Anchor['gnocchi::service::begin']
+ }
}
|