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
0 | 0 | Puppet::Type.type(:gnocchi_api_paste_ini).provide( |
1 | 1 | :ini_setting, |
2 | :parent => Puppet::Type.type(:ini_setting).provider(:ruby) | |
2 | :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) | |
3 | 3 | ) 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 | |
16 | 4 | |
17 | 5 | def self.file_path |
18 | 6 | '/etc/gnocchi/api-paste.ini' |
19 | 7 | end |
20 | 8 | |
21 | # added for backwards compatibility with older versions of inifile | |
22 | def file_path | |
23 | self.class.file_path | |
24 | end | |
25 | ||
26 | 9 | end |
54 | 54 | # (Optional) Set max request body size |
55 | 55 | # Defaults to $::os_service_default. |
56 | 56 | # |
57 | # DEPRECATED PARAMETERS | |
58 | # | |
59 | # [*middlewares*] | |
60 | # (optional) Middlewares to use. | |
61 | # Defaults to undef | |
62 | # | |
63 | 57 | class gnocchi::api ( |
64 | 58 | $manage_service = true, |
65 | 59 | $enabled = true, |
72 | 66 | $operation_timeout = $::os_service_default, |
73 | 67 | $enable_proxy_headers_parsing = $::os_service_default, |
74 | 68 | $max_request_body_size = $::os_service_default, |
75 | # DEPRECATED PARAMETERS | |
76 | $middlewares = undef, | |
77 | 69 | ) inherits gnocchi::params { |
78 | 70 | |
79 | 71 | include gnocchi::deps |
80 | 72 | 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 | } | |
88 | 73 | |
89 | 74 | package { 'gnocchi-api': |
90 | 75 | ensure => $package_ensure, |
130 | 115 | } |
131 | 116 | |
132 | 117 | 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; | |
137 | 123 | } |
138 | 124 | |
139 | 125 | 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, | |
142 | 127 | } |
143 | 128 | |
144 | 129 | if $auth_strategy == 'keystone' { |
13 | 13 | # Defaults to $::os_service_default |
14 | 14 | # |
15 | 15 | # [*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 | |
17 | 17 | # is running on a port. |
18 | 18 | # Defaults to $::os_service_default |
19 | 19 | # |
20 | 20 | # [*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 | |
22 | 22 | # is running on a port. Expects a "port:path" list of strings. |
23 | 23 | # Defaults to $::os_service_default |
24 | 24 | # |
55 | 55 | # Defaults to 'gnocchi' |
56 | 56 | # |
57 | 57 | # [*public_url*] |
58 | # (0ptional) The endpoint's public url. | |
58 | # (Optional) The endpoint's public url. | |
59 | 59 | # This url should *not* contain any trailing '/'. |
60 | 60 | # Defaults to 'http://127.0.0.1:8041' |
61 | 61 | # |
14 | 14 | # Defaults to $::os_workers |
15 | 15 | # |
16 | 16 | # [*metric_processing_delay*] |
17 | # (optional) Delay between processng metrics | |
17 | # (optional) Delay between processing metrics | |
18 | 18 | # Defaults to $::os_service_default. |
19 | 19 | # |
20 | 20 | # [*greedy*] |
21 | 21 | # (optional) Allow to bypass metric_processing_delay if metricd is noticed |
22 | 22 | # that messages are ready to be processed. |
23 | # Defaoults to $::os_service_default. | |
23 | # Defaults to $::os_service_default. | |
24 | 24 | # |
25 | 25 | # [*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. | |
27 | 27 | # Defaults to $::os_service_default. |
28 | 28 | # |
29 | 29 | # [*metric_cleanup_delay*] |
38 | 38 | # (optional) Whether the service should be managed by Puppet. |
39 | 39 | # Defaults to true. |
40 | 40 | # |
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 | # | |
48 | 41 | class gnocchi::metricd ( |
49 | 42 | $manage_service = true, |
50 | 43 | $enabled = true, |
55 | 48 | $metric_cleanup_delay = $::os_service_default, |
56 | 49 | $processing_replicas = $::os_service_default, |
57 | 50 | $package_ensure = 'present', |
58 | # DEPRECATED PARAMETERS | |
59 | $cleanup_delay = undef, | |
60 | 51 | ) inherits gnocchi::params { |
61 | 52 | |
62 | 53 | include gnocchi::deps |
63 | ||
64 | if $cleanup_delay != undef { | |
65 | warning('The cleanup_delay parameter is deprecated. Use metric_cleanup_delay instead') | |
66 | } | |
67 | 54 | |
68 | 55 | gnocchi_config { |
69 | 56 | 'metricd/workers': value => $workers; |
70 | 57 | 'metricd/metric_processing_delay': value => $metric_processing_delay; |
71 | 58 | 'metricd/greedy': value => $greedy; |
72 | 59 | '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; | |
74 | 61 | 'metricd/processing_replicas': value => $processing_replicas; |
75 | 62 | } |
76 | 63 |
4 | 4 | # [*resource_id*] |
5 | 5 | # (required) Resource UUID to use to identify statsd in Gnocchi. |
6 | 6 | # |
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 | # | |
7 | 15 | # [*flush_delay*] |
8 | 16 | # (optional) Delay between flushes. |
9 | 17 | # 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. | |
10 | 26 | # |
11 | 27 | # [*enabled*] |
12 | 28 | # (optional) Should the service be enabled. |
20 | 36 | # (optional) Whether the service should be managed by Puppet. |
21 | 37 | # Defaults to true. |
22 | 38 | # |
23 | # [*archive_policy_name*] | |
24 | # (optional) Archive policy name to use when creating metrics. | |
25 | # Defaults to $::os_service_default. | |
26 | # | |
27 | 39 | class gnocchi::statsd ( |
28 | 40 | $resource_id, |
41 | $host = $::os_service_default, | |
42 | $port = $::os_service_default, | |
29 | 43 | $flush_delay = $::os_service_default, |
30 | 44 | $archive_policy_name = $::os_service_default, |
45 | $creator = $::os_service_default, | |
31 | 46 | $manage_service = true, |
32 | 47 | $enabled = true, |
33 | 48 | $package_ensure = 'present', |
60 | 75 | |
61 | 76 | gnocchi_config { |
62 | 77 | 'statsd/resource_id' : value => $resource_id; |
78 | 'statsd/host' : value => $host; | |
79 | 'statsd/port' : value => $port; | |
80 | 'statsd/flush_delay' : value => $flush_delay; | |
63 | 81 | 'statsd/archive_policy_name' : value => $archive_policy_name; |
64 | 'statsd/flush_delay' : value => $flush_delay; | |
82 | 'statsd/creator' : value => $creator; | |
65 | 83 | } |
66 | 84 | |
67 | 85 | } |
26 | 26 | # |
27 | 27 | # [*manage_boto3*] |
28 | 28 | # (optional) Manage boto3 package. |
29 | # Defaoutls to true | |
29 | # Defaults to true | |
30 | 30 | # |
31 | 31 | # [*package_ensure*] |
32 | 32 | # (optional) The state of boto3 package. |
23 | 23 | # |
24 | 24 | # == Parameters |
25 | 25 | # |
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. | |
96 | 122 | # |
97 | 123 | # == Dependencies |
98 | 124 | # |
109 | 135 | $port = 8041, |
110 | 136 | $bind_host = undef, |
111 | 137 | $path = '/', |
112 | $ssl = undef, | |
138 | $ssl = false, | |
113 | 139 | $workers = $::os_workers, |
114 | 140 | $ssl_cert = undef, |
115 | 141 | $ssl_key = undef, |
120 | 146 | $ssl_certs_dir = undef, |
121 | 147 | $wsgi_process_display_name = undef, |
122 | 148 | $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, | |
126 | 154 | $error_log_file = undef, |
155 | $error_log_pipe = undef, | |
156 | $error_log_syslog = undef, | |
127 | 157 | $custom_wsgi_process_options = {}, |
158 | $headers = undef, | |
159 | $request_headers = undef, | |
128 | 160 | $vhost_custom_fragment = undef, |
129 | 161 | ) { |
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) | |
135 | 162 | |
136 | 163 | include gnocchi::deps |
137 | 164 | include gnocchi::params |
145 | 172 | path => $path, |
146 | 173 | priority => $priority, |
147 | 174 | servername => $servername, |
148 | ssl => $ssl_real, | |
175 | ssl => $ssl, | |
149 | 176 | ssl_ca => $ssl_ca, |
150 | 177 | ssl_cert => $ssl_cert, |
151 | 178 | ssl_certs_dir => $ssl_certs_dir, |
163 | 190 | wsgi_script_dir => $::gnocchi::params::gnocchi_wsgi_script_path, |
164 | 191 | wsgi_script_file => 'app', |
165 | 192 | 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, | |
166 | 196 | access_log_file => $access_log_file, |
197 | access_log_pipe => $access_log_pipe, | |
198 | access_log_syslog => $access_log_syslog, | |
167 | 199 | access_log_format => $access_log_format, |
168 | 200 | 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, | |
170 | 203 | } |
171 | 204 | } |
6 | 6 | }, |
7 | 7 | { |
8 | 8 | "name": "openstack/keystone", |
9 | "version_requirement": ">=20.3.0 <21.0.0" | |
9 | "version_requirement": ">=21.0.0 <22.0.0" | |
10 | 10 | }, |
11 | 11 | { |
12 | 12 | "name": "puppetlabs/stdlib", |
14 | 14 | }, |
15 | 15 | { |
16 | 16 | "name": "openstack/openstacklib", |
17 | "version_requirement": ">=20.3.0 <21.0.0" | |
17 | "version_requirement": ">=21.0.0 <22.0.0" | |
18 | 18 | }, |
19 | 19 | { |
20 | 20 | "name": "openstack/oslo", |
21 | "version_requirement": ">=20.3.0 <21.0.0" | |
21 | "version_requirement": ">=21.0.0 <22.0.0" | |
22 | 22 | } |
23 | 23 | ], |
24 | 24 | "description": "Installs and configures OpenStack Gnocchi (Metric & index storage API).", |
35 | 35 | { |
36 | 36 | "operatingsystem": "RedHat", |
37 | 37 | "operatingsystemrelease": [ |
38 | "8", | |
39 | 38 | "9" |
40 | 39 | ] |
41 | 40 | }, |
42 | 41 | { |
43 | 42 | "operatingsystem": "CentOS", |
44 | 43 | "operatingsystemrelease": [ |
45 | "8", | |
46 | 44 | "9" |
47 | 45 | ] |
48 | 46 | }, |
62 | 60 | ], |
63 | 61 | "source": "https://opendev.org/openstack/puppet-gnocchi.git", |
64 | 62 | "summary": "Puppet module for OpenStack Gnocchi", |
65 | "version": "20.3.0" | |
63 | "version": "21.0.0" | |
66 | 64 | } |
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::metricd::cleanup_delay`` parameter has been removed. Use | |
4 | the ``metric_cleanup_delay`` parameter instead. |
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 | 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 |
60 | 60 | is_expected.to contain_gnocchi_config('api/auth_mode').with_value('keystone') |
61 | 61 | is_expected.to contain_gnocchi_config('api/paste_config').with_value('<SERVICE DEFAULT>') |
62 | 62 | 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>') | |
63 | 64 | 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>', | |
66 | 66 | ) |
67 | 67 | end |
68 | 68 | |
177 | 177 | params.merge!({:enable_proxy_headers_parsing => true }) |
178 | 178 | end |
179 | 179 | |
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) } | |
183 | 181 | end |
184 | 182 | |
185 | 183 | context 'with max_request_body_size' do |
34 | 34 | context "on #{os}" do |
35 | 35 | let (:facts) do |
36 | 36 | 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' | |
39 | 40 | })) |
40 | 41 | end |
41 | 42 | |
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' | |
46 | 44 | end |
47 | 45 | end |
48 | 46 |
102 | 102 | }).each do |os,facts| |
103 | 103 | context "on #{os}" do |
104 | 104 | 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 | })) | |
106 | 110 | end |
107 | 111 | |
108 | 112 | let(:platform_params) do |
114 | 118 | end |
115 | 119 | end |
116 | 120 | |
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' | |
121 | 122 | it_behaves_like "gnocchi::db on #{facts[:osfamily]}" |
122 | 123 | end |
123 | 124 | end |
35 | 35 | end |
36 | 36 | end |
37 | 37 | |
38 | context 'with overriden parameters' do | |
38 | context 'with overridden parameters' do | |
39 | 39 | let :params do |
40 | 40 | { :purge_config => true, |
41 | 41 | :coordination_url => 'redis://localhost:6379', } |
47 | 47 | }) |
48 | 48 | end |
49 | 49 | |
50 | it 'cnfigures coordination' do | |
50 | it 'configures coordination' do | |
51 | 51 | is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379') |
52 | 52 | is_expected.to contain_oslo__coordination('gnocchi_config').with( |
53 | 53 | :backend_url => 'redis://localhost:6379', |
23 | 23 | |
24 | 24 | it 'configures gnocchi statsd' do |
25 | 25 | 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>') | |
26 | 28 | is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('<SERVICE DEFAULT>') |
27 | 29 | 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>') | |
28 | 31 | end |
29 | 32 | |
30 | 33 | [{:enabled => true}, {:enabled => false}].each do |param_hash| |
58 | 61 | end |
59 | 62 | end |
60 | 63 | |
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 | ||
61 | 78 | context 'with flush_delay' do |
62 | 79 | before do |
63 | 80 | params.merge!({ :flush_delay => 10 }) |
75 | 92 | |
76 | 93 | it 'configures the parameter' do |
77 | 94 | 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') | |
78 | 105 | end |
79 | 106 | end |
80 | 107 | end |
2 | 2 | describe 'gnocchi::storage' do |
3 | 3 | |
4 | 4 | shared_examples_for 'gnocchi-storage' do |
5 | # Nothong to test | |
5 | # Nothing to test | |
6 | 6 | end |
7 | 7 | |
8 | 8 | on_supported_os({ |
8 | 8 | :bind_port => 8041, |
9 | 9 | :group => 'gnocchi', |
10 | 10 | :path => '/', |
11 | :priority => 10, | |
11 | 12 | :servername => facts[:fqdn], |
12 | :ssl => true, | |
13 | :ssl => false, | |
13 | 14 | :threads => 1, |
14 | 15 | :user => 'gnocchi', |
15 | 16 | :workers => facts[:os_workers], |
18 | 19 | :wsgi_script_dir => platform_params[:wsgi_script_path], |
19 | 20 | :wsgi_script_file => 'app', |
20 | 21 | :wsgi_script_source => platform_params[:wsgi_script_source], |
22 | :headers => nil, | |
23 | :request_headers => nil, | |
21 | 24 | :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, | |
24 | 32 | )} |
25 | 33 | end |
26 | 34 | |
27 | context 'when overriding paramters using different ports' do | |
35 | context 'when overriding parameters' do | |
28 | 36 | let :params do |
29 | 37 | { |
30 | 38 | :servername => 'dummy.host', |
31 | 39 | :bind_host => '10.42.51.1', |
32 | 40 | :port => 12345, |
33 | :ssl => false, | |
41 | :ssl => true, | |
34 | 42 | :workers => 8, |
35 | 43 | :wsgi_process_display_name => 'gnocchi', |
36 | 44 | :threads => 2, |
37 | 45 | :custom_wsgi_process_options => { |
38 | 46 | 'python_path' => '/my/python/path', |
39 | 47 | }, |
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"'], | |
43 | 50 | :vhost_custom_fragment => 'Timeout 99' |
44 | 51 | } |
45 | 52 | end |
51 | 58 | :group => 'gnocchi', |
52 | 59 | :path => '/', |
53 | 60 | :servername => 'dummy.host', |
54 | :ssl => false, | |
61 | :ssl => true, | |
55 | 62 | :threads => 2, |
56 | 63 | :user => 'gnocchi', |
57 | 64 | :vhost_custom_fragment => 'Timeout 99', |
62 | 69 | :wsgi_script_dir => platform_params[:wsgi_script_path], |
63 | 70 | :wsgi_script_file => 'app', |
64 | 71 | :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"'], | |
65 | 74 | :custom_wsgi_process_options => { |
66 | 75 | 'python_path' => '/my/python/path', |
67 | 76 | }, |
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], | |
71 | 141 | )} |
72 | 142 | end |
73 | 143 | end |
32 | 32 | expect(@gnocchi_api_uwsgi_config[:value]).to eq('bar') |
33 | 33 | end |
34 | 34 | |
35 | it 'should not accept a value with whitespace' do | |
35 | it 'should accept a value with whitespace' do | |
36 | 36 | @gnocchi_api_uwsgi_config[:value] = 'b ar' |
37 | 37 | expect(@gnocchi_api_uwsgi_config[:value]).to eq('b ar') |
38 | 38 | end |