Codebase list puppet-module-gnocchi / 205c7cf
Merge tag '21.0.0' into debian/zed puppet-gnocchi 21.0.0 release meta:version: 21.0.0 meta:diff-start: - meta:series: zed meta:release-type: release meta:pypi: no meta:first: yes meta:release:Author: Takashi Kajinami <tkajinam@redhat.com> meta:release:Commit: Takashi Kajinami <tkajinam@redhat.com> meta:release:Change-Id: I074f4605c465ea38486ca509e0b4c4891fafabad meta:release:Code-Review+2: Elod Illes <elod.illes@est.tech> meta:release:Code-Review+2: Thierry Carrez <thierry@openstack.org> meta:release:Workflow+1: Thierry Carrez <thierry@openstack.org> Thomas Goirand 1 year, 6 months ago
31 changed file(s) with 459 addition(s) and 214 deletion(s). Raw diff Collapse all Expand all
00 Puppet::Type.type(:gnocchi_api_paste_ini).provide(
11 :ini_setting,
2 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
2 :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
33 ) do
4
5 def section
6 resource[:name].split('/', 2).first
7 end
8
9 def setting
10 resource[:name].split('/', 2).last
11 end
12
13 def separator
14 '='
15 end
164
175 def self.file_path
186 '/etc/gnocchi/api-paste.ini'
197 end
208
21 # added for backwards compatibility with older versions of inifile
22 def file_path
23 self.class.file_path
24 end
25
269 end
5454 # (Optional) Set max request body size
5555 # Defaults to $::os_service_default.
5656 #
57 # DEPRECATED PARAMETERS
58 #
59 # [*middlewares*]
60 # (optional) Middlewares to use.
61 # Defaults to undef
62 #
6357 class gnocchi::api (
6458 $manage_service = true,
6559 $enabled = true,
7266 $operation_timeout = $::os_service_default,
7367 $enable_proxy_headers_parsing = $::os_service_default,
7468 $max_request_body_size = $::os_service_default,
75 # DEPRECATED PARAMETERS
76 $middlewares = undef,
7769 ) inherits gnocchi::params {
7870
7971 include gnocchi::deps
8072 include gnocchi::policy
81
82 if $middlewares != undef {
83 warning('The gnocchi::api::middleware parameter is deprecated and has no effect')
84 }
85 gnocchi_config {
86 'api/middlewares': ensure => absent;
87 }
8873
8974 package { 'gnocchi-api':
9075 ensure => $package_ensure,
130115 }
131116
132117 gnocchi_config {
133 'api/max_limit': value => $max_limit;
134 'api/auth_mode': value => $auth_strategy;
135 'api/paste_config': value => $paste_config;
136 'api/operation_timeout': value => $operation_timeout;
118 'api/max_limit': value => $max_limit;
119 'api/auth_mode': value => $auth_strategy;
120 'api/paste_config': value => $paste_config;
121 'api/operation_timeout': value => $operation_timeout;
122 'api/enable_proxy_headers_parsing': value => $enable_proxy_headers_parsing;
137123 }
138124
139125 oslo::middleware { 'gnocchi_config':
140 enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
141 max_request_body_size => $max_request_body_size,
126 max_request_body_size => $max_request_body_size,
142127 }
143128
144129 if $auth_strategy == 'keystone' {
1313 # Defaults to $::os_service_default
1414 #
1515 # [*disable_by_file_path*]
16 # (Optional) Check the presense of a file to determine if an application
16 # (Optional) Check the presence of a file to determine if an application
1717 # is running on a port.
1818 # Defaults to $::os_service_default
1919 #
2020 # [*disable_by_file_paths*]
21 # (Optional) Check the presense of a file to determine if an application
21 # (Optional) Check the presence of a file to determine if an application
2222 # is running on a port. Expects a "port:path" list of strings.
2323 # Defaults to $::os_service_default
2424 #
5555 # Defaults to 'gnocchi'
5656 #
5757 # [*public_url*]
58 # (0ptional) The endpoint's public url.
58 # (Optional) The endpoint's public url.
5959 # This url should *not* contain any trailing '/'.
6060 # Defaults to 'http://127.0.0.1:8041'
6161 #
1414 # Defaults to $::os_workers
1515 #
1616 # [*metric_processing_delay*]
17 # (optional) Delay between processng metrics
17 # (optional) Delay between processing metrics
1818 # Defaults to $::os_service_default.
1919 #
2020 # [*greedy*]
2121 # (optional) Allow to bypass metric_processing_delay if metricd is noticed
2222 # that messages are ready to be processed.
23 # Defaoults to $::os_service_default.
23 # Defaults to $::os_service_default.
2424 #
2525 # [*metric_reporting_delay*]
26 # (optional) How many seocnds to wait between metric ingestion reporting.
26 # (optional) How many seconds to wait between metric ingestion reporting.
2727 # Defaults to $::os_service_default.
2828 #
2929 # [*metric_cleanup_delay*]
3838 # (optional) Whether the service should be managed by Puppet.
3939 # Defaults to true.
4040 #
41 # DEPRECATED PARAMETERS
42 #
43 # [*cleanup_delay*]
44 # (optional) How many seconds to wait between
45 # cleaning of expired data.
46 # Defaults to $::os_service_default
47 #
4841 class gnocchi::metricd (
4942 $manage_service = true,
5043 $enabled = true,
5548 $metric_cleanup_delay = $::os_service_default,
5649 $processing_replicas = $::os_service_default,
5750 $package_ensure = 'present',
58 # DEPRECATED PARAMETERS
59 $cleanup_delay = undef,
6051 ) inherits gnocchi::params {
6152
6253 include gnocchi::deps
63
64 if $cleanup_delay != undef {
65 warning('The cleanup_delay parameter is deprecated. Use metric_cleanup_delay instead')
66 }
6754
6855 gnocchi_config {
6956 'metricd/workers': value => $workers;
7057 'metricd/metric_processing_delay': value => $metric_processing_delay;
7158 'metricd/greedy': value => $greedy;
7259 'metricd/metric_reporting_delay': value => $metric_reporting_delay;
73 'metricd/metric_cleanup_delay': value => pick($cleanup_delay, $metric_cleanup_delay);
60 'metricd/metric_cleanup_delay': value => $metric_cleanup_delay;
7461 'metricd/processing_replicas': value => $processing_replicas;
7562 }
7663
44 # [*resource_id*]
55 # (required) Resource UUID to use to identify statsd in Gnocchi.
66 #
7 # [*host*]
8 # (optional) The listen IP for statsd.
9 # Defaults to $::os_service_default
10 #
11 # [*port*]
12 # (optional) The port for statsd.
13 # Defaults to $::os_service_default.
14 #
715 # [*flush_delay*]
816 # (optional) Delay between flushes.
917 # Defaults to $::os_service_default
18 #
19 # [*archive_policy_name*]
20 # (optional) Archive policy name to use when creating metrics.
21 # Defaults to $::os_service_default.
22 #
23 # [*creator*]
24 # (required) Creator value to use to identify statsd in Gnocchi.
25 # Defaults to $::os_service_default.
1026 #
1127 # [*enabled*]
1228 # (optional) Should the service be enabled.
2036 # (optional) Whether the service should be managed by Puppet.
2137 # Defaults to true.
2238 #
23 # [*archive_policy_name*]
24 # (optional) Archive policy name to use when creating metrics.
25 # Defaults to $::os_service_default.
26 #
2739 class gnocchi::statsd (
2840 $resource_id,
41 $host = $::os_service_default,
42 $port = $::os_service_default,
2943 $flush_delay = $::os_service_default,
3044 $archive_policy_name = $::os_service_default,
45 $creator = $::os_service_default,
3146 $manage_service = true,
3247 $enabled = true,
3348 $package_ensure = 'present',
6075
6176 gnocchi_config {
6277 'statsd/resource_id' : value => $resource_id;
78 'statsd/host' : value => $host;
79 'statsd/port' : value => $port;
80 'statsd/flush_delay' : value => $flush_delay;
6381 'statsd/archive_policy_name' : value => $archive_policy_name;
64 'statsd/flush_delay' : value => $flush_delay;
82 'statsd/creator' : value => $creator;
6583 }
6684
6785 }
2626 #
2727 # [*manage_boto3*]
2828 # (optional) Manage boto3 package.
29 # Defaoutls to true
29 # Defaults to true
3030 #
3131 # [*package_ensure*]
3232 # (optional) The state of boto3 package.
2323 #
2424 # == Parameters
2525 #
26 # [*servername*]
27 # The servername for the virtualhost.
28 # Optional. Defaults to $::fqdn
29 #
30 # [*port*]
31 # The port.
32 # Optional. Defaults to 8041
33 #
34 # [*bind_host*]
35 # The host/ip address Apache will listen on.
36 # Optional. Defaults to undef (listen on all ip addresses).
37 #
38 # [*path*]
39 # The prefix for the endpoint.
40 # Optional. Defaults to '/'
41 #
42 # [*ssl*]
43 # Use ssl ? (boolean)
44 # Optional. Defaults to true
45 #
46 # [*workers*]
47 # Number of WSGI workers to spawn.
48 # Optional. Defaults to $::os_workers
49 #
50 # [*priority*]
51 # (optional) The priority for the vhost.
52 # Defaults to '10'
53 #
54 # [*threads*]
55 # (optional) The number of threads for the vhost.
56 # Defaults to 1
57 #
58 # [*wsgi_process_display_name*]
59 # (optional) Name of the WSGI process display-name.
60 # Defaults to undef
61 #
62 # [*ssl_cert*]
63 # [*ssl_key*]
64 # [*ssl_chain*]
65 # [*ssl_ca*]
66 # [*ssl_crl_path*]
67 # [*ssl_crl*]
68 # [*ssl_certs_dir*]
69 # apache::vhost ssl parameters.
70 # Optional. Default to apache::vhost 'ssl_*' defaults.
71 #
72 # [*access_log_file*]
73 # The log file name for the virtualhost.
74 # Optional. Defaults to false.
75 #
76 # [*access_log_format*]
77 # The log format for the virtualhost.
78 # Optional. Defaults to false.
79 #
80 # [*error_log_file*]
81 # The error log file name for the virtualhost.
82 # Optional. Defaults to undef.
83 #
84 # [*custom_wsgi_process_options*]
85 # (optional) gives you the oportunity to add custom process options or to
86 # overwrite the default options for the WSGI main process.
87 # eg. to use a virtual python environment for the WSGI process
88 # you could set it to:
89 # { python-path => '/my/python/virtualenv' }
90 # Defaults to {}
91 #
92 # [*vhost_custom_fragment*]
93 # (optional) Passes a string of custom configuration
94 # directives to be placed at the end of the vhost configuration.
95 # Defaults to undef.
26 # [*servername*]
27 # (Optional) The servername for the virtualhost.
28 # Defaults to $::fqdn
29 #
30 # [*port*]
31 # (Optional) The port.
32 # Defaults to 8041
33 #
34 # [*bind_host*]
35 # (Optional) The host/ip address Apache will listen on.
36 # Defaults to undef (listen on all ip addresses).
37 #
38 # [*path*]
39 # (Optional) The prefix for the endpoint.
40 # Defaults to '/'
41 #
42 # [*ssl*]
43 # (Optional) Use ssl ? (boolean)
44 # Defaults to false
45 #
46 # [*workers*]
47 # (Optional) Number of WSGI workers to spawn.
48 # Defaults to $::os_workers
49 #
50 # [*priority*]
51 # (Optional) The priority for the vhost.
52 # Defaults to 10
53 #
54 # [*threads*]
55 # (Optional) The number of threads for the vhost.
56 # Defaults to 1
57 #
58 # [*wsgi_process_display_name*]
59 # (Optional) Name of the WSGI process display-name.
60 # Defaults to undef
61 #
62 # [*ssl_cert*]
63 # [*ssl_key*]
64 # [*ssl_chain*]
65 # [*ssl_ca*]
66 # [*ssl_crl_path*]
67 # [*ssl_crl*]
68 # [*ssl_certs_dir*]
69 # (Optional) apache::vhost ssl parameters.
70 # Default to apache::vhost 'ssl_*' defaults.
71 #
72 # [*access_log_file*]
73 # (Optional) The log file name for the virtualhost.
74 # Defaults to undef.
75 #
76 # [*access_log_pipe*]
77 # (Optional) Specifies a pipe where Apache sends access logs for
78 # the virtualhost.
79 # Defaults to undef.
80 #
81 # [*access_log_syslog*]
82 # (Optional) Sends the virtualhost access log messages to syslog.
83 # Defaults to undef.
84 #
85 # [*access_log_format*]
86 # (Optional) The log format for the virtualhost.
87 # Defaults to undef.
88 #
89 # [*error_log_file*]
90 # (Optional) The error log file name for the virtualhost.
91 # Defaults to undef.
92 #
93 # [*error_log_pipe*]
94 # (Optional) Specifies a pipe where Apache sends error logs for
95 # the virtualhost.
96 # Defaults to undef.
97 #
98 # [*error_log_syslog*]
99 # (Optional) Sends the virtualhost error log messages to syslog.
100 # Defaults to undef.
101 #
102 # [*custom_wsgi_process_options*]
103 # (Optional) gives you the opportunity to add custom process options or to
104 # overwrite the default options for the WSGI main process.
105 # eg. to use a virtual python environment for the WSGI process
106 # you could set it to:
107 # { python-path => '/my/python/virtualenv' }
108 # Defaults to {}
109 #
110 # [*headers*]
111 # (Optional) Headers for the vhost.
112 # Defaults to undef
113 #
114 # [*request_headers*]
115 # (Optional) Modifies collected request headers in various ways.
116 # Defaults to undef
117 #
118 # [*vhost_custom_fragment*]
119 # (Optional) Passes a string of custom configuration
120 # directives to be placed at the end of the vhost configuration.
121 # Defaults to undef.
96122 #
97123 # == Dependencies
98124 #
109135 $port = 8041,
110136 $bind_host = undef,
111137 $path = '/',
112 $ssl = undef,
138 $ssl = false,
113139 $workers = $::os_workers,
114140 $ssl_cert = undef,
115141 $ssl_key = undef,
120146 $ssl_certs_dir = undef,
121147 $wsgi_process_display_name = undef,
122148 $threads = 1,
123 $priority = '10',
124 $access_log_file = false,
125 $access_log_format = false,
149 $priority = 10,
150 $access_log_file = undef,
151 $access_log_pipe = undef,
152 $access_log_syslog = undef,
153 $access_log_format = undef,
126154 $error_log_file = undef,
155 $error_log_pipe = undef,
156 $error_log_syslog = undef,
127157 $custom_wsgi_process_options = {},
158 $headers = undef,
159 $request_headers = undef,
128160 $vhost_custom_fragment = undef,
129161 ) {
130
131 if $ssl == undef {
132 warning('Default of the ssl parameter will be changed in a future release')
133 }
134 $ssl_real = pick($ssl, true)
135162
136163 include gnocchi::deps
137164 include gnocchi::params
145172 path => $path,
146173 priority => $priority,
147174 servername => $servername,
148 ssl => $ssl_real,
175 ssl => $ssl,
149176 ssl_ca => $ssl_ca,
150177 ssl_cert => $ssl_cert,
151178 ssl_certs_dir => $ssl_certs_dir,
163190 wsgi_script_dir => $::gnocchi::params::gnocchi_wsgi_script_path,
164191 wsgi_script_file => 'app',
165192 wsgi_script_source => $::gnocchi::params::gnocchi_wsgi_script_source,
193 headers => $headers,
194 request_headers => $request_headers,
195 custom_wsgi_process_options => $custom_wsgi_process_options,
166196 access_log_file => $access_log_file,
197 access_log_pipe => $access_log_pipe,
198 access_log_syslog => $access_log_syslog,
167199 access_log_format => $access_log_format,
168200 error_log_file => $error_log_file,
169 custom_wsgi_process_options => $custom_wsgi_process_options,
201 error_log_pipe => $error_log_pipe,
202 error_log_syslog => $error_log_syslog,
170203 }
171204 }
66 },
77 {
88 "name": "openstack/keystone",
9 "version_requirement": ">=20.3.0 <21.0.0"
9 "version_requirement": ">=21.0.0 <22.0.0"
1010 },
1111 {
1212 "name": "puppetlabs/stdlib",
1414 },
1515 {
1616 "name": "openstack/openstacklib",
17 "version_requirement": ">=20.3.0 <21.0.0"
17 "version_requirement": ">=21.0.0 <22.0.0"
1818 },
1919 {
2020 "name": "openstack/oslo",
21 "version_requirement": ">=20.3.0 <21.0.0"
21 "version_requirement": ">=21.0.0 <22.0.0"
2222 }
2323 ],
2424 "description": "Installs and configures OpenStack Gnocchi (Metric & index storage API).",
3535 {
3636 "operatingsystem": "RedHat",
3737 "operatingsystemrelease": [
38 "8",
3938 "9"
4039 ]
4140 },
4241 {
4342 "operatingsystem": "CentOS",
4443 "operatingsystemrelease": [
45 "8",
4644 "9"
4745 ]
4846 },
6260 ],
6361 "source": "https://opendev.org/openstack/puppet-gnocchi.git",
6462 "summary": "Puppet module for OpenStack Gnocchi",
65 "version": "20.3.0"
63 "version": "21.0.0"
6664 }
0 ---
1 features:
2 - |
3 The ``gnocchi::wsgi::apache`` class now supports customizing
4 request/response headers added by apache.
0 ---
1 upgrade:
2 - |
3 Default value of the ``gnocchi::wsgi::apache::ssl`` parameter has been
4 changed from ``true`` to ``false`` and now ssl is disabled by default.
0 ---
1 features:
2 - |
3 Added parameters for advanced configuration of httpd access and error log
4 destinations including piped logging and syslog (see `mod_syslog`). Note
5 that mod_syslog requires Apache2 >= 2.5.0.
0 ---
1 upgrade:
2 - |
3 The ``gnocchi::api::middleware`` parameter has been removed.
0 ---
1 upgrade:
2 - |
3 CentOS 8 Stream is no longer supported by this module.
0 ---
1 upgrade:
2 - |
3 The ``gnocchi::metricd::cleanup_delay`` parameter has been removed. Use
4 the ``metric_cleanup_delay`` parameter instead.
0 ---
1 features:
2 - |
3 The new ``gnocchi::statsd::creator`` parameter has been added.
0 ---
1 features:
2 - |
3 The ``gnocchi::statsd`` class now supports ``host`` and ``port``.
88 :maxdepth: 2
99
1010 unreleased
11 yoga
1112 xena
1213 wallaby
1314 victoria
0 =========================
1 Yoga Series Release Notes
2 =========================
3
4 .. release-notes::
5 :branch: stable/yoga
0 require 'spec_helper_acceptance'
1
2 describe 'basic gnocchi' do
3
4 context 'default parameters' do
5
6 it 'should work with no errors' do
7 pp = <<-EOS
8 include openstack_integration
9 include openstack_integration::repos
10 include openstack_integration::apache
11 include openstack_integration::mysql
12 include openstack_integration::memcached
13 include openstack_integration::redis
14 include openstack_integration::keystone
15 class { 'openstack_integration::gnocchi':
16 integration_enable => false,
17 }
18 EOS
19
20 # Run it twice and test for idempotency
21 apply_manifest(pp, :catch_failures => true)
22 apply_manifest(pp, :catch_changes => true)
23 end
24
25 describe port(8041) do
26 it { is_expected.to be_listening }
27 end
28
29 end
30 end
0 require 'spec_helper_acceptance'
1
2 describe 'basic gnocchi_config resource' do
3
4 context 'default parameters' do
5
6 it 'should work with no errors' do
7 pp= <<-EOS
8 Exec { logoutput => 'on_failure' }
9
10 File <||> -> Gnocchi_config <||>
11 File <||> -> Gnocchi_api_paste_ini <||>
12
13 file { '/etc/gnocchi' :
14 ensure => directory,
15 }
16 file { '/etc/gnocchi/gnocchi.conf' :
17 ensure => file,
18 }
19 file { '/etc/gnocchi/api-paste.ini' :
20 ensure => file,
21 }
22
23 gnocchi_config { 'DEFAULT/thisshouldexist' :
24 value => 'foo',
25 }
26
27 gnocchi_config { 'DEFAULT/thisshouldnotexist' :
28 value => '<SERVICE DEFAULT>',
29 }
30
31 gnocchi_config { 'DEFAULT/thisshouldexist2' :
32 value => '<SERVICE DEFAULT>',
33 ensure_absent_val => 'toto',
34 }
35
36 gnocchi_config { 'DEFAULT/thisshouldexist3' :
37 value => ['foo', 'bar'],
38 }
39
40 gnocchi_config { 'DEFAULT/thisshouldnotexist2' :
41 value => 'toto',
42 ensure_absent_val => 'toto',
43 }
44
45 gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist' :
46 value => 'foo',
47 }
48
49 gnocchi_api_paste_ini { 'DEFAULT/thisshouldnotexist' :
50 value => '<SERVICE DEFAULT>',
51 }
52
53 gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist2' :
54 value => '<SERVICE DEFAULT>',
55 ensure_absent_val => 'toto',
56 }
57
58 gnocchi_api_paste_ini { 'DEFAULT/thisshouldnotexist2' :
59 value => 'toto',
60 ensure_absent_val => 'toto',
61 }
62
63 gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist3' :
64 value => 'foo',
65 key_val_separator => ':'
66 }
67 EOS
68
69
70 # Run it twice and test for idempotency
71 apply_manifest(pp, :catch_failures => true)
72 apply_manifest(pp, :catch_changes => true)
73 end
74
75 describe file('/etc/gnocchi/gnocchi.conf') do
76 it { is_expected.to exist }
77 it { is_expected.to contain('thisshouldexist=foo') }
78 it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
79 it { is_expected.to contain('thisshouldexist3=foo') }
80 it { is_expected.to contain('thisshouldexist3=bar') }
81
82 describe '#content' do
83 subject { super().content }
84 it { is_expected.to_not match /thisshouldnotexist/ }
85 end
86 end
87
88 describe file('/etc/gnocchi/api-paste.ini') do
89 it { is_expected.to exist }
90 it { is_expected.to contain('thisshouldexist=foo') }
91 it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
92 it { is_expected.to contain('thisshouldexist3:foo') }
93
94 describe '#content' do
95 subject { super().content }
96 it { is_expected.to_not match /thisshouldnotexist/ }
97 end
98 end
99 end
100 end
+0
-29
spec/acceptance/basic_gnocchi_spec.rb less more
0 require 'spec_helper_acceptance'
1
2 describe 'basic gnocchi' do
3
4 context 'default parameters' do
5
6 it 'should work with no errors' do
7 pp = <<-EOS
8 include openstack_integration
9 include openstack_integration::repos
10 include openstack_integration::apache
11 include openstack_integration::mysql
12 include openstack_integration::keystone
13 class { 'openstack_integration::gnocchi':
14 integration_enable => false,
15 }
16 EOS
17
18 # Run it twice and test for idempotency
19 apply_manifest(pp, :catch_failures => true)
20 apply_manifest(pp, :catch_changes => true)
21 end
22
23 describe port(8041) do
24 it { is_expected.to be_listening }
25 end
26
27 end
28 end
6060 is_expected.to contain_gnocchi_config('api/auth_mode').with_value('keystone')
6161 is_expected.to contain_gnocchi_config('api/paste_config').with_value('<SERVICE DEFAULT>')
6262 is_expected.to contain_gnocchi_config('api/operation_timeout').with_value('<SERVICE DEFAULT>')
63 is_expected.to contain_gnocchi_config('api/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
6364 is_expected.to contain_oslo__middleware('gnocchi_config').with(
64 :enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
65 :max_request_body_size => '<SERVICE DEFAULT>',
65 :max_request_body_size => '<SERVICE DEFAULT>',
6666 )
6767 end
6868
177177 params.merge!({:enable_proxy_headers_parsing => true })
178178 end
179179
180 it { is_expected.to contain_oslo__middleware('gnocchi_config').with(
181 :enable_proxy_headers_parsing => true,
182 )}
180 it { is_expected.to contain_gnocchi_config('api/enable_proxy_headers_parsing').with_value(true) }
183181 end
184182
185183 context 'with max_request_body_size' do
3434 context "on #{os}" do
3535 let (:facts) do
3636 facts.merge(OSDefaults.get_facts({
37 :os_workers => 8,
38 :concat_basedir => '/var/lib/puppet/concat'
37 # puppet-postgresql requires the service_provider fact provided by
38 # puppetlabs-postgresql.
39 :service_provider => 'systemd'
3940 }))
4041 end
4142
42 # TODO(tkajinam): Remove this once puppet-postgresql supports CentOS 9
43 unless facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease].to_i >= 9
44 it_configures 'gnocchi::db::postgresql'
45 end
43 it_configures 'gnocchi::db::postgresql'
4644 end
4745 end
4846
102102 }).each do |os,facts|
103103 context "on #{os}" do
104104 let (:facts) do
105 facts.merge!(OSDefaults.get_facts())
105 facts.merge!(OSDefaults.get_facts({
106 # puppet-postgresql requires the service_provider fact provided by
107 # puppetlabs-postgresql.
108 :service_provider => 'systemd'
109 }))
106110 end
107111
108112 let(:platform_params) do
114118 end
115119 end
116120
117 # TODO(tkajinam): Remove this once puppet-postgresql supports CentOS 9
118 unless facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease].to_i >= 9
119 it_behaves_like 'gnocchi::db'
120 end
121 it_behaves_like 'gnocchi::db'
121122 it_behaves_like "gnocchi::db on #{facts[:osfamily]}"
122123 end
123124 end
3535 end
3636 end
3737
38 context 'with overriden parameters' do
38 context 'with overridden parameters' do
3939 let :params do
4040 { :purge_config => true,
4141 :coordination_url => 'redis://localhost:6379', }
4747 })
4848 end
4949
50 it 'cnfigures coordination' do
50 it 'configures coordination' do
5151 is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379')
5252 is_expected.to contain_oslo__coordination('gnocchi_config').with(
5353 :backend_url => 'redis://localhost:6379',
2323
2424 it 'configures gnocchi statsd' do
2525 is_expected.to contain_gnocchi_config('statsd/resource_id').with_value('07f26121-5777-48ba-8a0b-d70468133dd9')
26 is_expected.to contain_gnocchi_config('statsd/host').with_value('<SERVICE DEFAULT>')
27 is_expected.to contain_gnocchi_config('statsd/port').with_value('<SERVICE DEFAULT>')
2628 is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('<SERVICE DEFAULT>')
2729 is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('<SERVICE DEFAULT>')
30 is_expected.to contain_gnocchi_config('statsd/creator').with_value('<SERVICE DEFAULT>')
2831 end
2932
3033 [{:enabled => true}, {:enabled => false}].each do |param_hash|
5861 end
5962 end
6063
64 context 'whth host and port' do
65 before do
66 params.merge!({
67 :host => '192.0.2.1',
68 :port => 8125,
69 })
70 end
71
72 it 'configures the parameter' do
73 is_expected.to contain_gnocchi_config('statsd/host').with_value('192.0.2.1')
74 is_expected.to contain_gnocchi_config('statsd/port').with_value(8125)
75 end
76 end
77
6178 context 'with flush_delay' do
6279 before do
6380 params.merge!({ :flush_delay => 10 })
7592
7693 it 'configures the parameter' do
7794 is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('high')
95 end
96 end
97
98 context 'with creator' do
99 before do
100 params.merge!({ :creator => 'creator' })
101 end
102
103 it 'configures the parameter' do
104 is_expected.to contain_gnocchi_config('statsd/creator').with_value('creator')
78105 end
79106 end
80107 end
22 describe 'gnocchi::storage' do
33
44 shared_examples_for 'gnocchi-storage' do
5 # Nothong to test
5 # Nothing to test
66 end
77
88 on_supported_os({
88 :bind_port => 8041,
99 :group => 'gnocchi',
1010 :path => '/',
11 :priority => 10,
1112 :servername => facts[:fqdn],
12 :ssl => true,
13 :ssl => false,
1314 :threads => 1,
1415 :user => 'gnocchi',
1516 :workers => facts[:os_workers],
1819 :wsgi_script_dir => platform_params[:wsgi_script_path],
1920 :wsgi_script_file => 'app',
2021 :wsgi_script_source => platform_params[:wsgi_script_source],
22 :headers => nil,
23 :request_headers => nil,
2124 :custom_wsgi_process_options => {},
22 :access_log_file => false,
23 :access_log_format => false,
25 :access_log_file => nil,
26 :access_log_pipe => nil,
27 :access_log_syslog => nil,
28 :access_log_format => nil,
29 :error_log_file => nil,
30 :error_log_pipe => nil,
31 :error_log_syslog => nil,
2432 )}
2533 end
2634
27 context 'when overriding paramters using different ports' do
35 context 'when overriding parameters' do
2836 let :params do
2937 {
3038 :servername => 'dummy.host',
3139 :bind_host => '10.42.51.1',
3240 :port => 12345,
33 :ssl => false,
41 :ssl => true,
3442 :workers => 8,
3543 :wsgi_process_display_name => 'gnocchi',
3644 :threads => 2,
3745 :custom_wsgi_process_options => {
3846 'python_path' => '/my/python/path',
3947 },
40 :access_log_file => '/var/log/httpd/access_log',
41 :access_log_format => 'some format',
42 :error_log_file => '/var/log/httpd/error_log',
48 :headers => ['set X-XSS-Protection "1; mode=block"'],
49 :request_headers => ['set Content-Type "application/json"'],
4350 :vhost_custom_fragment => 'Timeout 99'
4451 }
4552 end
5158 :group => 'gnocchi',
5259 :path => '/',
5360 :servername => 'dummy.host',
54 :ssl => false,
61 :ssl => true,
5562 :threads => 2,
5663 :user => 'gnocchi',
5764 :vhost_custom_fragment => 'Timeout 99',
6269 :wsgi_script_dir => platform_params[:wsgi_script_path],
6370 :wsgi_script_file => 'app',
6471 :wsgi_script_source => platform_params[:wsgi_script_source],
72 :headers => ['set X-XSS-Protection "1; mode=block"'],
73 :request_headers => ['set Content-Type "application/json"'],
6574 :custom_wsgi_process_options => {
6675 'python_path' => '/my/python/path',
6776 },
68 :access_log_file => '/var/log/httpd/access_log',
69 :access_log_format => 'some format',
70 :error_log_file => '/var/log/httpd/error_log'
77 )}
78 end
79
80 context 'with custom access logging' do
81 let :params do
82 {
83 :access_log_format => 'foo',
84 :access_log_syslog => 'syslog:local0',
85 :error_log_syslog => 'syslog:local1',
86 }
87 end
88
89 it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
90 :access_log_format => params[:access_log_format],
91 :access_log_syslog => params[:access_log_syslog],
92 :error_log_syslog => params[:error_log_syslog],
93 )}
94 end
95
96 context 'with access_log_file' do
97 let :params do
98 {
99 :access_log_file => '/path/to/file',
100 }
101 end
102
103 it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
104 :access_log_file => params[:access_log_file],
105 )}
106 end
107
108 context 'with access_log_pipe' do
109 let :params do
110 {
111 :access_log_pipe => 'pipe',
112 }
113 end
114
115 it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
116 :access_log_pipe => params[:access_log_pipe],
117 )}
118 end
119
120 context 'with error_log_file' do
121 let :params do
122 {
123 :error_log_file => '/path/to/file',
124 }
125 end
126
127 it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
128 :error_log_file => params[:error_log_file],
129 )}
130 end
131
132 context 'with error_log_pipe' do
133 let :params do
134 {
135 :error_log_pipe => 'pipe',
136 }
137 end
138
139 it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
140 :error_log_pipe => params[:error_log_pipe],
71141 )}
72142 end
73143 end
3232 expect(@gnocchi_api_uwsgi_config[:value]).to eq('bar')
3333 end
3434
35 it 'should not accept a value with whitespace' do
35 it 'should accept a value with whitespace' do
3636 @gnocchi_api_uwsgi_config[:value] = 'b ar'
3737 expect(@gnocchi_api_uwsgi_config[:value]).to eq('b ar')
3838 end
3232 expect(@gnocchi_config[:value]).to eq(['bar'])
3333 end
3434
35 it 'should not accept a value with whitespace' do
35 it 'should accept a value with whitespace' do
3636 @gnocchi_config[:value] = 'b ar'
3737 expect(@gnocchi_config[:value]).to eq(['b ar'])
3838 end