diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0a80bbc..0d6073c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,45 +23,34 @@ jobs: strategy: matrix: os: - - "debian-9" - - "debian-10" + - "debian-11" + - "debian-12" - "ubuntu-2004" - "ubuntu-2204" - - "centos-7" - - "centos-8" - "centos-stream-8" + - "centos-stream-9" - "fedora-latest" suite: + - config-1-userlist + - config-1 + - config-2 + - config-3 + - config-4 + - config-acl + - config-array + - config-backend-search + - config-custom-template + - config-fastcgi + - config-resolver + - config-ssl-redirect - "package" - - "source-18" - - "source-20" - - "source-22" - - "source-default" + - "source-24" + - "source-26" + - "source-28" + - "source-29" + - "source-lua" - "source-openssl" - exclude: - # Excluded due to https://github.com/sous-chefs/haproxy/issues/475 - - os: "fedora-latest" - suite: "source-18" - - os: "fedora-latest" - suite: "source-20" - - os: "fedora-latest" - suite: "source-22" - - os: "fedora-latest" - suite: "source-default" - - os: "fedora-latest" - suite: "source-openssl" - - os: "ubuntu-2204" - suite: "source-18" - - os: "ubuntu-2204" - suite: "source-20" - - os: "ubuntu-2204" - suite: "source-22" - - os: "ubuntu-2204" - suite: "source-24" - - os: "ubuntu-2204" - suite: "source-default" - - os: "ubuntu-2204" - suite: "source-openssl" + - "source-default" fail-fast: false steps: @@ -84,12 +73,13 @@ jobs: strategy: matrix: os: - - "amazonlinux-2" + - "amazonlinux-2023" suite: - "package" - - "source-18" - - "source-20" - - "source-22" + - "source-24" + - "source-26" + - "source-28" + - "source-29" - "source-default" fail-fast: false diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/CHANGELOG.md b/CHANGELOG.md index d04d28fa..5a10ed25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This file is used to list changes made in each version of the haproxy cookbook. ## Unreleased +- Update default HAProxy source install verision to 2.8.5 +- Update source install tests to include versions 2.4, 2.6, 2.8, 2.9 + ## 12.2.23 - *2023-10-26* ## 12.2.22 - *2023-09-28* @@ -392,18 +395,6 @@ Standardise files with files in sous-chefs/repo-management - `foodcritic` warning for not defining `name_property`. -## [v5.0.2] (2017-11-29) - -### Fixed - -- Typo in listen section, makes previously unprintable expressions, printable in http-request, http-response and `default_backend`. - -## [v5.0.1] (2017-08-10) - -### Removed - -- useless blank space in generated config file haproxy.cfg - ## [v5.0.0] (2017-08-07) ### Added @@ -633,7 +624,7 @@ Standardise files with files in sous-chefs/repo-management - New haproxy_config resource - Guardfile - Testing in Travis CI with a Rakefile that runs cookstyle, foodcritic, and ChefSpec as well as a Kitchen Dokken config that does integration testing of the package install -- New node['haproxy']['pool_members'] and node['haproxy']['pool_members_option'] attributes +- New `node['haproxy']['pool_members']` and `node['haproxy']['pool_members_option']` attributes ### Changed @@ -682,11 +673,11 @@ Standardise files with files in sous-chefs/repo-management ### Added -- [COOK-3135](https://tickets.chef.io/browse/COOK-3135) - Allow setting of members with default recipe without changing the template. +- Allow setting of members with default recipe without changing the template. ### Fixed -- [COOK-3424](https://tickets.chef.io/browse/COOK-3424) - Haproxy cookbook attempts to alter an immutable attribute. +- Haproxy cookbook attempts to alter an immutable attribute. ## v1.6.0 @@ -698,18 +689,18 @@ Standardise files with files in sous-chefs/repo-management ### Added -- [COOK-3660](https://tickets.chef.io/browse/COOK-3660) - Make haproxy socket default user group configurable -- [COOK-3537](https://tickets.chef.io/browse/COOK-3537) - Add OpenSSL and zlib source configurations -- [COOK-2384](https://tickets.chef.io/browse/COOK-2384) - Add LWRP for multiple haproxy sites/configs +- Make haproxy socket default user group configurable +- Add OpenSSL and zlib source configurations +- Add LWRP for multiple haproxy sites/configs ## v1.4.0 ### Added -- [COOK-3237](https://tickets.chef.io/browse/COOK-3237) - Enable cookie-based persistence in a backend -- [COOK-3216](https://tickets.chef.io/browse/COOK-3216) - Metadata attributes -- [COOK-3211](https://tickets.chef.io/browse/COOK-3211) - Support RHEL -- [COOK-3133](https://tickets.chef.io/browse/COOK-3133) - Allow configuration of a global stats socket +- Enable cookie-based persistence in a backend +- Metadata attributes +- Support RHEL +- Allow configuration of a global stats socket ## v1.3.2 @@ -812,8 +803,6 @@ Standardise files with files in sous-chefs/repo-management [v4.6.0]: https://github.com/sous-chefs/haproxy/compare/v4.5.0...v4.6.0 [v4.6.1]: https://github.com/sous-chefs/haproxy/compare/v4.6.0...v4.6.1 [v5.0.0]: https://github.com/sous-chefs/haproxy/compare/v4.6.1...v5.0.0 -[v5.0.1]: https://github.com/sous-chefs/haproxy/compare/v5.0.0...v5.0.1 -[v5.0.2]: https://github.com/sous-chefs/haproxy/compare/v5.0.1...v5.0.2 [v5.0.3]: https://github.com/sous-chefs/haproxy/compare/v5.0.2...v5.0.3 [v5.0.4]: https://github.com/sous-chefs/haproxy/compare/v5.0.3...v5.0.4 [v6.0.0]: https://github.com/sous-chefs/haproxy/compare/v5.0.4...v6.0.0 diff --git a/Dangerfile b/Dangerfile index bc08b7ae..a31ad760 100644 --- a/Dangerfile +++ b/Dangerfile @@ -37,7 +37,7 @@ if !git.modified_files.include?('CHANGELOG.md') && code_changes? end # Require Major Minor Patch version labels -unless github.pr_labels.grep /minor|major|patch/i +unless github.pr_labels.grep(/minor|major|patch/i) warn 'Please add a release label to this pull request' end diff --git a/Guardfile b/Guardfile index 06cd4bf8..2679a2fa 100644 --- a/Guardfile +++ b/Guardfile @@ -1,25 +1,25 @@ -require 'cookstyle' +require "cookstyle" -guard :rubocop, keep_failed: false, cli: '-r finstyle' do +guard :rubocop, keep_failed: false, cli: "-r finstyle" do watch(/.+\.rb$/) { |m| m[0] } watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } end -guard 'foodcritic', cookbook_paths: '.', cli: '-C -t ~FC001' do +guard "foodcritic", cookbook_paths: ".", cli: "-C -t ~FC001" do watch(%r{attributes/.+\.rb$}) watch(%r{providers/.+\.rb$}) watch(%r{recipes/.+\.rb$}) watch(%r{resources/.+\.rb$}) end -spec_path = 'test/unit' +spec_path = "test/unit" rspec_guard_config = { cmd: "bundle exec rspec --color --format progress --default-path=#{spec_path}", all_on_start: true, spec_paths: [spec_path], } -guard 'rspec', rspec_guard_config do +guard "rspec", rspec_guard_config do watch(%r{^#{spec_path}/.+_spec\.rb$}) watch("#{spec_path}/spec_helper.rb") { spec_path } watch(%r{^(libraries|providers|recipes|resources)/(.+)\.rb$}) do |m| diff --git a/documentation/haproxy_acl.md b/documentation/haproxy_acl.md index 4b8a70e2..3279d18d 100644 --- a/documentation/haproxy_acl.md +++ b/documentation/haproxy_acl.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_acl +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Access Control Lists creates a new ACL `` or completes an existing one with new tests. The actions generally consist in blocking a request, selecting a backend, or adding a header. @@ -17,11 +15,11 @@ Introduced: v4.2.0 ## Properties -| Name | Type | Default | Description | Allowed Values | -| -------------- | ------------- | -------------------------- | ------------------------------------------------------------ | ------------------------------- | -| `acl` | String, Array | None | The access control list items | Allowed HAProxy acl values | -| `section` | String | None | The section where the acl(s) should be applied | `frontend`, `listen`, `backend` | -| `section_name` | String | None | The name of the specific frontend, listen or backend section | +| Name | Type | Default | Description | Allowed Values | +|----------------|---------------|---------|--------------------------------------------------------------|---------------------------------| +| `acl` | String, Array | None | The access control list items | Allowed HAProxy acl values | +| `section` | String | None | The section where the acl(s) should be applied | `frontend`, `listen`, `backend` | +| `section_name` | String | None | The name of the specific frontend, listen or backend section | | ## Examples diff --git a/documentation/haproxy_backend.md b/documentation/haproxy_backend.md index 317ac6d8..8c337469 100644 --- a/documentation/haproxy_backend.md +++ b/documentation/haproxy_backend.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_backend +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Backend describes a set of servers to which the proxy will connect to forward incoming connections. Introduced: v4.0.0 @@ -21,15 +19,15 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| --------------- | ------------- | ------- | ------------------------------------------------------------------ | -------------------------- | +|-----------------|---------------|---------|--------------------------------------------------------------------|----------------------------| | `mode` | String | None | Set the running mode or protocol of the instance | `http`, `tcp` | -| `server` | String, Array | None | Servers the backend routes to | -| `tcp_request` | String, Array | None | HAProxy `tcp-request` settings | -| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | -| `reqirep` | String, Array | None | `reqrep` ignoring case | +| `server` | String, Array | None | Servers the backend routes to | | +| `tcp_request` | String, Array | None | HAProxy `tcp-request` settings | | +| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | | +| `reqirep` | String, Array | None | `reqrep` ignoring case | | | `acl` | Array | None | Access control list items | Allowed HAProxy acl values | -| `option` | Array | None | Array of HAProxy `option` directives | -| `extra_options` | Hash | None | Used for setting any HAProxy directives | +| `option` | Array | None | Array of HAProxy `option` directives | | +| `extra_options` | Hash | None | Used for setting any HAProxy directives | | | `hash_type` | String | None | Specify a method to use for mapping hashes to servers | `consistent`, `map-based` | ## Examples diff --git a/documentation/haproxy_cache.md b/documentation/haproxy_cache.md index 1d78bc64..ef58ee71 100644 --- a/documentation/haproxy_cache.md +++ b/documentation/haproxy_cache.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_cache +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Cache describes a shared cache for small objects such as CSS, JS and icon files. Useful for web application acceleration. Available in HAProxy version 1.8 and later, and `max_object_size` in 1.9 and later. Introduced: v6.3.0 @@ -20,11 +18,11 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) | Name | Type | Default | Description | Allowed Values | -| ----------------- | ------- | ------------- | --------------------------------------------------- | -------------- | -| `cache_name` | String | name_property | Name of the cache | -| `total_max_size` | Integer | None | Define the size in RAM of the cache in megabytes | -| `max_object_size` | Integer | None | Define the maximum size of the objects to be cached | -| `max_age` | Integer | None | Define the maximum expiration duration in seconds | +|-------------------|---------|---------------|-----------------------------------------------------|----------------| +| `cache_name` | String | name_property | Name of the cache | | +| `total_max_size` | Integer | None | Define the size in RAM of the cache in megabytes | | +| `max_object_size` | Integer | None | Define the maximum size of the objects to be cached | | +| `max_age` | Integer | None | Define the maximum expiration duration in seconds | | ## Examples diff --git a/documentation/haproxy_config_defaults.md b/documentation/haproxy_config_defaults.md index 6e9bfbd7..68daea7d 100644 --- a/documentation/haproxy_config_defaults.md +++ b/documentation/haproxy_config_defaults.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_config_defaults +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Defaults sets default parameters for all other sections following its declaration. Those default parameters are reset by the next "defaults" section. Introduced: v4.0.0 @@ -20,16 +18,16 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| ----------------- | ----------- | ---------------------------------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `timeout` | Hash | `{ client: '10s', server: '10s', connect: '10s' }` | Default HAProxy timeout values | -| `log` | String | `global` | Enable per-instance logging of events and traffic | +|-------------------|-------------|------------------------------------------------------|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| +| `timeout` | Hash | `{ client: '10s', server: '10s', connect: '10s' }` | Default HAProxy timeout values | | +| `log` | String | `global` | Enable per-instance logging of events and traffic | | | `mode` | String | `http` | Set the running mode or protocol of the instance | `http`, `tcp` | | `balance` | String | `roundrobin` | Define the load balancing algorithm to be used in a backend | `roundrobin static-rr`, `leastconn`, `first`, `source`, `uri`, `url_param`, `header`, `rdp-cookie` | -| `stats` | Hash | `{}` | Enable HAProxy statistics | -| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | -| `haproxy_retries` | Integer | None | Set the number of retries to perform on a server after a connection failure | -| `option` | Array | `['httplog', 'dontlognull', 'redispatch', 'tcplog']` | Array of HAProxy `option` directives | -| `extra_options` | Hash | None | Used for setting any HAProxy directives | +| `stats` | Hash | `{}` | Enable HAProxy statistics | | +| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | | +| `haproxy_retries` | Integer | None | Set the number of retries to perform on a server after a connection failure | | +| `option` | Array | `['httplog', 'dontlognull', 'redispatch', 'tcplog']` | Array of HAProxy `option` directives | | +| `extra_options` | Hash | None | Used for setting any HAProxy directives | | | `hash_type` | String, nil | None | Specify a method to use for mapping hashes to servers | `consistent`, `map-based`, `nil` | ## Examples diff --git a/documentation/haproxy_config_global.md b/documentation/haproxy_config_global.md index 6c5fa7c2..f9601415 100644 --- a/documentation/haproxy_config_global.md +++ b/documentation/haproxy_config_global.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_config_global +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Parameters in the "global" section are process-wide and often OS-specific. They are generally set once for all and do not need being changed once correct. @@ -22,17 +20,17 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| --------------- | --------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------- | -| `pidfile` | String | `/var/run/haproxy.pid` | Writes PIDs of all daemons into file `` | -| `log` | String, Array | `/dev/log syslog info` | Adds a global syslog server | -| `daemon` | TrueClass, FalseClass | `true` | Makes the process fork into background | +|-----------------|-----------------------|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|------------------| +| `pidfile` | String | `/var/run/haproxy.pid` | Writes PIDs of all daemons into file `` | | +| `log` | String, Array | `/dev/log syslog info` | Adds a global syslog server | | +| `daemon` | TrueClass, FalseClass | `true` | Makes the process fork into background | | | `debug_option` | String | `quiet` | Sets the debugging mode | `quiet`, `debug` | -| `stats` | Hash | `{socket: "/var/run/haproxy.sock user #{haproxy_user} group #{haproxy_group}",timeout: '2m'}` | Enable stats with various options | -| `maxconn` | Integer | `4096` | Sets the maximum per-process number of concurrent connections | -| `chroot` | String | None | Changes current directory to `` and performs a chroot() there before dropping privileges | -| `log_tag` | String | `haproxy` | Specifies the log tag to use for all outgoing logs | -| `tuning` | Hash | None | A hash of `tune.` | -| `extra_options` | Hash | None | Used for setting any HAProxy directives | +| `stats` | Hash | `{socket: "/var/run/haproxy.sock user #{haproxy_user} group #{haproxy_group}",timeout: '2m'}` | Enable stats with various options | | +| `maxconn` | Integer | `4096` | Sets the maximum per-process number of concurrent connections | | +| `chroot` | String | None | Changes current directory to `` and performs a chroot() there before dropping privileges | | +| `log_tag` | String | `haproxy` | Specifies the log tag to use for all outgoing logs | | +| `tuning` | Hash | None | A hash of `tune.` | | +| `extra_options` | Hash | None | Used for setting any HAProxy directives | | ## Examples diff --git a/documentation/haproxy_fastcgi.md b/documentation/haproxy_fastcgi.md index a416c385..f7dadeeb 100644 --- a/documentation/haproxy_fastcgi.md +++ b/documentation/haproxy_fastcgi.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_fastcgi +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Fastcgi describes a FastCGI applications resource for haproxy to send HTTP requests to Responder FastCGI applications Resource available when using HAProxy version >= 2.1. @@ -22,13 +20,13 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) -| Name | Type | Default | Description | Allowed Values | -| --------------- | ------ | -------------------------- | -------------------------------------------------------------------------------- | --------------- | -| `fastcgi` | String | None | Name property - sets the fcgi-app name | -| `docroot` | String | None | Define the document root on the remote host | -| `index` | String | None | Define the script name that will be appended after an URI that ends with a slash | -| `log_stderr` | String | None | Enable logging of STDERR messages reported by the FastCGI application | -| `option` | Array | None | Array of HAProxy `option` directives | +| Name | Type | Default | Description | Allowed Values | +|--------------|--------|---------|----------------------------------------------------------------------------------|----------------| +| `fastcgi` | String | None | Name property - sets the fcgi-app name | | +| `docroot` | String | None | Define the document root on the remote host | | +| `index` | String | None | Define the script name that will be appended after an URI that ends with a slash | | +| `log_stderr` | String | None | Enable logging of STDERR messages reported by the FastCGI application | | +| `option` | Array | None | Array of HAProxy `option` directives | | ## Examples @@ -44,7 +42,7 @@ end Generates -``` +```ruby fcgi-app php-fpm docroot /var/www/my-app index index.php diff --git a/documentation/haproxy_frontend.md b/documentation/haproxy_frontend.md index 4a649fb7..163dee0e 100644 --- a/documentation/haproxy_frontend.md +++ b/documentation/haproxy_frontend.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_frontend +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Frontend describes a set of listening sockets accepting client connections. Introduced: v4.0.0 @@ -21,17 +19,17 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| ----------------- | ------------- | ------------ | ------------------------------------------------------------------------ | -------------------------- | -| `bind` | String, Hash | `0.0.0.0:80` | String - sets as given. Hash joins with a space | +|-------------------|---------------|--------------|--------------------------------------------------------------------------|----------------------------| +| `bind` | String, Hash | `0.0.0.0:80` | String - sets as given. Hash joins with a space | | | `mode` | String | None | Set the running mode or protocol of the instance | `http`, `tcp` | -| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | -| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | -| `reqirep` | String, Array | None | `reqrep` ignoring case | -| `default_backend` | String | None | Specify the backend to use when no "use_backend" rule has been matched | -| `use_backend` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | +| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | | +| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | | +| `reqirep` | String, Array | None | `reqrep` ignoring case | | +| `default_backend` | String | None | Specify the backend to use when no "use_backend" rule has been matched | | +| `use_backend` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | | | `acl` | Array | None | Access control list items | Allowed HAProxy acl values | -| `option` | Array | None | Array of HAProxy `option` directives | -| `stats` | Hash | None | Enable stats with various options | +| `option` | Array | None | Array of HAProxy `option` directives | | +| `stats` | Hash | None | Enable stats with various options | | ## Examples diff --git a/documentation/haproxy_install.md b/documentation/haproxy_install.md index a1ad7060..7b5d6198 100644 --- a/documentation/haproxy_install.md +++ b/documentation/haproxy_install.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_install +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Install HAProxy from package or source. Introduced: v4.0.0 @@ -20,36 +18,36 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) | Name | Type | Default | Description | Allowed Values | -| -------------------- | ------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------- | +|----------------------|---------|------------------------------------------------------------------|--------------------------------------------------------------------------------|---------------------| | `install_type` | String | None | Set the installation type | `package`, `source` | -| `bin_prefix` | String | `/usr` | Set the source compile prefix | -| `sensitive` | Boolean | `true` | Ensure that sensitive resource data is not logged by the chef-client | -| `use_systemd` | Boolean | `true` | Evalues whether to use systemd based on the nodes init package | -| `user` | String | `haproxy` | Similar to "uid" but uses the UID of user name `` from /etc/passwd | -| `group` | String | `haproxy` | Similar to "gid" but uses the GID of group name `` from /etc/group | -| `package_name` | String | `haproxy` | | -| `package_version` | String | | | -| `enable_ius_repo` | Boolean | `false` | Enables the IUS package repo for Centos to install versions >1.5 | -| `enable_epel_repo` | Boolean | `true` | Enables the epel repo for RHEL based operating systems | -| `source_version` | String | `2.2.4` | | -| `source_url` | String | `http://www.haproxy.org/download/2.2.4/src/haproxy-2.2.4.tar.gz` | | -| `source_checksum` | String | | | -| `source_target_cpu` | String | `node['kernel']['machine']` | | -| `source_target_arch` | String | | | -| `source_target_os` | String | See resource | | +| `bin_prefix` | String | `/usr` | Set the source compile prefix | | +| `sensitive` | Boolean | `true` | Ensure that sensitive resource data is not logged by the chef-client | | +| `use_systemd` | Boolean | `true` | Evalues whether to use systemd based on the nodes init package | | +| `user` | String | `haproxy` | Similar to "uid" but uses the UID of user name `` from /etc/passwd | | +| `group` | String | `haproxy` | Similar to "gid" but uses the GID of group name `` from /etc/group | | +| `package_name` | String | `haproxy` | | | +| `package_version` | String | | | | +| `enable_ius_repo` | Boolean | `false` | Enables the IUS package repo for Centos to install versions >1.5 | | +| `enable_epel_repo` | Boolean | `true` | Enables the epel repo for RHEL based operating systems | | +| `source_version` | String | `2.2.4` | | | +| `source_url` | String | `http://www.haproxy.org/download/2.2.4/src/haproxy-2.2.4.tar.gz` | | | +| `source_checksum` | String | | | | +| `source_target_cpu` | String | `node['kernel']['machine']` | | | +| `source_target_arch` | String | | | | +| `source_target_os` | String | See resource | | | | `use_libcrypt` | Boolean | `true` | | `true`, `false` | | `use_pcre` | Boolean | `true` | | `true`, `false` | -| `use_openssl` | Boolean | `true` | Include openssl support () | `true`, `false` | +| `use_openssl` | Boolean | `true` | Include openssl support () | `true`, `false` | | `use_zlib` | Boolean | `true` | Include ZLIB support | `true`, `false` | | `use_linux_tproxy` | Boolean | `true` | | `true`, `false` | | `use_linux_splice` | Boolean | `true` | | `true`, `false` | | `use_promex` | Boolean | `false` | Enable the included Prometheus exporter (HAProxy v2.4+) | `true`, `false` | | `use_systemd` | Boolean | `true` | | `true`, `false` | | `use_lua` | Boolean | `false` | Include Lua support | `true`, `false` | -| `lua_lib` | String | | Path for lua library files ex: `/opt/lib-5.3.5/lib` | -| `lua_inc` | String | | Path for lua library files ex: `/opt/lib-5.3.5/include` | -| `ssl_lib` | String | | Path for openssl library files ex: `/usr/local/openssl/lib` | -| `ssl_inc` | String | | Path for openssl includes files ex: `/usr/local/openssl/inc` | +| `lua_lib` | String | | Path for lua library files ex: `/opt/lib-5.3.5/lib` | | +| `lua_inc` | String | | Path for lua library files ex: `/opt/lib-5.3.5/include` | | +| `ssl_lib` | String | | Path for openssl library files ex: `/usr/local/openssl/lib` | | +| `ssl_inc` | String | | Path for openssl includes files ex: `/usr/local/openssl/inc` | | ## Examples diff --git a/documentation/haproxy_listen.md b/documentation/haproxy_listen.md index c682229b..af17d5c4 100644 --- a/documentation/haproxy_listen.md +++ b/documentation/haproxy_listen.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_listen +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Listen defines a complete proxy with its frontend and backend parts combined in one section. It is generally useful for TCP-only traffic. @@ -23,19 +21,19 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| ----------------- | ------------- | ------------ | ------------------------------------------------------------------------ | -------------------------- | -| `bind` | String, Hash | `0.0.0.0:80` | String - sets as given. Hash - joins with a space | +|-------------------|---------------|--------------|--------------------------------------------------------------------------|----------------------------| +| `bind` | String, Hash | `0.0.0.0:80` | String - sets as given. Hash - joins with a space | | | `mode` | String | None | Set the running mode or protocol of the instance | `http`, `tcp` | -| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | -| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | -| `reqirep` | String, Array | None | `reqrep` ignoring case | -| `default_backend` | String | None | Specify the backend to use when no "use_backend" rule has been matched | -| `use_backend` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | -| `http_request` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | -| `http_response` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | +| `maxconn` | Integer | None | Sets the maximum per-process number of concurrent connections | | +| `reqrep` | String, Array | None | Replace a regular expression with a string in an HTTP request line | | +| `reqirep` | String, Array | None | `reqrep` ignoring case | | +| `default_backend` | String | None | Specify the backend to use when no "use_backend" rule has been matched | | +| `use_backend` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | | +| `http_request` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | | +| `http_response` | Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | | | `acl` | Array | None | Access control list items | Allowed HAProxy acl values | -| `server` | Array | None | Servers the listen section routes to | -| `stats` | Hash | None | Enable stats with various options | +| `server` | Array | None | Servers the listen section routes to | | +| `stats` | Hash | None | Enable stats with various options | | | `hash_type` | String | None | Specify a method to use for mapping hashes to servers | `consistent`, `map-based` | ## Examples diff --git a/documentation/haproxy_mailer.md b/documentation/haproxy_mailer.md index e341f28e..f70c401a 100644 --- a/documentation/haproxy_mailer.md +++ b/documentation/haproxy_mailer.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_mailer +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Mailer describes a mailers resource for sending email alerts on server state changes. Introduced: v8.0.0 @@ -21,8 +19,8 @@ This resource also uses the following partial resources: | Name | Type | Default | Description | Allowed Values | | --------- | ------------- | ------- | --------------------------------------------------------------------------------------- | -------------- | -| `mailer` | String, Array | None | Defines a mailer inside a mailers section | -| `timeout` | String | None | Defines the time available for a mail/connection to be made and send to the mail-server | +| `mailer` | String, Array | None | Defines a mailer inside a mailers section || +| `timeout` | String | None | Defines the time available for a mail/connection to be made and send to the mail-server || ## Examples diff --git a/documentation/haproxy_peer.md b/documentation/haproxy_peer.md index bdf81c62..8d39a41b 100644 --- a/documentation/haproxy_peer.md +++ b/documentation/haproxy_peer.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_peer +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Peer describes a peers resource for haproxy to propagate entries of any data-types in stick-tables between several haproxy instances over TCP connections in a multi-master fashion. Most of the properties are available only when using HAProxy version >= 2.0. To set properties for versions < 2.0, use the `extra_options` hash. See examples below. @@ -23,13 +21,13 @@ This resource also uses the following partial resources: * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) | Name | Type | Default | Description | Allowed Values | -| ---------------- | ------------ | ------- | ----------------------------------------------------------------------- | -------------------------- | -| `bind` | String, Hash | None | String - sets as given. Hash joins with a space. HAProxy version >= 2.0 | +|------------------|--------------|---------|-------------------------------------------------------------------------|----------------------------| +| `bind` | String, Hash | None | String - sets as given. Hash joins with a space. HAProxy version >= 2.0 | | | `state` | String, nil | nil | Set the state of the peers | `enabled`, `disabled`, nil | -| `server` | Array | None | Servers in the peer | -| `default_bind` | String | None | Defines the binding parameters for the local peer, excepted its address | -| `default_server` | String | None | Change default options for a server | -| `table` | Array | None | Configure a stickiness table | +| `server` | Array | None | Servers in the peer | | +| `default_bind` | String | None | Defines the binding parameters for the local peer, excepted its address | | +| `default_server` | String | None | Change default options for a server | | +| `table` | Array | None | Configure a stickiness table | | ## Examples diff --git a/documentation/haproxy_resolver.md b/documentation/haproxy_resolver.md index 991b1d27..ca7b2ed7 100644 --- a/documentation/haproxy_resolver.md +++ b/documentation/haproxy_resolver.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_resolver +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Configuration related to name resolution in HAProxy. There can be as many as resolver sections as needed. Each section can contain many name servers. @@ -22,9 +20,9 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) * [_extra_options](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_extra_options.md) -| Name | Type | Default | Description | Allowed Values | -| --------------- | ------ | -------------------------- | ----------------------------------------------------- | --------------- | -| `nameserver` | Array | None | DNS server description | +| Name | Type | Default | Description | Allowed Values | +|--------------|-------|---------|------------------------|----------------| +| `nameserver` | Array | None | DNS server description | | ## Examples diff --git a/documentation/haproxy_service.md b/documentation/haproxy_service.md index 9d6851c3..d3bf1095 100644 --- a/documentation/haproxy_service.md +++ b/documentation/haproxy_service.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_service +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Configures HAProxy as a systemd service. To reload HAProxy service add a subscribes option to the resource block. See example below. To reload the HAProxy service add a subscribes option to the resource block. See example below. @@ -26,12 +24,12 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) | Name | Type | Default | Description | Allowed Values | -| ------------------------- | ------------ | ------------------------ | ---------------------------------------------------------------- | -------------- | -| `bin_prefix` | String | `/usr` | Bin location of the haproxy binary, defaults to /usr | -| `service_name` | String | `haproxy` | | -| `systemd_unit_content` | String, Hash | See the service resource | A string or hash that contains a systemd unit file definition | -| `config_test` | true, false | `true` | Perform configuration file test before performing service action | -| `config_test_fail_action` | Symbol | `:raise` | Action to perform upon configuration test failure | +|---------------------------|--------------|--------------------------|------------------------------------------------------------------|----------------| +| `bin_prefix` | String | `/usr` | Bin location of the haproxy binary, defaults to /usr | | +| `service_name` | String | `haproxy` | | | +| `systemd_unit_content` | String, Hash | See the service resource | A string or hash that contains a systemd unit file definition | | +| `config_test` | true, false | `true` | Perform configuration file test before performing service action | | +| `config_test_fail_action` | Symbol | `:raise` | Action to perform upon configuration test failure | | ## Examples diff --git a/documentation/haproxy_use_backend.md b/documentation/haproxy_use_backend.md index aacc1acb..1e34e502 100644 --- a/documentation/haproxy_use_backend.md +++ b/documentation/haproxy_use_backend.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_use_backend +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Switch to a specific backend if/unless an ACL-based condition is matched. Introduced: v4.2.0 @@ -21,9 +19,9 @@ This resource also uses the following partial resources: | Name | Type | Default | Description | Allowed Values | | -------------- | ------------- | -------------------------- | ------------------------------------------------------------------------ | ------------------------------- | -| `use_backend` | String, Array | None | Switch to a specific backend if/unless an ACL-based condition is matched | +| `use_backend` | String, Array | None | Switch to a specific backend if/unless an ACL-based condition is matched || | `section` | String | None | The section where the acl(s) should be applied | `frontend`, `listen`, `backend` | -| `section_name` | String | None | The name of the specific frontend, listen or backend section | +| `section_name` | String | None | The name of the specific frontend, listen or backend section || ## Examples diff --git a/documentation/haproxy_userlist.md b/documentation/haproxy_userlist.md index 862cd905..14acc3c2 100644 --- a/documentation/haproxy_userlist.md +++ b/documentation/haproxy_userlist.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # haproxy_userlist +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Control access to frontend/backend/listen sections or to http stats by allowing only authenticated and authorized users. Introduced: v4.1.0 @@ -19,10 +17,10 @@ This resource also uses the following partial resources: * [_config_file](https://github.com/sous-chefs/haproxy/tree/master/documentation/partial_config_file.md) -| Name | Type | Default | Description | Allowed Values | -| ------------- | ------ | -------------------------- | ----------------------------------------------------- | --------------- | -| `group` | Hash | None | Adds group `` to the current userlist | -| `user` | Hash | None | Adds user `` to the current userlist | +| Name | Type | Default | Description | Allowed Values | +|---------|------|---------|--------------------------------------------------|----------------| +| `group` | Hash | None | Adds group `` to the current userlist | | +| `user` | Hash | None | Adds user `` to the current userlist | | ## Examples diff --git a/documentation/partial_config_file.md b/documentation/partial_config_file.md index 41ccd09e..479d1b54 100644 --- a/documentation/partial_config_file.md +++ b/documentation/partial_config_file.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # Partial Resource - _config_file +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Provides properties to control the generation of the HAProxy config file. Introduced: v11.0.0 @@ -11,12 +9,12 @@ Introduced: v11.0.0 ## Properties | Name | Type | Default | Description | Allowed Values | -| ------------------ | ------ | -------------------------- | ----------------------------------------------------------- | --------------- | -| `user` | String | `haproxy` | Set to override haproxy user, defaults to haproxy | -| `group` | String | `haproxy` | Set to override haproxy group, defaults to haproxy | +|--------------------|--------|----------------------------|-------------------------------------------------------------|-----------------| +| `user` | String | `haproxy` | Set to override haproxy user, defaults to haproxy | | +| `group` | String | `haproxy` | Set to override haproxy group, defaults to haproxy | | | `config_dir` | String | `/etc/haproxy` | The directory where the HAProxy configuration resides | Valid directory | -| `config_dir_mode` | String | `0750` | Set to override haproxy config dir mode, defaults to 0750 | +| `config_dir_mode` | String | `0750` | Set to override haproxy config dir mode, defaults to 0750 | | | `config_file` | String | `/etc/haproxy/haproxy.cfg` | The HAProxy configuration file | Valid file name | -| `config_file_mode` | String | `0640` | Set to override haproxy config file mode, defaults to 0640 | -| `cookbook` | String | `haproxy` | Template source cookbook for the haproxy configuration file | -| `template` | String | `haproxy.cfg.erb` | Template source file for the haproxy configuration file | +| `config_file_mode` | String | `0640` | Set to override haproxy config file mode, defaults to 0640 | | +| `cookbook` | String | `haproxy` | Template source cookbook for the haproxy configuration file | | +| `template` | String | `haproxy.cfg.erb` | Template source file for the haproxy configuration file | | diff --git a/documentation/partial_extra_options.md b/documentation/partial_extra_options.md index f98ce112..13677234 100644 --- a/documentation/partial_extra_options.md +++ b/documentation/partial_extra_options.md @@ -1,9 +1,7 @@ -[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) - ---- - # Partial Resource - _extra_options +[Back To Resource List](https://github.com/sous-chefs/haproxy#resources) + Provides properties to supply arbitrary parameters to the haproxy configuration template. Introduced: v11.0.0 @@ -11,5 +9,5 @@ Introduced: v11.0.0 ## Properties | Name | Type | Default | Description | Allowed Values | -| --------------- | ---- | ------- | --------------------------------------- | -------------- | -| `extra_options` | Hash | None | Used for setting any HAProxy directives | +|-----------------|------|---------|-----------------------------------------|----------------| +| `extra_options` | Hash | None | Used for setting any HAProxy directives | | diff --git a/kitchen.yml b/kitchen.yml index 82e3db5a..e3503538 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -15,13 +15,11 @@ verifier: name: inspec platforms: - - name: amazonlinux-2 - - name: centos-7 - - name: centos-8 + - name: amazonlinux-2023 - name: centos-stream-8 - - name: debian-9 - - name: debian-10 + - name: centos-stream-9 - name: debian-11 + - name: debian-12 - name: ubuntu-20.04 - name: ubuntu-22.04 - name: fedora-latest @@ -30,19 +28,19 @@ suites: - name: package run_list: - recipe[test::package] - - name: source-1.8 + - name: source-2.4 run_list: - - recipe[test::source-18] - - name: source-2.0 + - recipe[test::source_24] + - name: source_2.6 run_list: - - recipe[test::source-20] - - name: source-2.2 + - recipe[test::source_26] + - name: source_2.8 run_list: - - recipe[test::source-22] - - name: source-2.4 + - recipe[test::source_28] + - name: source_2.9 run_list: - - recipe[test::source-24] - - name: source-default + - recipe[test::source_29] + - name: source_default run_list: - recipe[test::source] - name: source_lua @@ -57,72 +55,36 @@ suites: - name: config_1 run_list: - recipe[test::config_1] - includes: - - centos-7 - - centos-stream-8 - name: config_2 run_list: - recipe[test::config_2] - includes: - - centos-7 - - centos-stream-8 - name: config_3 run_list: - recipe[test::config_3] - includes: - - centos-7 - - centos-stream-8 - name: config_4 run_list: - recipe[test::config_4] - includes: - - centos-7 - - centos-stream-8 - name: config_backend_search run_list: - recipe[test::config_backend_search] - includes: - - centos-7 - - centos-stream-8 - name: config_1_userlist run_list: - recipe[test::config_1_userlist] - includes: - - centos-7 - - centos-stream-8 - name: config_acl run_list: - recipe[test::config_acl] - includes: - - centos-7 - - centos-stream-8 - name: config_resolver run_list: - recipe[test::config_resolver] - includes: - - centos-7 - - centos-stream-8 - name: config_ssl_redirect run_list: - recipe[test::config_ssl_redirect] - includes: - - centos-7 - - centos-stream-8 - name: config_custom_template run_list: - recipe[test::config_custom_template] - includes: - - centos-7 - - centos-stream-8 - name: config_array run_list: - recipe[test::config_array] - includes: - - centos-7 - - centos-stream-8 - name: config_fastcgi run_list: - recipe[test::config_fastcgi] - includes: - - centos-7 - - centos-stream-8 diff --git a/libraries/helpers.rb b/libraries/helpers.rb index a85f1246..d1ac8b76 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -11,7 +11,7 @@ def source_package_list when 'debian' %w(libpcre3-dev libssl-dev zlib1g-dev libsystemd-dev) when 'rhel', 'amazon', 'fedora' - %w(pcre-devel openssl-devel zlib-devel systemd-devel) + %w(pcre-devel openssl-devel zlib-devel systemd-devel tar) when 'suse' %w(pcre-devel libopenssl-devel zlib-devel systemd-devel) end diff --git a/resources/config_global.rb b/resources/config_global.rb index 827f5c97..e74f319c 100644 --- a/resources/config_global.rb +++ b/resources/config_global.rb @@ -20,11 +20,11 @@ property :stats, Hash, default: lazy { - { - socket: "/var/run/haproxy.sock user #{user} group #{group}", - timeout: '2m', - } - }, + { + socket: "/var/run/haproxy.sock user #{user} group #{group}", + timeout: '2m', + } + }, description: 'Enable stats with various options' property :maxconn, [Integer, String], diff --git a/resources/install.rb b/resources/install.rb index f28c13d3..2b16a845 100644 --- a/resources/install.rb +++ b/resources/install.rb @@ -31,13 +31,13 @@ # Source property :source_version, String, - default: '2.2.4' + default: '2.8.5' property :source_url, String, default: lazy { "https://www.haproxy.org/download/#{source_version.to_f}/src/haproxy-#{source_version}.tar.gz" } property :source_checksum, String, - default: '87a4d9d4ff8dc3094cb61bbed4a8eed2c40b5ac47b9604daebaf036d7b541be2' + default: '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' property :source_target_cpu, String, default: lazy { node['kernel']['machine'] } diff --git a/spec/unit/recipes/install_spec.rb b/spec/unit/recipes/install_spec.rb index 9ce527ba..577fd9e7 100644 --- a/spec/unit/recipes/install_spec.rb +++ b/spec/unit/recipes/install_spec.rb @@ -24,7 +24,7 @@ end end before(:each) do - stub_command('/usr/sbin/haproxy -v | grep 2.2.4').and_return('2.2.4') + stub_command('/usr/sbin/haproxy -v | grep 2.8.5').and_return('2.8.5') end it { is_expected.to install_package(%w(libpcre3-dev libssl-dev zlib1g-dev libsystemd-dev)) } diff --git a/test/cookbooks/test/recipes/config_array.rb b/test/cookbooks/test/recipes/config_array.rb index 59dc21b5..3aa9ed91 100644 --- a/test/cookbooks/test/recipes/config_array.rb +++ b/test/cookbooks/test/recipes/config_array.rb @@ -27,7 +27,8 @@ 'redirect' => [ 'prefix http://www.bar.com code 301 if { hdr(host) -i foo.com }', 'prefix http://www.bar.com code 301 if { hdr(host) -i www.foo.com }', - ]) + ] + ) default_backend 'servers' end diff --git a/test/cookbooks/test/recipes/source.rb b/test/cookbooks/test/recipes/source.rb index 415a4b5d..0920cb2c 100644 --- a/test/cookbooks/test/recipes/source.rb +++ b/test/cookbooks/test/recipes/source.rb @@ -2,9 +2,9 @@ haproxy_install 'source' -haproxy_config_global '' +haproxy_config_global -haproxy_config_defaults '' +haproxy_config_defaults haproxy_service 'haproxy' do action %i(create enable start) diff --git a/test/cookbooks/test/recipes/source-24.rb b/test/cookbooks/test/recipes/source_24.rb similarity index 58% rename from test/cookbooks/test/recipes/source-24.rb rename to test/cookbooks/test/recipes/source_24.rb index afcc652a..f4e655dd 100644 --- a/test/cookbooks/test/recipes/source-24.rb +++ b/test/cookbooks/test/recipes/source_24.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.4.25' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/2.4/src/haproxy-2.4.0.tar.gz' - source_checksum '0a6962adaf5a1291db87e3eb4ddf906a72fed535dbd2255b164b7d8394a53640' - source_version '2.4.0' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum '44b035bdc9ffd4935f5292c2dfd4a1596c048dc59c5b25a0c6d7689d64f50b99' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-18.rb b/test/cookbooks/test/recipes/source_26.rb similarity index 55% rename from test/cookbooks/test/recipes/source-18.rb rename to test/cookbooks/test/recipes/source_26.rb index a7ec0903..56db527b 100644 --- a/test/cookbooks/test/recipes/source-18.rb +++ b/test/cookbooks/test/recipes/source_26.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.6.16' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/1.8/src/haproxy-1.8.17.tar.gz' - source_checksum '7b789b177875afdd5ddeff058e7efde73aa895dc2dcf728b464358635ae3948e' - source_version '1.8.17' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum 'faac6f9564caf6e106fe22c77a1fb35406afc8cd484c35c2c844aaf0d7a097fb' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-20.rb b/test/cookbooks/test/recipes/source_28.rb similarity index 56% rename from test/cookbooks/test/recipes/source-20.rb rename to test/cookbooks/test/recipes/source_28.rb index 3396e4dc..5a095d5f 100644 --- a/test/cookbooks/test/recipes/source-20.rb +++ b/test/cookbooks/test/recipes/source_28.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.8.5' haproxy_install 'source' do - source_url 'https://www.haproxy.org/download/2.0/src/haproxy-2.0.12.tar.gz' - source_checksum '7fcf5adb21cd78c4161902f9fcc8d7fc97e1562319a992cbda884436ca9602fd' - source_version '2.0.12' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-22.rb b/test/cookbooks/test/recipes/source_29.rb similarity index 56% rename from test/cookbooks/test/recipes/source-22.rb rename to test/cookbooks/test/recipes/source_29.rb index 18c8d575..c8e83ae8 100644 --- a/test/cookbooks/test/recipes/source-22.rb +++ b/test/cookbooks/test/recipes/source_29.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.9.3' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/2.2/src/haproxy-2.2.14.tar.gz' - source_checksum '6a9b702f04b07786f3e5878de8172a727acfdfdbc1cefe1c7a438df372f2fb61' - source_version '2.2.14' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum 'ed517c65abd86945411f6bcb18c7ec657a706931cb781ea283063ba0a75858c0' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source_openssl.rb b/test/cookbooks/test/recipes/source_openssl.rb index c6f03d1a..ef2aaf02 100644 --- a/test/cookbooks/test/recipes/source_openssl.rb +++ b/test/cookbooks/test/recipes/source_openssl.rb @@ -70,7 +70,7 @@ # install haproxy with openssl haproxy_install 'source' do source_url 'http://www.haproxy.org/download/2.2/src/haproxy-2.2.4.tar.gz' - source_checksum '87a4d9d4ff8dc3094cb61bbed4a8eed2c40b5ac47b9604daebaf036d7b541be2' + source_checksum '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' source_version '2.2.4' use_openssl true use_zlib true diff --git a/test/integration/config_4/example_spec.rb b/test/integration/config_4/example_spec.rb index ce88640b..0d6f0d8b 100644 --- a/test/integration/config_4/example_spec.rb +++ b/test/integration/config_4/example_spec.rb @@ -95,7 +95,7 @@ ' reqirep \^Host:\\\ www.mydomain.com Host:\\\ www', ' default_backend servers', ] - its('content') { should match /#{cfg_content.join('\n')}/ } + its('content') { should match(/#{cfg_content.join('\n')}/) } end describe service('haproxy') do diff --git a/test/integration/source-2.4/source_spec.rb b/test/integration/source-2.4/source_spec.rb index 5e48884d..3b6e931a 100644 --- a/test/integration/source-2.4/source_spec.rb +++ b/test/integration/source-2.4/source_spec.rb @@ -13,5 +13,5 @@ end describe command('haproxy -vv') do - its('stdout') { should match /Built with the Prometheus exporter as a service/ } + its('stdout') { should match(/Built with the Prometheus exporter as a service/) } end diff --git a/test/integration/source-1.8/source_spec.rb b/test/integration/source_2.6/source_spec.rb similarity index 100% rename from test/integration/source-1.8/source_spec.rb rename to test/integration/source_2.6/source_spec.rb diff --git a/test/integration/source-2.0/source_spec.rb b/test/integration/source_2.8/source_spec.rb similarity index 100% rename from test/integration/source-2.0/source_spec.rb rename to test/integration/source_2.8/source_spec.rb diff --git a/test/integration/source_2.9/source_spec.rb b/test/integration/source_2.9/source_spec.rb new file mode 100644 index 00000000..fcbe218e --- /dev/null +++ b/test/integration/source_2.9/source_spec.rb @@ -0,0 +1,13 @@ +describe directory '/etc/haproxy' do + it { should exist } +end + +describe file '/etc/haproxy/haproxy.cfg' do + its(:mode) { should cmp '0640' } +end + +describe service 'haproxy' do + it { should be_installed } + it { should be_enabled } + it { should be_running } +end diff --git a/test/integration/source_lua/lua_spec.rb b/test/integration/source_lua/lua_spec.rb index 70c7c0f7..fe18209a 100644 --- a/test/integration/source_lua/lua_spec.rb +++ b/test/integration/source_lua/lua_spec.rb @@ -3,5 +3,5 @@ end describe command('haproxy -vv | grep Lua') do - its('stdout') { should match /Built with Lua version/ } + its('stdout') { should match(/Built with Lua version/) } end diff --git a/test/integration/source_openssl/openssl_spec.rb b/test/integration/source_openssl/openssl_spec.rb index ae9df196..1dabf783 100644 --- a/test/integration/source_openssl/openssl_spec.rb +++ b/test/integration/source_openssl/openssl_spec.rb @@ -7,5 +7,5 @@ end describe command('haproxy -vv | grep "OpenSSL 1.1.1h"') do - its('stdout') { should match /OpenSSL version : OpenSSL 1.1.1h 22 Sep 2020/ } + its('stdout') { should match(/OpenSSL version : OpenSSL 1.1.1h 22 Sep 2020/) } end