From 36c40c6ef8f829c202213f554071fad0c33e3b8b Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Tue, 6 Apr 2021 13:01:25 -0400 Subject: [PATCH 01/28] Fix acceptance tests --- Gemfile | 4 ++-- spec/acceptance/nodesets/centos-8.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 8b16414..a650693 100644 --- a/Gemfile +++ b/Gemfile @@ -34,8 +34,8 @@ group :development do gem "coveralls", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet-module-posix-system-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-pe", require: false diff --git a/spec/acceptance/nodesets/centos-8.yml b/spec/acceptance/nodesets/centos-8.yml index 82f6df1..9798582 100644 --- a/spec/acceptance/nodesets/centos-8.yml +++ b/spec/acceptance/nodesets/centos-8.yml @@ -12,7 +12,7 @@ HOSTS: - '/usr/sbin/init' docker_image_commands: - 'yum install -y dnf-utils' - - 'dnf config-manager --set-enabled PowerTools' + - 'dnf config-manager --set-enabled powertools' - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' docker_container_name: 'patroni1-el8' patroni2: @@ -27,7 +27,7 @@ HOSTS: - '/usr/sbin/init' docker_image_commands: - 'yum install -y dnf-utils' - - 'dnf config-manager --set-enabled PowerTools' + - 'dnf config-manager --set-enabled powertools' - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' docker_container_name: 'patroni2-el8' CONFIG: From 1cfe306e5319ba28057451f3379db620ba5ab9d3 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Tue, 6 Apr 2021 12:14:54 -0400 Subject: [PATCH 02/28] Make managing the postgresql package repo optional --- manifests/init.pp | 31 +++++++++++++++++++++++++++---- spec/classes/patroni_spec.rb | 17 +++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4dbdc53..9c31ae7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -94,6 +94,8 @@ # Refer to PostgreSQL configuration settings `remove_data_directory_on_rewind_failure` setting # @param pgsql_replica_method # Refer to PostgreSQL configuration settings `replica_method` setting +# @param manage_postgresql_repo +# Should the postgresql module manage the package repo # @param use_consul # Boolean to use Consul for configuration storage # @param consul_host @@ -292,6 +294,7 @@ Boolean $pgsql_use_pg_rewind = true, Boolean $pgsql_remove_data_directory_on_rewind_failure = false, Array[Hash] $pgsql_replica_method = [], + Boolean $manage_postgresql_repo = true, # Consul Settings Boolean $use_consul = false, @@ -378,23 +381,32 @@ String $service_ensure = 'running', Boolean $service_enable = true, ) { - if $manage_postgresql { class { 'postgresql::globals': encoding => 'UTF-8', locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $manage_postgresql_repo, version => $postgresql_version, } + include postgresql::params + $default_data_dir = $postgresql::params::datadir $default_bin_dir = $postgresql::params::bindir + + if $manage_postgresql_repo == true { + $postgres_repo_require = 'Class[Postgresql::Repo]' + } else { + $postgres_repo_require = undef + } + package { 'patroni-postgresql-package': ensure => present, name => $postgresql::params::server_package_name, - require => Class['postgresql::repo'], + require => $postgres_repo_require, before => Service['patroni'], } + exec { 'patroni-clear-datadir': path => '/usr/bin:/bin', command => "/bin/rm -rf ${default_data_dir}", @@ -418,11 +430,14 @@ virtualenv => 'present', } } - ensure_packages($install_dependencies, {'before' => Python::Pip['patroni']}) + + ensure_packages($install_dependencies, { 'before' => Python::Pip['patroni'] }) + exec { 'patroni-mkdir-install_dir': command => "/bin/mkdir -p ${install_dir}", creates => $install_dir, } + if $facts['os']['family'] == 'RedHat' { python::virtualenv { 'patroni': version => $python_venv_version, @@ -434,6 +449,7 @@ require => Exec['patroni-mkdir-install_dir'], } } + if $facts['os']['family'] == 'Debian' { python::pyvenv { 'patroni': version => $python_venv_version, @@ -443,24 +459,30 @@ require => Exec['patroni-mkdir-install_dir'], } } + python::pip { 'patroni': ensure => $version, virtualenv => $install_dir, environment => ["PIP_PREFIX=${install_dir}"], before => File['patroni_config'], } + $dependency_params = { 'virtualenv' => $install_dir, 'before' => Python::Pip['patroni'], 'environment' => ["PIP_PREFIX=${install_dir}"], } + python::pip { 'psycopg2': * => $dependency_params } + if $use_consul { python::pip { 'python-consul': * => $dependency_params } } + if $use_etcd { python::pip { 'python-etcd': * => $dependency_params } } + if $use_exhibitor or $use_zookeeper { python::pip { 'kazoo': * => $dependency_params } } @@ -482,6 +504,7 @@ mode => '0755', } } + file { 'patroni_config': ensure => 'file', path => $config_path, diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index f494caf..0ac5a22 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -320,6 +320,23 @@ end end + context 'manage_postgresql_repo => false' do + let(:params) { { 'scope' => 'testscope', 'manage_postgresql_repo' => false } } + + it { is_expected.to compile.with_all_deps } + + it do + is_expected.to contain_class('postgresql::globals').with( + manage_package_repo: false, + ) + end + it do + is_expected.to contain_package('patroni-postgresql-package').with( + require: nil, + ) + end + end + context 'install_method => package' do let(:params) { { 'scope' => 'testscope', 'install_method' => 'package' } } From cf3697284912f3bc78c287aada7a6a2eb7555b47 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 7 Apr 2021 16:38:59 -0400 Subject: [PATCH 03/28] Release v1.3.0 --- CHANGELOG.md | 9 ++ REFERENCE.md | 364 +++++++++++++++++++++++++++++++++----------------- metadata.json | 2 +- 3 files changed, 255 insertions(+), 120 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c313e8..fbafb57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v1.3.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.3.0) (2021-04-07) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.2.0...v1.3.0) + +### UNCATEGORIZED PRS; GO LABEL THEM + +- Fix acceptance tests [\#14](https://github.com/tailored-automation/puppet-module-patroni/pull/14) ([treydock](https://github.com/treydock)) +- Make managing the postgresql package repo optional [\#12](https://github.com/tailored-automation/puppet-module-patroni/pull/12) ([ghoneycutt](https://github.com/ghoneycutt)) + ## [v1.2.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.2.0) (2020-10-17) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.1.0...v1.2.0) diff --git a/REFERENCE.md b/REFERENCE.md index 31d9e64..d8c152b 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -10,21 +10,139 @@ ## Classes -### `patroni` +### `patroni` Manages a Patroni instance #### Parameters -The following parameters are available in the `patroni` class. - -##### `scope` +The following parameters are available in the `patroni` class: + +* [`scope`](#scope) +* [`namespace`](#namespace) +* [`hostname`](#hostname) +* [`dcs_loop_wait`](#dcs_loop_wait) +* [`dcs_ttl`](#dcs_ttl) +* [`dcs_retry_timeout`](#dcs_retry_timeout) +* [`dcs_maximum_lag_on_failover`](#dcs_maximum_lag_on_failover) +* [`dcs_master_start_timeout`](#dcs_master_start_timeout) +* [`dcs_synchronous_mode`](#dcs_synchronous_mode) +* [`dcs_synchronous_mode_strict`](#dcs_synchronous_mode_strict) +* [`dcs_postgresql_use_pg_rewind`](#dcs_postgresql_use_pg_rewind) +* [`dcs_postgresql_use_slots`](#dcs_postgresql_use_slots) +* [`dcs_postgresql_recovery_conf`](#dcs_postgresql_recovery_conf) +* [`dcs_postgresql_parameters`](#dcs_postgresql_parameters) +* [`bootstrap_method`](#bootstrap_method) +* [`initdb_data_checksums`](#initdb_data_checksums) +* [`initdb_encoding`](#initdb_encoding) +* [`initdb_locale`](#initdb_locale) +* [`bootstrap_pg_hba`](#bootstrap_pg_hba) +* [`bootstrap_users`](#bootstrap_users) +* [`bootstrap_post_bootstrap`](#bootstrap_post_bootstrap) +* [`bootstrap_post_init`](#bootstrap_post_init) +* [`superuser_username`](#superuser_username) +* [`superuser_password`](#superuser_password) +* [`replication_username`](#replication_username) +* [`replication_password`](#replication_password) +* [`callback_on_reload`](#callback_on_reload) +* [`callback_on_restart`](#callback_on_restart) +* [`callback_on_role_change`](#callback_on_role_change) +* [`callback_on_start`](#callback_on_start) +* [`callback_on_stop`](#callback_on_stop) +* [`pgsql_connect_address`](#pgsql_connect_address) +* [`pgsql_create_replica_methods`](#pgsql_create_replica_methods) +* [`pgsql_data_dir`](#pgsql_data_dir) +* [`pgsql_config_dir`](#pgsql_config_dir) +* [`pgsql_bin_dir`](#pgsql_bin_dir) +* [`pgsql_listen`](#pgsql_listen) +* [`pgsql_use_unix_socket`](#pgsql_use_unix_socket) +* [`pgsql_pgpass_path`](#pgsql_pgpass_path) +* [`pgsql_recovery_conf`](#pgsql_recovery_conf) +* [`pgsql_custom_conf`](#pgsql_custom_conf) +* [`pgsql_parameters`](#pgsql_parameters) +* [`pgsql_pg_hba`](#pgsql_pg_hba) +* [`pgsql_pg_ctl_timeout`](#pgsql_pg_ctl_timeout) +* [`pgsql_use_pg_rewind`](#pgsql_use_pg_rewind) +* [`pgsql_remove_data_directory_on_rewind_failure`](#pgsql_remove_data_directory_on_rewind_failure) +* [`pgsql_replica_method`](#pgsql_replica_method) +* [`manage_postgresql_repo`](#manage_postgresql_repo) +* [`use_consul`](#use_consul) +* [`consul_host`](#consul_host) +* [`consul_url`](#consul_url) +* [`consul_port`](#consul_port) +* [`consul_scheme`](#consul_scheme) +* [`consul_token`](#consul_token) +* [`consul_verify`](#consul_verify) +* [`consul_register_service`](#consul_register_service) +* [`consul_service_check_interval`](#consul_service_check_interval) +* [`consul_consistency`](#consul_consistency) +* [`consul_cacert`](#consul_cacert) +* [`consul_cert`](#consul_cert) +* [`consul_key`](#consul_key) +* [`consul_dc`](#consul_dc) +* [`consul_checks`](#consul_checks) +* [`use_etcd`](#use_etcd) +* [`etcd_host`](#etcd_host) +* [`etcd_hosts`](#etcd_hosts) +* [`etcd_url`](#etcd_url) +* [`etcd_proxyurl`](#etcd_proxyurl) +* [`etcd_srv`](#etcd_srv) +* [`etcd_protocol`](#etcd_protocol) +* [`etcd_username`](#etcd_username) +* [`etcd_password`](#etcd_password) +* [`etcd_cacert`](#etcd_cacert) +* [`etcd_cert`](#etcd_cert) +* [`etcd_key`](#etcd_key) +* [`use_exhibitor`](#use_exhibitor) +* [`exhibitor_hosts`](#exhibitor_hosts) +* [`exhibitor_poll_interval`](#exhibitor_poll_interval) +* [`exhibitor_port`](#exhibitor_port) +* [`use_kubernetes`](#use_kubernetes) +* [`kubernetes_namespace`](#kubernetes_namespace) +* [`kubernetes_labels`](#kubernetes_labels) +* [`kubernetes_scope_label`](#kubernetes_scope_label) +* [`kubernetes_role_label`](#kubernetes_role_label) +* [`kubernetes_use_endpoints`](#kubernetes_use_endpoints) +* [`kubernetes_pod_ip`](#kubernetes_pod_ip) +* [`kubernetes_ports`](#kubernetes_ports) +* [`restapi_connect_address`](#restapi_connect_address) +* [`restapi_listen`](#restapi_listen) +* [`restapi_username`](#restapi_username) +* [`restapi_password`](#restapi_password) +* [`restapi_certfile`](#restapi_certfile) +* [`restapi_keyfile`](#restapi_keyfile) +* [`restapi_cafile`](#restapi_cafile) +* [`restapi_verify_client`](#restapi_verify_client) +* [`use_zookeeper`](#use_zookeeper) +* [`zookeeper_hosts`](#zookeeper_hosts) +* [`watchdog_mode`](#watchdog_mode) +* [`watchdog_device`](#watchdog_device) +* [`watchdog_safety_margin`](#watchdog_safety_margin) +* [`manage_postgresql`](#manage_postgresql) +* [`postgresql_version`](#postgresql_version) +* [`package_name`](#package_name) +* [`version`](#version) +* [`install_dependencies`](#install_dependencies) +* [`manage_python`](#manage_python) +* [`install_method`](#install_method) +* [`install_dir`](#install_dir) +* [`python_class_version`](#python_class_version) +* [`python_venv_version`](#python_venv_version) +* [`config_path`](#config_path) +* [`config_owner`](#config_owner) +* [`config_group`](#config_group) +* [`config_mode`](#config_mode) +* [`service_name`](#service_name) +* [`service_ensure`](#service_ensure) +* [`service_enable`](#service_enable) + +##### `scope` Data type: `String` Refer to Patroni Global `scope` setting -##### `namespace` +##### `namespace` Data type: `String` @@ -32,7 +150,7 @@ Refer to Patroni Global `namespace` setting Default value: `'/service/'` -##### `hostname` +##### `hostname` Data type: `String` @@ -40,7 +158,7 @@ Refer to Patroni Global `name` setting Default value: `$facts['networking']['hostname']` -##### `dcs_loop_wait` +##### `dcs_loop_wait` Data type: `Integer` @@ -48,7 +166,7 @@ Refer to Patroni Dynamic Configuration Settings `loop_wait` setting Default value: `10` -##### `dcs_ttl` +##### `dcs_ttl` Data type: `Integer` @@ -56,7 +174,7 @@ Refer to Patroni Dynamic Configuration Settings `ttl` setting Default value: `30` -##### `dcs_retry_timeout` +##### `dcs_retry_timeout` Data type: `Integer` @@ -64,7 +182,7 @@ Refer to Patroni Dynamic Configuration Settings `retry_timeout` setting Default value: `10` -##### `dcs_maximum_lag_on_failover` +##### `dcs_maximum_lag_on_failover` Data type: `Integer` @@ -72,7 +190,7 @@ Refer to Patroni Dynamic Configuration Settings `maximum_lag_on_failover` settin Default value: `1048576` -##### `dcs_master_start_timeout` +##### `dcs_master_start_timeout` Data type: `Integer` @@ -80,7 +198,7 @@ Refer to Patroni Dynamic Configuration Settings `master_start_timeout` setting Default value: `300` -##### `dcs_synchronous_mode` +##### `dcs_synchronous_mode` Data type: `Boolean` @@ -88,7 +206,7 @@ Refer to Patroni Dynamic Configuration Settings `synchronous_mode` setting Default value: ``false`` -##### `dcs_synchronous_mode_strict` +##### `dcs_synchronous_mode_strict` Data type: `Boolean` @@ -96,7 +214,7 @@ Refer to Patroni Dynamic Configuration Settings `synchronous_mode_strict` settin Default value: ``false`` -##### `dcs_postgresql_use_pg_rewind` +##### `dcs_postgresql_use_pg_rewind` Data type: `Boolean` @@ -104,7 +222,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_use_pg_rewind` setti Default value: ``true`` -##### `dcs_postgresql_use_slots` +##### `dcs_postgresql_use_slots` Data type: `Boolean` @@ -112,7 +230,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_use_slots` setting Default value: ``true`` -##### `dcs_postgresql_recovery_conf` +##### `dcs_postgresql_recovery_conf` Data type: `Hash` @@ -120,7 +238,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_recovery_conf` setti Default value: `{}` -##### `dcs_postgresql_parameters` +##### `dcs_postgresql_parameters` Data type: `Hash` @@ -128,7 +246,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_parameters` setting Default value: `{}` -##### `bootstrap_method` +##### `bootstrap_method` Data type: `String[1]` @@ -136,7 +254,7 @@ Refer to Bootstrap configuration settings `method` setting Default value: `'initdb'` -##### `initdb_data_checksums` +##### `initdb_data_checksums` Data type: `Boolean` @@ -144,7 +262,7 @@ Refer to Bootstrap configuration settings `data-checksums` setting Default value: ``true`` -##### `initdb_encoding` +##### `initdb_encoding` Data type: `String` @@ -152,7 +270,7 @@ Refer to Bootstrap configuration settings `encoding` setting Default value: `'UTF8'` -##### `initdb_locale` +##### `initdb_locale` Data type: `String` @@ -160,7 +278,7 @@ Refer to Bootstrap configuration settings `locale` setting Default value: `'en_US.utf8'` -##### `bootstrap_pg_hba` +##### `bootstrap_pg_hba` Data type: `Array[String]` @@ -171,7 +289,7 @@ Default value: `[ 'host replication rep_user 0.0.0.0/0 md5', ]` -##### `bootstrap_users` +##### `bootstrap_users` Data type: `Hash` @@ -179,7 +297,7 @@ Refer to Bootstrap configuration settings `users` setting Default value: `{}` -##### `bootstrap_post_bootstrap` +##### `bootstrap_post_bootstrap` Data type: `Variant[Undef,String]` @@ -187,7 +305,7 @@ Refer to Bootstrap configuration settings `post_bootstrap` setting Default value: ``undef`` -##### `bootstrap_post_init` +##### `bootstrap_post_init` Data type: `Variant[Undef,String]` @@ -195,7 +313,7 @@ Refer to Bootstrap configuration settings `post_init` setting Default value: ``undef`` -##### `superuser_username` +##### `superuser_username` Data type: `String` @@ -203,7 +321,7 @@ Refer to PostgreSQL configuration settings superuser username Default value: `'postgres'` -##### `superuser_password` +##### `superuser_password` Data type: `String` @@ -211,7 +329,7 @@ Refer to PostgreSQL configuration settings superuser password Default value: `'changeme'` -##### `replication_username` +##### `replication_username` Data type: `String` @@ -219,7 +337,7 @@ Refer to PostgreSQL configuration settings replication username Default value: `'rep_user'` -##### `replication_password` +##### `replication_password` Data type: `String` @@ -227,7 +345,7 @@ Refer to PostgreSQL configuration settings replication password Default value: `'changeme'` -##### `callback_on_reload` +##### `callback_on_reload` Data type: `Variant[Undef,String]` @@ -235,7 +353,7 @@ Refer to PostgreSQL configuration settings callbacks `on_reload` Default value: ``undef`` -##### `callback_on_restart` +##### `callback_on_restart` Data type: `Variant[Undef,String]` @@ -243,7 +361,7 @@ Refer to PostgreSQL configuration settings callbacks `on_restart` Default value: ``undef`` -##### `callback_on_role_change` +##### `callback_on_role_change` Data type: `Variant[Undef,String]` @@ -251,7 +369,7 @@ Refer to PostgreSQL configuration settings callbacks `on_role_change` Default value: ``undef`` -##### `callback_on_start` +##### `callback_on_start` Data type: `Variant[Undef,String]` @@ -259,7 +377,7 @@ Refer to PostgreSQL configuration settings callbacks `on_start` Default value: ``undef`` -##### `callback_on_stop` +##### `callback_on_stop` Data type: `Variant[Undef,String]` @@ -267,7 +385,7 @@ Refer to PostgreSQL configuration settings callbacks `on_stop` Default value: ``undef`` -##### `pgsql_connect_address` +##### `pgsql_connect_address` Data type: `String` @@ -275,7 +393,7 @@ Refer to PostgreSQL configuration settings `connect_address` setting Default value: `"${facts['networking']['fqdn']}:5432"` -##### `pgsql_create_replica_methods` +##### `pgsql_create_replica_methods` Data type: `Array[String]` @@ -283,7 +401,7 @@ Refer to PostgreSQL configuration settings `create_replica_methods` setting Default value: `['basebackup']` -##### `pgsql_data_dir` +##### `pgsql_data_dir` Data type: `Optional[Stdlib::Unixpath]` @@ -291,7 +409,7 @@ Refer to PostgreSQL configuration settings `data_dir` setting Default value: ``undef`` -##### `pgsql_config_dir` +##### `pgsql_config_dir` Data type: `Variant[Undef,String]` @@ -299,7 +417,7 @@ Refer to PostgreSQL configuration settings `config_dir` setting Default value: ``undef`` -##### `pgsql_bin_dir` +##### `pgsql_bin_dir` Data type: `Variant[Undef,String]` @@ -307,7 +425,7 @@ Refer to PostgreSQL configuration settings `bin_dir` setting Default value: ``undef`` -##### `pgsql_listen` +##### `pgsql_listen` Data type: `String` @@ -315,7 +433,7 @@ Refer to PostgreSQL configuration settings `listen` setting Default value: `'0.0.0.0:5432'` -##### `pgsql_use_unix_socket` +##### `pgsql_use_unix_socket` Data type: `Boolean` @@ -323,7 +441,7 @@ Refer to PostgreSQL configuration settings `use_unix_socket` setting Default value: ``false`` -##### `pgsql_pgpass_path` +##### `pgsql_pgpass_path` Data type: `String` @@ -331,7 +449,7 @@ Refer to PostgreSQL configuration settings `pgpass_path` setting Default value: `'/tmp/pgpass0'` -##### `pgsql_recovery_conf` +##### `pgsql_recovery_conf` Data type: `Hash` @@ -339,7 +457,7 @@ Refer to PostgreSQL configuration settings `recovery_conf` setting Default value: `{}` -##### `pgsql_custom_conf` +##### `pgsql_custom_conf` Data type: `Variant[Undef,String]` @@ -347,7 +465,7 @@ Refer to PostgreSQL configuration settings `custom_conf` setting Default value: ``undef`` -##### `pgsql_parameters` +##### `pgsql_parameters` Data type: `Hash` @@ -355,7 +473,7 @@ Refer to PostgreSQL configuration settings `parameters` setting Default value: `{}` -##### `pgsql_pg_hba` +##### `pgsql_pg_hba` Data type: `Array[String]` @@ -363,7 +481,7 @@ Refer to PostgreSQL configuration settings `pg_hba` setting Default value: `[]` -##### `pgsql_pg_ctl_timeout` +##### `pgsql_pg_ctl_timeout` Data type: `Integer` @@ -371,7 +489,7 @@ Refer to PostgreSQL configuration settings `pg_ctl_timeout` setting Default value: `60` -##### `pgsql_use_pg_rewind` +##### `pgsql_use_pg_rewind` Data type: `Boolean` @@ -379,7 +497,7 @@ Refer to PostgreSQL configuration settings `use_pg_rewind` setting Default value: ``true`` -##### `pgsql_remove_data_directory_on_rewind_failure` +##### `pgsql_remove_data_directory_on_rewind_failure` Data type: `Boolean` @@ -387,7 +505,7 @@ Refer to PostgreSQL configuration settings `remove_data_directory_on_rewind_fail Default value: ``false`` -##### `pgsql_replica_method` +##### `pgsql_replica_method` Data type: `Array[Hash]` @@ -395,7 +513,15 @@ Refer to PostgreSQL configuration settings `replica_method` setting Default value: `[]` -##### `use_consul` +##### `manage_postgresql_repo` + +Data type: `Boolean` + +Should the postgresql module manage the package repo + +Default value: ``true`` + +##### `use_consul` Data type: `Boolean` @@ -403,7 +529,7 @@ Boolean to use Consul for configuration storage Default value: ``false`` -##### `consul_host` +##### `consul_host` Data type: `String` @@ -411,7 +537,7 @@ Refer to Consul configuration `host` setting Default value: `'localhost'` -##### `consul_url` +##### `consul_url` Data type: `Variant[Undef,String]` @@ -419,7 +545,7 @@ Refer to Consul configuration `url` setting Default value: ``undef`` -##### `consul_port` +##### `consul_port` Data type: `Stdlib::Port` @@ -427,7 +553,7 @@ Refer to Consul configuration `port` setting Default value: `8500` -##### `consul_scheme` +##### `consul_scheme` Data type: `Enum['http','https']` @@ -435,7 +561,7 @@ Refer to Consul configuration `scheme` setting Default value: `'http'` -##### `consul_token` +##### `consul_token` Data type: `Variant[Undef,String]` @@ -443,7 +569,7 @@ Refer to Consul configuration `token` setting Default value: ``undef`` -##### `consul_verify` +##### `consul_verify` Data type: `Boolean` @@ -451,7 +577,7 @@ Refer to Consul configuration `verify` setting Default value: ``false`` -##### `consul_register_service` +##### `consul_register_service` Data type: `Optional[Boolean]` @@ -459,7 +585,7 @@ Refer to Consul configuration `register_service` setting Default value: ``undef`` -##### `consul_service_check_interval` +##### `consul_service_check_interval` Data type: `Optional[String]` @@ -467,7 +593,7 @@ Refer to Consul configuration `service_check_interval` setting Default value: ``undef`` -##### `consul_consistency` +##### `consul_consistency` Data type: `Optional[Enum['default', 'consistent', 'stale']]` @@ -475,7 +601,7 @@ Refer to Consul configuration `consistency` setting Default value: ``undef`` -##### `consul_cacert` +##### `consul_cacert` Data type: `Variant[Undef,String]` @@ -483,7 +609,7 @@ Refer to Consul configuration `cacert` setting Default value: ``undef`` -##### `consul_cert` +##### `consul_cert` Data type: `Variant[Undef,String]` @@ -491,7 +617,7 @@ Refer to Consul configuration `cert` setting Default value: ``undef`` -##### `consul_key` +##### `consul_key` Data type: `Variant[Undef,String]` @@ -499,7 +625,7 @@ Refer to Consul configuration `key` setting Default value: ``undef`` -##### `consul_dc` +##### `consul_dc` Data type: `Variant[Undef,String]` @@ -507,7 +633,7 @@ Refer to Consul configuration `dc` setting Default value: ``undef`` -##### `consul_checks` +##### `consul_checks` Data type: `Variant[Undef,String]` @@ -515,7 +641,7 @@ Refer to Consul configuration `checks` setting Default value: ``undef`` -##### `use_etcd` +##### `use_etcd` Data type: `Boolean` @@ -523,7 +649,7 @@ Boolean to use Etcd for configuration storage Default value: ``false`` -##### `etcd_host` +##### `etcd_host` Data type: `String` @@ -531,7 +657,7 @@ Refer to Etcd configuration `host` setting Default value: `'127.0.0.1:2379'` -##### `etcd_hosts` +##### `etcd_hosts` Data type: `Array[String]` @@ -539,7 +665,7 @@ Refer to Etcd configuration `hosts` setting Default value: `[]` -##### `etcd_url` +##### `etcd_url` Data type: `Variant[Undef,String]` @@ -547,7 +673,7 @@ Refer to Etcd configuration `url` setting Default value: ``undef`` -##### `etcd_proxyurl` +##### `etcd_proxyurl` Data type: `Variant[Undef,String]` @@ -555,7 +681,7 @@ Refer to Etcd configuration `proxy` setting Default value: ``undef`` -##### `etcd_srv` +##### `etcd_srv` Data type: `Variant[Undef,String]` @@ -563,7 +689,7 @@ Refer to Etcd configuration `srv` setting Default value: ``undef`` -##### `etcd_protocol` +##### `etcd_protocol` Data type: `Enum['http','https']` @@ -571,7 +697,7 @@ Refer to Etcd configuration `protocol` setting Default value: `'http'` -##### `etcd_username` +##### `etcd_username` Data type: `Variant[Undef,String]` @@ -579,7 +705,7 @@ Refer to Etcd configuration `username` setting Default value: ``undef`` -##### `etcd_password` +##### `etcd_password` Data type: `Variant[Undef,String]` @@ -587,7 +713,7 @@ Refer to Etcd configuration `password` setting Default value: ``undef`` -##### `etcd_cacert` +##### `etcd_cacert` Data type: `Variant[Undef,String]` @@ -595,7 +721,7 @@ Refer to Etcd configuration `cacert` setting Default value: ``undef`` -##### `etcd_cert` +##### `etcd_cert` Data type: `Variant[Undef,String]` @@ -603,7 +729,7 @@ Refer to Etcd configuration `cert` setting Default value: ``undef`` -##### `etcd_key` +##### `etcd_key` Data type: `Variant[Undef,String]` @@ -611,7 +737,7 @@ Refer to Etcd configuration `key` setting Default value: ``undef`` -##### `use_exhibitor` +##### `use_exhibitor` Data type: `Boolean` @@ -619,7 +745,7 @@ Boolean to use Exhibitor configuration storage Default value: ``false`` -##### `exhibitor_hosts` +##### `exhibitor_hosts` Data type: `Array[String]` @@ -627,7 +753,7 @@ Refer to Exhibitor configuration `hosts` setting Default value: `[]` -##### `exhibitor_poll_interval` +##### `exhibitor_poll_interval` Data type: `Integer` @@ -635,7 +761,7 @@ Refer to Exhibitor configuration `poll_interval` setting Default value: `10` -##### `exhibitor_port` +##### `exhibitor_port` Data type: `Integer` @@ -643,7 +769,7 @@ Refer to Exhibitor configuration `port` setting Default value: `8080` -##### `use_kubernetes` +##### `use_kubernetes` Data type: `Boolean` @@ -651,7 +777,7 @@ Boolean to use Kubernetes configuration storage Default value: ``false`` -##### `kubernetes_namespace` +##### `kubernetes_namespace` Data type: `String` @@ -659,7 +785,7 @@ Refer to Kubernetes configuration `namespace` setting Default value: `'default'` -##### `kubernetes_labels` +##### `kubernetes_labels` Data type: `Hash` @@ -667,7 +793,7 @@ Refer to Kubernetes configuration `labels` setting Default value: `{}` -##### `kubernetes_scope_label` +##### `kubernetes_scope_label` Data type: `Variant[Undef,String]` @@ -675,7 +801,7 @@ Refer to Kubernetes configuration `scope_label` setting Default value: ``undef`` -##### `kubernetes_role_label` +##### `kubernetes_role_label` Data type: `Variant[Undef,String]` @@ -683,7 +809,7 @@ Refer to Kubernetes configuration `role_label` setting Default value: ``undef`` -##### `kubernetes_use_endpoints` +##### `kubernetes_use_endpoints` Data type: `Boolean` @@ -691,7 +817,7 @@ Refer to Kubernetes configuration `use_endpoints` setting Default value: ``false`` -##### `kubernetes_pod_ip` +##### `kubernetes_pod_ip` Data type: `Variant[Undef,String]` @@ -699,7 +825,7 @@ Refer to Kubernetes configuration `pod_ip` setting Default value: ``undef`` -##### `kubernetes_ports` +##### `kubernetes_ports` Data type: `Variant[Undef,String]` @@ -707,7 +833,7 @@ Refer to Kubernetes configuration `ports` setting Default value: ``undef`` -##### `restapi_connect_address` +##### `restapi_connect_address` Data type: `String` @@ -715,7 +841,7 @@ Refer to REST API configuration `connect_address` setting Default value: `"${facts['networking']['fqdn']}:8008"` -##### `restapi_listen` +##### `restapi_listen` Data type: `String` @@ -723,7 +849,7 @@ Refer to REST API configuration `listen` setting Default value: `'0.0.0.0:8008'` -##### `restapi_username` +##### `restapi_username` Data type: `Variant[Undef,String]` @@ -731,7 +857,7 @@ Refer to REST API configuration `username` setting Default value: ``undef`` -##### `restapi_password` +##### `restapi_password` Data type: `Variant[Undef,String]` @@ -739,7 +865,7 @@ Refer to REST API configuration `password` setting Default value: ``undef`` -##### `restapi_certfile` +##### `restapi_certfile` Data type: `Variant[Undef,String]` @@ -747,7 +873,7 @@ Refer to REST API configuration `certfile` setting Default value: ``undef`` -##### `restapi_keyfile` +##### `restapi_keyfile` Data type: `Variant[Undef,String]` @@ -755,7 +881,7 @@ Refer to REST API configuration `keyfile` setting Default value: ``undef`` -##### `restapi_cafile` +##### `restapi_cafile` Data type: `Optional[String]` @@ -763,7 +889,7 @@ Refer to REST API configuration `cafile` setting Default value: ``undef`` -##### `restapi_verify_client` +##### `restapi_verify_client` Data type: `Optional[Enum['none','optional','required']]` @@ -771,7 +897,7 @@ Refer to REST API configuration `verify_client` setting Default value: ``undef`` -##### `use_zookeeper` +##### `use_zookeeper` Data type: `Boolean` @@ -779,7 +905,7 @@ Boolean to enable Zookeeper configuration storage Default value: ``false`` -##### `zookeeper_hosts` +##### `zookeeper_hosts` Data type: `Array[String]` @@ -787,7 +913,7 @@ Refer to Zookeeper configuration `hosts` setting Default value: `[]` -##### `watchdog_mode` +##### `watchdog_mode` Data type: `Enum['off','automatic','required']` @@ -795,7 +921,7 @@ Refer to Watchdog configuration `mode` setting Default value: `'automatic'` -##### `watchdog_device` +##### `watchdog_device` Data type: `String` @@ -803,7 +929,7 @@ Refer to Watchdog configuration `device` setting Default value: `'/dev/watchdog'` -##### `watchdog_safety_margin` +##### `watchdog_safety_margin` Data type: `Integer` @@ -811,7 +937,7 @@ Refer to Watchdog configuration `safety_margin` setting Default value: `5` -##### `manage_postgresql` +##### `manage_postgresql` Data type: `Boolean` @@ -819,7 +945,7 @@ Boolean to determine if postgresql is managed Default value: ``true`` -##### `postgresql_version` +##### `postgresql_version` Data type: `Optional[String]` @@ -827,7 +953,7 @@ Version of postgresql passed to postgresql::globals class Default value: ``undef`` -##### `package_name` +##### `package_name` Data type: `String` @@ -835,7 +961,7 @@ Patroni package name, only used when `install_method` is `package` Default value: `'patroni'` -##### `version` +##### `version` Data type: `String` @@ -843,7 +969,7 @@ Version of Patroni to install Default value: `'present'` -##### `install_dependencies` +##### `install_dependencies` Data type: `Array` @@ -851,7 +977,7 @@ Install dependencies, only used when `install_method` is `pip` Default value: `[]` -##### `manage_python` +##### `manage_python` Data type: `Boolean` @@ -859,7 +985,7 @@ Manage Python class, only used when `install_method` is `pip` Default value: ``true`` -##### `install_method` +##### `install_method` Data type: `Enum['package','pip']` @@ -867,7 +993,7 @@ Install method Default value: `'pip'` -##### `install_dir` +##### `install_dir` Data type: `Stdlib::Absolutepath` @@ -875,7 +1001,7 @@ Install directory, only used when `install_method` is `pip` Default value: `'/opt/app/patroni'` -##### `python_class_version` +##### `python_class_version` Data type: `String` @@ -884,7 +1010,7 @@ Only used when `install_method` is `pip` Default value: `'36'` -##### `python_venv_version` +##### `python_venv_version` Data type: `String` @@ -893,7 +1019,7 @@ Only used when `install_method` is `pip` Default value: `'3.6'` -##### `config_path` +##### `config_path` Data type: `String` @@ -901,7 +1027,7 @@ Path to Patroni configuration file Default value: `'/opt/app/patroni/etc/postgresql.yml'` -##### `config_owner` +##### `config_owner` Data type: `String` @@ -909,7 +1035,7 @@ Patroni configuration file owner Default value: `'postgres'` -##### `config_group` +##### `config_group` Data type: `String` @@ -917,7 +1043,7 @@ Patroni configuration file group Default value: `'postgres'` -##### `config_mode` +##### `config_mode` Data type: `String` @@ -925,7 +1051,7 @@ Patroni configuration file mode Default value: `'0600'` -##### `service_name` +##### `service_name` Data type: `String` @@ -933,7 +1059,7 @@ Name of Patroni service Default value: `'patroni'` -##### `service_ensure` +##### `service_ensure` Data type: `String` @@ -941,7 +1067,7 @@ Patroni service ensure property Default value: `'running'` -##### `service_enable` +##### `service_enable` Data type: `Boolean` diff --git a/metadata.json b/metadata.json index 7b2348b..0e47be9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "1.2.0", + "version": "1.3.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From 66a813bab0ef7d85b2d759b252125c72d8cc48f6 Mon Sep 17 00:00:00 2001 From: Matthew Strozyk Date: Fri, 23 Apr 2021 14:47:14 -0700 Subject: [PATCH 04/28] Add support for specifying a custom pip provider Co-authored-by: Matthew Strozyk Co-authored-by: Garrett Honeycutt --- manifests/init.pp | 26 ++++++++++++++++++-------- spec/classes/patroni_spec.rb | 13 +++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9c31ae7..bbf64be 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -236,7 +236,8 @@ # Patroni service ensure property # @param service_enable # Patroni service enable property -# +# @param custom_pip_provider +# Use custom pip path when installing pip packages class patroni ( # Global Settings @@ -380,6 +381,7 @@ String $service_name = 'patroni', String $service_ensure = 'running', Boolean $service_enable = true, + Optional[String[1]] $custom_pip_provider = undef, ) { if $manage_postgresql { class { 'postgresql::globals': @@ -460,17 +462,25 @@ } } + if $custom_pip_provider { + $virtualenv = undef + } else { + $virtualenv = $install_dir + } + python::pip { 'patroni': - ensure => $version, - virtualenv => $install_dir, - environment => ["PIP_PREFIX=${install_dir}"], - before => File['patroni_config'], + ensure => $version, + environment => ["PIP_PREFIX=${install_dir}"], + pip_provider => $custom_pip_provider, + virtualenv => $virtualenv, + before => File['patroni_config'], } $dependency_params = { - 'virtualenv' => $install_dir, - 'before' => Python::Pip['patroni'], - 'environment' => ["PIP_PREFIX=${install_dir}"], + 'before' => Python::Pip['patroni'], + 'pip_provider' => $custom_pip_provider, + 'virtualenv' => $virtualenv, + 'environment' => ["PIP_PREFIX=${install_dir}"], } python::pip { 'psycopg2': * => $dependency_params } diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 0ac5a22..3b08f45 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -401,6 +401,19 @@ expect(content).to include('ExecStart=/usr/local/patroni/bin/patroni ${PATRONI_CONFIG_LOCATION}') end end + + context 'custom_pip_provider => /usr/bin/pip3' do + let(:params) { { 'scope' => 'testscope', 'custom_pip_provider' => '/usr/bin/pip3' } } + + it { is_expected.to compile.with_all_deps } + + it do + is_expected.to contain_python__pip('patroni').with( + pip_provider: '/usr/bin/pip3', + virtualenv: nil, + ) + end + end end end end From 6f53688dae1e8a107780aa7109736f65813f7f09 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 28 Apr 2021 14:23:00 -0400 Subject: [PATCH 05/28] Bump minimum python module requirement, fix unit tests --- .fixtures.yml | 2 +- metadata.json | 2 +- spec/classes/patroni_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index d7c9898..12a1dac 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -15,7 +15,7 @@ fixtures: ref: v7.5.0 python: repo: https://github.com/voxpupuli/puppet-python.git - ref: v4.0.0 + ref: v4.1.0 # Needed by Python module epel: repo: https://github.com/voxpupuli/puppet-epel.git diff --git a/metadata.json b/metadata.json index 0e47be9..80b1398 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,7 @@ }, { "name": "puppet/python", - "version_requirement": ">= 4.0.0 <6.0.0" + "version_requirement": ">= 4.1.0 <6.0.0" }, { "name": "camptocamp/systemd", diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 3b08f45..497676d 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -410,7 +410,7 @@ it do is_expected.to contain_python__pip('patroni').with( pip_provider: '/usr/bin/pip3', - virtualenv: nil, + virtualenv: 'system', ) end end From a9853f6cdc46ef04c0f6a5edf27652f149bdfa38 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 28 Apr 2021 17:49:47 -0400 Subject: [PATCH 06/28] Release v1.4.0 --- CHANGELOG.md | 8 ++++++++ REFERENCE.md | 9 +++++++++ metadata.json | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbafb57..107e32c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v1.4.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.4.0) (2021-04-28) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.3.0...v1.4.0) + +### UNCATEGORIZED PRS; GO LABEL THEM + +- Add support for specifying a custom pip provider [\#19](https://github.com/tailored-automation/puppet-module-patroni/pull/19) ([ghoneycutt](https://github.com/ghoneycutt)) + ## [v1.3.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.3.0) (2021-04-07) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.2.0...v1.3.0) diff --git a/REFERENCE.md b/REFERENCE.md index d8c152b..6e8492f 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -135,6 +135,7 @@ The following parameters are available in the `patroni` class: * [`service_name`](#service_name) * [`service_ensure`](#service_ensure) * [`service_enable`](#service_enable) +* [`custom_pip_provider`](#custom_pip_provider) ##### `scope` @@ -1075,3 +1076,11 @@ Patroni service enable property Default value: ``true`` +##### `custom_pip_provider` + +Data type: `Optional[String[1]]` + +Use custom pip path when installing pip packages + +Default value: ``undef`` + diff --git a/metadata.json b/metadata.json index 80b1398..466e7e4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "1.3.0", + "version": "1.4.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From f14d25ba430ea5b6ea01bbdd27daa3f3bd5783cc Mon Sep 17 00:00:00 2001 From: Matthew Strozyk Date: Mon, 14 Jun 2021 11:43:46 -0700 Subject: [PATCH 07/28] enable support for cipher flag --- manifests/init.pp | 3 +++ templates/postgresql.yml.erb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index bbf64be..ec0a6d3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -174,6 +174,8 @@ # Refer to Kubernetes configuration `pod_ip` setting # @param kubernetes_ports # Refer to Kubernetes configuration `ports` setting +# @param restapi_ciphers +# Refer to REST API configuration `ciphers` setting # @param restapi_connect_address # Refer to REST API configuration `connect_address` setting # @param restapi_listen @@ -345,6 +347,7 @@ Variant[Undef,String] $kubernetes_ports = undef, # REST API Settings + Optional[String] $restapi_ciphers = undef, String $restapi_connect_address = "${facts['networking']['fqdn']}:8008", String $restapi_listen = '0.0.0.0:8008', Variant[Undef,String] $restapi_username = undef, diff --git a/templates/postgresql.yml.erb b/templates/postgresql.yml.erb index eb60393..a5e18ee 100644 --- a/templates/postgresql.yml.erb +++ b/templates/postgresql.yml.erb @@ -144,6 +144,9 @@ restapi: <% if @restapi_certfile != nil -%> certfile: <%= @restapi_certfile %> <% end -%> +<% if @restapi_ciphers != nil %> + ciphers: <%= @restapi_ciphers %> +<% end =%> <% if @restapi_keyfile != nil -%> keyfile: <%= @restapi_keyfile %> <% end -%> From c902fd4e4c27802bc2bc1a638fbac2a2f5e500ce Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Tue, 15 Jun 2021 16:41:22 -0400 Subject: [PATCH 08/28] Release v1.5.0 --- CHANGELOG.md | 8 ++++++++ REFERENCE.md | 9 +++++++++ metadata.json | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 107e32c..b4be9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v1.5.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.5.0) (2021-06-15) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.4.0...v1.5.0) + +### UNCATEGORIZED PRS; GO LABEL THEM + +- enable support for cipher flag [\#21](https://github.com/tailored-automation/puppet-module-patroni/pull/21) ([mrstrozy](https://github.com/mrstrozy)) + ## [v1.4.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.4.0) (2021-04-28) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.3.0...v1.4.0) diff --git a/REFERENCE.md b/REFERENCE.md index 6e8492f..426e43a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -105,6 +105,7 @@ The following parameters are available in the `patroni` class: * [`kubernetes_use_endpoints`](#kubernetes_use_endpoints) * [`kubernetes_pod_ip`](#kubernetes_pod_ip) * [`kubernetes_ports`](#kubernetes_ports) +* [`restapi_ciphers`](#restapi_ciphers) * [`restapi_connect_address`](#restapi_connect_address) * [`restapi_listen`](#restapi_listen) * [`restapi_username`](#restapi_username) @@ -834,6 +835,14 @@ Refer to Kubernetes configuration `ports` setting Default value: ``undef`` +##### `restapi_ciphers` + +Data type: `Optional[String]` + +Refer to REST API configuration `ciphers` setting + +Default value: ``undef`` + ##### `restapi_connect_address` Data type: `String` diff --git a/metadata.json b/metadata.json index 466e7e4..43f5efb 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "1.4.0", + "version": "1.5.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From 6226add013ce315824ddbeaff5b2da359752df6e Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Fri, 18 Jun 2021 13:47:40 -0400 Subject: [PATCH 09/28] Add Puppet 7 and use Github Actions --- .fixtures-latest.yml | 2 +- .fixtures.yml | 2 +- .github/workflows/ci.yaml | 97 ++++++++++++++++++++ .github/workflows/release.yaml | 30 +++++++ .sync.yml | 64 ++++++-------- .travis.yml | 157 --------------------------------- Gemfile | 6 +- metadata.json | 4 +- templates/postgresql.yml.erb | 6 +- 9 files changed, 164 insertions(+), 204 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml delete mode 100644 .travis.yml diff --git a/.fixtures-latest.yml b/.fixtures-latest.yml index f97627f..3a08e54 100644 --- a/.fixtures-latest.yml +++ b/.fixtures-latest.yml @@ -21,4 +21,4 @@ fixtures: repo: git://github.com/puppetlabs/puppetlabs-yumrepo_core puppet_version: ">= 6.0.0" symlinks: - etcd: "#{source_dir}" + patroni: "#{source_dir}" diff --git a/.fixtures.yml b/.fixtures.yml index 12a1dac..78db00c 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -28,4 +28,4 @@ fixtures: ref: 1.0.1 puppet_version: ">= 6.0.0" symlinks: - etcd: "#{source_dir}" + patroni: "#{source_dir}" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..7a18048 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,97 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + unit: + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allow_failure }} + strategy: + fail-fast: false + matrix: + include: + - ruby: 2.5.7 + puppet: 6 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.7.0 + puppet: 7 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.4.9 + puppet: 5 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.5.7 + puppet: 6 + fixtures: .fixtures-latest.yml + allow_failure: true + - ruby: 2.7.0 + puppet: 7 + fixtures: .fixtures-latest.yml + allow_failure: true + env: + BUNDLE_WITHOUT: system_tests:release + PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0" + FACTER_GEM_VERSION: "< 4.0" + FIXTURES_YML: ${{ matrix.fixtures }} + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + bundler: '2.1.0' + - name: Validate + run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint + - name: Run tests + run: bundle exec rake parallel_spec + acceptance: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + set: + - "centos-7" + - "centos-8" + - "debian-9" + - "debian-10" + - "ubuntu-1804" + puppet: + - "puppet6" + - "puppet7" + env: + BUNDLE_WITHOUT: development:release + BEAKER_debug: true + name: + steps: + - name: Enable IPv6 on docker + run: | + echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json + sudo service docker restart + # https://github.com/actions/virtual-environments/issues/181#issuecomment-610874237 + - name: apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + bundler: '2.1.0' + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} + BEAKER_set: ${{ matrix.set }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..1e8347b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + bundler: '2.1.0' + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: 'tailoredautomation' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.sync.yml b/.sync.yml index 3b22268..7b79f5c 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,42 +1,30 @@ +.github/workflows/ci.yaml: + unit_name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) + unit_includes: + - ruby: '2.4.9' + puppet: '5' + fixtures: .fixtures.yml + allow_failure: false + - ruby: '2.5.7' + puppet: '6' + fixtures: .fixtures-latest.yml + allow_failure: true + - ruby: '2.7.0' + puppet: '7' + fixtures: .fixtures-latest.yml + allow_failure: true + acceptance_matrix: + set: + - centos-7 + - centos-8 + - debian-9 + - debian-10 + - ubuntu-1804 + puppet: + - puppet6 + - puppet7 .travis.yml: - dist: xenial - extras: - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.9 - stage: spec - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.7 - stage: spec - allow_failures: - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.9 - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.7 - docker_defaults: - dist: xenial - docker_sets: - - set: centos-7 - collection: puppet5 - - set: centos-7 - collection: puppet6 - - set: centos-8 - collection: puppet5 - - set: centos-8 - collection: puppet6 - - set: debian-9 - collection: puppet5 - - set: debian-9 - collection: puppet6 - - set: debian-10 - collection: puppet5 - - set: debian-10 - collection: puppet6 - - set: ubuntu-1804 - collection: puppet5 - - set: ubuntu-1804 - collection: puppet5 - user: tailoredautomation - secure: "x4sufb/wyxHY9ftHqrfqEfNqkzSSFLUZcRLyf/QfmXGrhus0+H9MTcV8wMKFBlp0MbnXnHAl7JZSeZdfCrcDc/l+IfZ42ZR3VIA+SRyhKv3Ads72qEMUKwwybla+tE3yGRc1dNhBc7KiavmFKYhzHQcVOJSbH2dHpntp2ss/LuZ+uUC7bUM8Omeq6t8rqcYo+zxNTGxiQ20zSvmcAP8N1Uysmrj504l/ANwnWCtgAm/hZ5xMbw/Gy25dkLiFlCEXBDp3y7BAP5wIlFoq0W3t6Q1/aPJvj4FKRdTcw6JvQ/v/znXKZrGasQ7avQk645qDbdJ10V3b15XljIRw557HpOOI3NmNwL1csO/tM7S5nvjAfsMf/veLk1DIZoNdmwmXmvfgAmZcOdaxzi4Q+7VK8t56Nk7j8favmkIGn1O+cCoXUTloBmb+GL0djYOQqdlmE4gOJ1qqTt4LTca7xW6EcaM7KuIVBP3IsctajM0gxF1TqRrZgP3KfmMjXYXjOsSlzykowjDc84gUddwg+b1MsKhFegRdpTepVWSHCCT4Z+MaGLD8z0QQx/1HCkFfmOXy0ZvEVZUWdjkRx7H4wmqajqHH+dggs3Y3EL9JRJInDYaLkm4HJhbb/v+g90g4aiSScrOD661Iq8/vV/k+DqSTAnAwDg15rPRig0Rs4E6vmVg=" + delete: true .gitlab-ci.yml: delete: true appveyor.yml: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f3ee1da..0000000 --- a/.travis.yml +++ /dev/null @@ -1,157 +0,0 @@ ---- -os: linux -dist: xenial -language: ruby -cache: bundler -before_install: - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -script: - - 'bundle exec rake $CHECK' -bundler_args: --without system_tests -rvm: - - 2.5.7 -env: - global: - - FACTER_GEM_VERSION="< 4.0" -stages: - - static - - spec - - acceptance - - - if: tag =~ ^v\d - name: deploy -jobs: - fast_finish: true - include: - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-7 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-7 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-8 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-8 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-9 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-9 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-10 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-10 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=ubuntu-1804 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" - stage: static - - - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec - rvm: 2.4.9 - stage: spec - - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - - - env: DEPLOY_TO_FORGE=yes - stage: deploy - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.9 - stage: spec - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.7 - stage: spec - allow_failures: - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.9 - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.7 -branches: - only: - - master - - /^v\d/ -notifications: - email: false -deploy: - provider: puppetforge - username: tailoredautomation - password: - secure: "x4sufb/wyxHY9ftHqrfqEfNqkzSSFLUZcRLyf/QfmXGrhus0+H9MTcV8wMKFBlp0MbnXnHAl7JZSeZdfCrcDc/l+IfZ42ZR3VIA+SRyhKv3Ads72qEMUKwwybla+tE3yGRc1dNhBc7KiavmFKYhzHQcVOJSbH2dHpntp2ss/LuZ+uUC7bUM8Omeq6t8rqcYo+zxNTGxiQ20zSvmcAP8N1Uysmrj504l/ANwnWCtgAm/hZ5xMbw/Gy25dkLiFlCEXBDp3y7BAP5wIlFoq0W3t6Q1/aPJvj4FKRdTcw6JvQ/v/znXKZrGasQ7avQk645qDbdJ10V3b15XljIRw557HpOOI3NmNwL1csO/tM7S5nvjAfsMf/veLk1DIZoNdmwmXmvfgAmZcOdaxzi4Q+7VK8t56Nk7j8favmkIGn1O+cCoXUTloBmb+GL0djYOQqdlmE4gOJ1qqTt4LTca7xW6EcaM7KuIVBP3IsctajM0gxF1TqRrZgP3KfmMjXYXjOsSlzykowjDc84gUddwg+b1MsKhFegRdpTepVWSHCCT4Z+MaGLD8z0QQx/1HCkFfmOXy0ZvEVZUWdjkRx7H4wmqajqHH+dggs3Y3EL9JRJInDYaLkm4HJhbb/v+g90g4aiSScrOD661Iq8/vV/k+DqSTAnAwDg15rPRig0Rs4E6vmVg=" - on: - tags: true - all_branches: true - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index a650693..b8186f7 100644 --- a/Gemfile +++ b/Gemfile @@ -34,8 +34,8 @@ group :development do gem "coveralls", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-pe", require: false @@ -51,6 +51,8 @@ hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} +gems['rake'] = [require: false] +gems['puppetlabs_spec_helper'] = [require: false] gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment diff --git a/metadata.json b/metadata.json index 43f5efb..600b209 100644 --- a/metadata.json +++ b/metadata.json @@ -58,7 +58,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 5.5.10 < 7.0.0" + "version_requirement": ">= 5.5.10 < 8.0.0" } ], "tags": [ @@ -70,5 +70,5 @@ ], "pdk-version": "1.18.1", "template-url": "https://github.com/tailored-automation/pdk-templates.git#master", - "template-ref": "heads/master-0-g952cfd1" + "template-ref": "heads/master-0-g2163167" } diff --git a/templates/postgresql.yml.erb b/templates/postgresql.yml.erb index a5e18ee..762e9a3 100644 --- a/templates/postgresql.yml.erb +++ b/templates/postgresql.yml.erb @@ -144,13 +144,13 @@ restapi: <% if @restapi_certfile != nil -%> certfile: <%= @restapi_certfile %> <% end -%> -<% if @restapi_ciphers != nil %> +<% if @restapi_ciphers != nil -%> ciphers: <%= @restapi_ciphers %> -<% end =%> +<% end -%> <% if @restapi_keyfile != nil -%> keyfile: <%= @restapi_keyfile %> <% end -%> -<% if @restapi_cafile != nil %> +<% if @restapi_cafile != nil -%> cafile: <%= @restapi_cafile %> <% end -%> <% if @restapi_verify_client != nil -%> From b71ac2ef22e1f5375b09d2d2debdc67727e75d66 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Fri, 18 Jun 2021 20:49:39 -0400 Subject: [PATCH 10/28] Release v1.5.0 --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4be9bd..ae727db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). -## [v1.5.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.5.0) (2021-06-15) +## [v1.5.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.5.0) (2021-06-18) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.4.0...v1.5.0) -### UNCATEGORIZED PRS; GO LABEL THEM +### Added +- Add Puppet 7 and use Github Actions [\#22](https://github.com/tailored-automation/puppet-module-patroni/pull/22) ([treydock](https://github.com/treydock)) - enable support for cipher flag [\#21](https://github.com/tailored-automation/puppet-module-patroni/pull/21) ([mrstrozy](https://github.com/mrstrozy)) ## [v1.4.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.4.0) (2021-04-28) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.3.0...v1.4.0) -### UNCATEGORIZED PRS; GO LABEL THEM +### Added - Add support for specifying a custom pip provider [\#19](https://github.com/tailored-automation/puppet-module-patroni/pull/19) ([ghoneycutt](https://github.com/ghoneycutt)) From c1c77d667572ec47fa9d6f68a4215b2bc4257f1f Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 27 Oct 2021 16:16:42 -0400 Subject: [PATCH 11/28] Add ability to configure Patroni DCS configs --- README.md | 18 +++ .../provider/patroni_dcs_config/patronictl.rb | 62 ++++++++++ lib/puppet/provider/patronictl.rb | 40 +++++++ lib/puppet/type/patroni_dcs_config.rb | 21 ++++ lib/puppet/type/patronictl_config.rb | 38 ++++++ manifests/init.pp | 6 + spec/acceptance/patroni_spec.rb | 108 +++++++++++------- spec/classes/patroni_spec.rb | 7 ++ .../patroni_dcs_config/patronictl/config.out | 12 ++ spec/unit/patroni_dcs_config_spec.rb | 26 +++++ .../patroni_dcs_config/patronictl_spec.rb | 31 +++++ 11 files changed, 328 insertions(+), 41 deletions(-) create mode 100644 lib/puppet/provider/patroni_dcs_config/patronictl.rb create mode 100644 lib/puppet/provider/patronictl.rb create mode 100644 lib/puppet/type/patroni_dcs_config.rb create mode 100644 lib/puppet/type/patronictl_config.rb create mode 100644 spec/fixtures/unit/provider/patroni_dcs_config/patronictl/config.out create mode 100644 spec/unit/patroni_dcs_config_spec.rb create mode 100644 spec/unit/provider/patroni_dcs_config/patronictl_spec.rb diff --git a/README.md b/README.md index 4d23c0b..00924f2 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,24 @@ node pgarb { } ``` +It's possible to define [DCS configuration](https://patroni.readthedocs.io/en/latest/dynamic_configuration.html) values using Puppet with an example like the following: + +```puppet +include patroni + +patroni_dcs_config { 'postgresql.parameters.max_connections': + value => 200, + notify => Exec['patroni-restart-pending'], +} + +exec { 'patroni-restart-pending': + path => '/usr/bin:/bin:/usr/sbin:/sbin', + command => "sleep 60 ; ${patroni::patronictl} -c ${patroni::config_path} restart ${patroni::scope} --pending --force", + refreshonly => true, + require => Service['patroni'], +} +``` + ## Reference All of the Patroni settings I could find in the [Patroni Settings Documentation](https://github.com/zalando/patroni/blob/master/docs/SETTINGS.rst) are mapped to this module. diff --git a/lib/puppet/provider/patroni_dcs_config/patronictl.rb b/lib/puppet/provider/patroni_dcs_config/patronictl.rb new file mode 100644 index 0000000..3ff5123 --- /dev/null +++ b/lib/puppet/provider/patroni_dcs_config/patronictl.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'patronictl')) + +Puppet::Type.type(:patroni_dcs_config).provide(:patronictl, parent: Puppet::Provider::Patronictl) do + desc 'Provider for patroni_dcs_config using patronictl' + + mk_resource_methods + + defaultfor kernel: ['Linux'] + + def self.instances + configs = [] + begin + output = patronictl(['show-config']) + rescue Exception => e # rubocop:disable RescueException + Puppet.err('Failed to fetch patronictl configurations') + puts e.backtrace + end + Puppet.debug("show-config output: #{output}") + data = YAML.safe_load(output) + flatten_hash(data).each_pair do |key, value| + config = {} + config[:name] = key + config[:value] = value + configs << new(config) + end + configs + end + + def self.prefetch(resources) + configs = instances + resources.keys.each do |name| + if provider = configs.find { |c| c.name == name } # rubocop:disable AssignmentInCondition + resources[name].provider = provider + end + end + end + + def initialize(value = {}) + super(value) + @property_flush = {} + end + + type_properties.each do |prop| + define_method "#{prop}=".to_sym do |value| + @property_flush[prop] = value + end + end + + def edit_config(value) + patronictl(['edit-config', '--force', '--quiet', '-s', value]) + rescue Exception => e # rubocop:disable RescueException + raise Puppet::Error, "patronictl edit-config for #{resource[:name]} failed\nError message: #{e.message}" + end + + def create + edit_config("#{resource[:name]}=#{resource[:value]}") + end + + def flush + edit_config("#{resource[:name]}=#{@property_flush[:value]}") + end +end diff --git a/lib/puppet/provider/patronictl.rb b/lib/puppet/provider/patronictl.rb new file mode 100644 index 0000000..cfdea1b --- /dev/null +++ b/lib/puppet/provider/patronictl.rb @@ -0,0 +1,40 @@ +# Parent class for patronictl providers +class Puppet::Provider::Patronictl < Puppet::Provider + initvars + + class << self + attr_accessor :path + attr_accessor :config + end + + def self.patronictl(args, options = {}) + cmd = [@path] + ['-c', @config] + args + default_options = { combine: true, override_locale: false, custom_environment: { 'LC_ALL' => 'en_US.utf8' } } + ret = execute(cmd, default_options.merge(options)) + ret + end + + def patronictl(*args) + self.class.patronictl(*args) + end + + def self.type_properties + resource_type.validproperties.reject { |p| p.to_sym == :ensure } + end + + def type_properties + self.class.type_properties + end + + def self.flatten_hash(hash) + hash.each_with_object({}) do |(k, v), h| + if v.is_a? Hash + flatten_hash(v).map do |h_k, h_v| + h["#{k}.#{h_k}"] = h_v + end + else + h[k] = v + end + end + end +end diff --git a/lib/puppet/type/patroni_dcs_config.rb b/lib/puppet/type/patroni_dcs_config.rb new file mode 100644 index 0000000..50c21ec --- /dev/null +++ b/lib/puppet/type/patroni_dcs_config.rb @@ -0,0 +1,21 @@ +Puppet::Type.newtype(:patroni_dcs_config) do + desc <<-DESC +@summary Manages Patroni DCS configuration options +@example Set PostgreSQL max connections + patroni_dcs_config { 'postgresql.params.max_connections': + value => '200', + } +DESC + + newparam(:name, namevar: true) do + desc 'The DCS configuration option name' + end + + newproperty(:value) do + desc 'The value to assign the DCS configuration' + end + + autorequire(:service) do + ['patroni'] + end +end diff --git a/lib/puppet/type/patronictl_config.rb b/lib/puppet/type/patronictl_config.rb new file mode 100644 index 0000000..a725ded --- /dev/null +++ b/lib/puppet/type/patronictl_config.rb @@ -0,0 +1,38 @@ +Puppet::Type.newtype(:patronictl_config) do + desc <<-DESC +@summary Abstract type to configure other types +**NOTE** This is a private type not intended to be used directly. +DESC + + newparam(:name, namevar: true) do + desc 'The name of the resource.' + end + + newparam(:path) do + desc 'patronictl path' + defaultto('/opt/app/patroni/bin/patronictl') + end + + newparam(:config) do + desc 'patronictl config' + defaultto('/opt/app/patroni/etc/postgresql.yml') + end + + # First collect all types with patronictl provider that come from this module + # For each patronictl type, set the class variable 'chunk_size' used by + # each provider to list resources + # Return empty array since we are not actually generating resources + def generate + patronictl_types = [] + Dir[File.join(File.dirname(__FILE__), '../provider/patroni_*/patronictl.rb')].each do |file| + type = File.basename(File.dirname(file)) + patronictl_types << type.to_sym + end + patronictl_types.each do |type| + provider_class = Puppet::Type.type(type).provider(:patronictl) + provider_class.path = self[:path] + provider_class.config = self[:config] + end + [] + end +end diff --git a/manifests/init.pp b/manifests/init.pp index ec0a6d3..7c401f6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -546,4 +546,10 @@ name => $service_name, enable => $service_enable, } + + $patronictl = "${install_dir}/bin/patronictl" + patronictl_config { 'puppet': + path => $patronictl, + config => $config_path, + } } diff --git a/spec/acceptance/patroni_spec.rb b/spec/acceptance/patroni_spec.rb index 1303e4f..a08dd72 100644 --- a/spec/acceptance/patroni_spec.rb +++ b/spec/acceptance/patroni_spec.rb @@ -3,49 +3,49 @@ describe 'patroni class:' do patroni1 = hosts_as('patroni1')[0] patroni2 = hosts_as('patroni2')[0] + etcd = <<-EOS + class { 'etcd': + config => { + 'data-dir' => '/var/lib/etcd', + 'name' => $facts['networking']['hostname'], + 'initial-advertise-peer-urls' => "http://${facts['networking']['hostname']}:2380", + 'listen-peer-urls' => 'http://0.0.0.0:2380', + 'listen-client-urls' => 'http://0.0.0.0:2379', + 'advertise-client-urls' => "http://${facts['networking']['hostname']}:2379", + 'initial-cluster-token' => 'etcd-cluster-1', + 'initial-cluster' => 'patroni1=http://patroni1:2380,patroni2=http://patroni2:2380', + 'initial-cluster-state' => 'new', + 'enable-v2' => true, + }, + } + EOS + pp = <<-EOS + class { 'patroni': + scope => 'cluster', + use_etcd => true, + pgsql_connect_address => "${facts['networking']['fqdn']}:5432", + restapi_connect_address => "${facts['networking']['fqdn']}:8008", + pgsql_parameters => { + 'max_connections' => 5000, + }, + bootstrap_pg_hba => [ + 'local all postgres ident', + 'host all all 0.0.0.0/0 md5', + 'host replication repl 0.0.0.0/0 md5', + ], + pgsql_pg_hba => [ + 'local all postgres ident', + 'host all all 0.0.0.0/0 md5', + 'host replication repl 0.0.0.0/0 md5', + ], + superuser_username => 'postgres', + superuser_password => 'postgrespassword', + replication_username => 'repl', + replication_password => 'replpassword', + } + EOS context 'default parameters' do it 'runs successfully' do - etcd = <<-EOS - class { 'etcd': - config => { - 'data-dir' => '/var/lib/etcd', - 'name' => $facts['networking']['hostname'], - 'initial-advertise-peer-urls' => "http://${facts['networking']['hostname']}:2380", - 'listen-peer-urls' => 'http://0.0.0.0:2380', - 'listen-client-urls' => 'http://0.0.0.0:2379', - 'advertise-client-urls' => "http://${facts['networking']['hostname']}:2379", - 'initial-cluster-token' => 'etcd-cluster-1', - 'initial-cluster' => 'patroni1=http://patroni1:2380,patroni2=http://patroni2:2380', - 'initial-cluster-state' => 'new', - 'enable-v2' => true, - }, - } - EOS - pp = <<-EOS - class { 'patroni': - scope => 'cluster', - use_etcd => true, - pgsql_connect_address => "${facts['networking']['fqdn']}:5432", - restapi_connect_address => "${facts['networking']['fqdn']}:8008", - pgsql_parameters => { - 'max_connections' => 5000, - }, - bootstrap_pg_hba => [ - 'local all postgres ident', - 'host all all 0.0.0.0/0 md5', - 'host replication repl 0.0.0.0/0 md5', - ], - pgsql_pg_hba => [ - 'local all postgres ident', - 'host all all 0.0.0.0/0 md5', - 'host replication repl 0.0.0.0/0 md5', - ], - superuser_username => 'postgres', - superuser_password => 'postgrespassword', - replication_username => 'repl', - replication_password => 'replpassword', - } - EOS apply_manifest_on(patroni1, etcd) apply_manifest_on(patroni2, etcd, catch_failures: true) apply_manifest_on(patroni1, etcd, catch_failures: true) @@ -70,4 +70,30 @@ class { 'patroni': it { is_expected.to be_running } end end + + context 'add DCS config' do + it 'runs successfully' do + dcs_pp = <<-EOS + #{pp} + patroni_dcs_config { 'postgresql.parameters.max_connections': + value => 200, + notify => Exec['patroni-restart-pending'], + } + + exec { 'patroni-restart-pending': + path => '/usr/bin:/bin:/usr/sbin:/sbin', + command => "sleep 60 ; ${patroni::patronictl} -c ${patroni::config_path} restart ${patroni::scope} --pending --force", + environment => ['LC_ALL=en_US.utf8'], + refreshonly => true, + require => Service['patroni'], + } + EOS + apply_manifest_on(patroni1, dcs_pp, catch_failures: true) + apply_manifest_on(patroni1, dcs_pp, catch_changes: true) + end + + describe command('ps aux | grep postgres') do + its(:stdout) { is_expected.to match %r{max_connections=200} } + end + end end diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 497676d..398bc30 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -279,6 +279,13 @@ ) end + it do + is_expected.to contain_patronictl_config('puppet').with( + path: '/opt/app/patroni/bin/patronictl', + config: platform_data(platform, :config_path), + ) + end + context 'use_etcd => true' do let(:params) { { 'scope' => 'testscope', 'use_etcd' => true } } diff --git a/spec/fixtures/unit/provider/patroni_dcs_config/patronictl/config.out b/spec/fixtures/unit/provider/patroni_dcs_config/patronictl/config.out new file mode 100644 index 0000000..8cd6130 --- /dev/null +++ b/spec/fixtures/unit/provider/patroni_dcs_config/patronictl/config.out @@ -0,0 +1,12 @@ +loop_wait: 10 +master_start_timeout: 300 +maximum_lag_on_failover: 1048576 +postgresql: + parameters: + max_connections: 200 + use_pg_rewind: true + use_slots: true +retry_timeout: 10 +synchronous_mode: false +synchronous_mode_strict: false +ttl: 30 diff --git a/spec/unit/patroni_dcs_config_spec.rb b/spec/unit/patroni_dcs_config_spec.rb new file mode 100644 index 0000000..cd7e86f --- /dev/null +++ b/spec/unit/patroni_dcs_config_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' +require 'puppet/type/patroni_dcs_config' + +describe Puppet::Type.type(:patroni_dcs_config) do + let(:default_config) { { name: 'foo', value: 'bar' } } + let(:config) { default_config } + let(:resource) { described_class.new(config) } + + it 'adds to catalog without raising an error' do + catalog = Puppet::Resource::Catalog.new + expect { + catalog.add_resource resource + }.not_to raise_error + end + + it 'requires a name' do + expect { + described_class.new({}) + }.to raise_error(Puppet::Error, 'Title or name must be provided') + end + + it 'accepts integer value' do + config[:value] = 1 + expect(resource[:value]).to eq(1) + end +end diff --git a/spec/unit/provider/patroni_dcs_config/patronictl_spec.rb b/spec/unit/provider/patroni_dcs_config/patronictl_spec.rb new file mode 100644 index 0000000..92ae476 --- /dev/null +++ b/spec/unit/provider/patroni_dcs_config/patronictl_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Puppet::Type.type(:patroni_dcs_config).provider(:patronictl) do + let(:provider) { described_class } + let(:type) { Puppet::Type.type(:patroni_dcs_config) } + let(:resource) { type.new(name: 'foo', value: 'bar') } + + describe 'self.instances' do + it 'creates instances' do + allow(provider).to receive(:patronictl).with(['show-config']).and_return(my_fixture_read('config.out')) + expect(provider.instances.length).to eq(10) + instance = provider.instances.select { |i| i.instance_variable_get('@property_hash')[:name] == 'postgresql.parameters.max_connections' } + expect(instance[0].instance_variable_get('@property_hash')[:value]).to eq(200) + end + end + + describe 'create' do + it 'creates DCS config' do + expect(resource.provider).to receive(:patronictl).with(['edit-config', '--force', '--quiet', '-s', 'foo=bar']) + resource.provider.create + end + end + + describe 'flush' do + it 'updates DCS config' do + expect(resource.provider).to receive(:patronictl).with(['edit-config', '--force', '--quiet', '-s', 'foo=1']) + resource.provider.value = 1 + resource.provider.flush + end + end +end From dbba76043a887b49087295101791e88b9f153db9 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 27 Oct 2021 17:48:14 -0400 Subject: [PATCH 12/28] Fix Debian/Ubuntu installs where psycopg2 needs postgresql dev package installed --- data/os/Debian.yaml | 1 - data/os/Ubuntu.yaml | 1 - manifests/init.pp | 10 ++++++++++ spec/classes/patroni_spec.rb | 7 +++++++ spec/spec_helper_local.rb | 3 ++- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/data/os/Debian.yaml b/data/os/Debian.yaml index 38589d8..8478aff 100644 --- a/data/os/Debian.yaml +++ b/data/os/Debian.yaml @@ -2,5 +2,4 @@ patroni::config_path: '/etc/patroni/config.yml' patroni::install_dependencies: - gcc - - python3-psycopg2 patroni::python_class_version: '3' diff --git a/data/os/Ubuntu.yaml b/data/os/Ubuntu.yaml index 38589d8..8478aff 100644 --- a/data/os/Ubuntu.yaml +++ b/data/os/Ubuntu.yaml @@ -2,5 +2,4 @@ patroni::config_path: '/etc/patroni/config.yml' patroni::install_dependencies: - gcc - - python3-psycopg2 patroni::python_class_version: '3' diff --git a/manifests/init.pp b/manifests/init.pp index 7c401f6..f37f32f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -412,6 +412,16 @@ before => Service['patroni'], } + package { 'patroni-postgresql-devel-package': + ensure => present, + name => $postgresql::params::devel_package_name, + require => $postgres_repo_require, + before => Service['patroni'], + } + if $install_method == 'pip' { + Package['patroni-postgresql-devel-package'] -> Python::Pip['psycopg2'] + } + exec { 'patroni-clear-datadir': path => '/usr/bin:/bin', command => "/bin/rm -rf ${default_data_dir}", diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 398bc30..f6cd402 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -47,6 +47,13 @@ before: 'Service[patroni]', ) end + it do + is_expected.to contain_package('patroni-postgresql-devel-package').with( + ensure: 'present', + require: 'Class[Postgresql::Repo]', + before: ['Service[patroni]', 'Python::Pip[psycopg2]'], + ) + end it do is_expected.to contain_exec('patroni-clear-datadir').with( path: '/usr/bin:/bin', diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 353b841..43695ef 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -14,6 +14,7 @@ def platform_data(p, d) 'CentOS-8' => { data_dir: '/var/lib/pgsql/data', bin_dir: '/usr/bin', + install_dependencies: ['gcc', 'python3-psycopg2'], python_venv_version: '3', }, 'Debian-9' => { @@ -39,7 +40,7 @@ def platform_data(p, d) 'default' => { postgresql_version: nil, python_class_version: '3', - install_dependencies: ['gcc', 'python3-psycopg2'], + install_dependencies: ['gcc'], python_venv_version: '3.7', config_dir: '/opt/app/patroni/etc', config_path: '/opt/app/patroni/etc/postgresql.yml', From ca59bfe153143da5adc4eaa48c93c9a3da72759d Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 27 Oct 2021 20:26:15 -0400 Subject: [PATCH 13/28] Fix support on EL8, requires postgresql module bump --- .fixtures.yml | 2 +- data/os/RedHat.yaml | 1 - data/os/RedHat/8.yaml | 2 ++ manifests/init.pp | 6 ++++++ metadata.json | 2 +- spec/classes/patroni_spec.rb | 23 +++-------------------- spec/spec_helper_local.rb | 6 ++++-- 7 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 78db00c..5edd1b9 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -8,7 +8,7 @@ fixtures: ref: v6.0.0 postgresql: repo: https://github.com/puppetlabs/puppetlabs-postgresql.git - ref: v6.4.0 + ref: v7.0.0 # Needed by Postgresql module apt: repo: https://github.com/puppetlabs/puppetlabs-apt.git diff --git a/data/os/RedHat.yaml b/data/os/RedHat.yaml index 9e3e95b..4fbd39f 100644 --- a/data/os/RedHat.yaml +++ b/data/os/RedHat.yaml @@ -2,4 +2,3 @@ patroni::config_path: '/opt/app/patroni/etc/postgresql.yml' patroni::install_dependencies: - gcc - - python3-psycopg2 diff --git a/data/os/RedHat/8.yaml b/data/os/RedHat/8.yaml index f31509f..a4a0330 100644 --- a/data/os/RedHat/8.yaml +++ b/data/os/RedHat/8.yaml @@ -1,3 +1,5 @@ --- +patroni::manage_postgresql_repo: false +patroni::manage_postgresql_dnf_module: true patroni::python_class_version: '3' patroni::python_venv_version: '3' diff --git a/manifests/init.pp b/manifests/init.pp index f37f32f..894db0a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -96,6 +96,8 @@ # Refer to PostgreSQL configuration settings `replica_method` setting # @param manage_postgresql_repo # Should the postgresql module manage the package repo +# @param manage_postgresql_dnf_module +# Manage the DNF module for postgresql # @param use_consul # Boolean to use Consul for configuration storage # @param consul_host @@ -298,6 +300,7 @@ Boolean $pgsql_remove_data_directory_on_rewind_failure = false, Array[Hash] $pgsql_replica_method = [], Boolean $manage_postgresql_repo = true, + Boolean $manage_postgresql_dnf_module = false, # Consul Settings Boolean $use_consul = false, @@ -391,6 +394,7 @@ encoding => 'UTF-8', locale => 'en_US.UTF-8', manage_package_repo => $manage_postgresql_repo, + manage_dnf_module => $manage_postgresql_dnf_module, version => $postgresql_version, } @@ -401,6 +405,8 @@ if $manage_postgresql_repo == true { $postgres_repo_require = 'Class[Postgresql::Repo]' + } elsif $manage_postgresql_dnf_module { + $postgres_repo_require = 'Class[Postgresql::Dnfmodule]' } else { $postgres_repo_require = undef } diff --git a/metadata.json b/metadata.json index 600b209..58da11d 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/postgresql", - "version_requirement": ">= 6.4.0 < 7.0.0" + "version_requirement": ">= 7.0.0 < 8.0.0" }, { "name": "puppet/python", diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index f6cd402..1cbd3a3 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -35,7 +35,7 @@ is_expected.to contain_class('postgresql::globals').with( encoding: 'UTF-8', locale: 'en_US.UTF-8', - manage_package_repo: 'true', + manage_package_repo: platform_data(platform, :manage_postgresql_repo), version: platform_data(platform, :postgresql_version), ) end @@ -43,14 +43,14 @@ it do is_expected.to contain_package('patroni-postgresql-package').with( ensure: 'present', - require: 'Class[Postgresql::Repo]', + require: platform_data(platform, :postgres_repo_require), before: 'Service[patroni]', ) end it do is_expected.to contain_package('patroni-postgresql-devel-package').with( ensure: 'present', - require: 'Class[Postgresql::Repo]', + require: platform_data(platform, :postgres_repo_require), before: ['Service[patroni]', 'Python::Pip[psycopg2]'], ) end @@ -334,23 +334,6 @@ end end - context 'manage_postgresql_repo => false' do - let(:params) { { 'scope' => 'testscope', 'manage_postgresql_repo' => false } } - - it { is_expected.to compile.with_all_deps } - - it do - is_expected.to contain_class('postgresql::globals').with( - manage_package_repo: false, - ) - end - it do - is_expected.to contain_package('patroni-postgresql-package').with( - require: nil, - ) - end - end - context 'install_method => package' do let(:params) { { 'scope' => 'testscope', 'install_method' => 'package' } } diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 43695ef..0f6159f 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -8,13 +8,13 @@ def platform_data(p, d) data_dir: '/var/lib/pgsql/9.6/data', bin_dir: '/usr/pgsql-9.6/bin', python_class_version: '36', - install_dependencies: ['gcc', 'python3-psycopg2'], python_venv_version: '3.6', }, 'CentOS-8' => { + manage_postgresql_repo: false, + postgres_repo_require: 'Class[Postgresql::Dnfmodule]', data_dir: '/var/lib/pgsql/data', bin_dir: '/usr/bin', - install_dependencies: ['gcc', 'python3-psycopg2'], python_venv_version: '3', }, 'Debian-9' => { @@ -39,6 +39,8 @@ def platform_data(p, d) }, 'default' => { postgresql_version: nil, + manage_postgresql_repo: true, + postgres_repo_require: 'Class[Postgresql::Repo]', python_class_version: '3', install_dependencies: ['gcc'], python_venv_version: '3.7', From 1edc69000bb89e384de3afeb4f79e9f5b52e7c57 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Thu, 28 Oct 2021 09:54:23 -0400 Subject: [PATCH 14/28] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00924f2..7c01e97 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,8 @@ node pgarb { } ``` -It's possible to define [DCS configuration](https://patroni.readthedocs.io/en/latest/dynamic_configuration.html) values using Puppet with an example like the following: +Some values such as the PostgreSQL `max_connections` require changes to the [DCS configuration](https://patroni.readthedocs.io/en/latest/dynamic_configuration.html). +This example shows using the `patroni_dcs_config` type with an `Exec` that will restart the Patroni cluster. ```puppet include patroni From 307d2ddec86b9f34cd60c5b9f2a1c598b2584304 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Thu, 28 Oct 2021 09:54:49 -0400 Subject: [PATCH 15/28] Continue supporting postgresql module v6 and fix install on EL7 --- .fixtures.yml | 2 +- data/os/RedHat/8.yaml | 1 - manifests/init.pp | 13 +++++++------ metadata.json | 2 +- spec/classes/patroni_spec.rb | 7 +++++++ spec/spec_helper_local.rb | 4 +++- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5edd1b9..78db00c 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -8,7 +8,7 @@ fixtures: ref: v6.0.0 postgresql: repo: https://github.com/puppetlabs/puppetlabs-postgresql.git - ref: v7.0.0 + ref: v6.4.0 # Needed by Postgresql module apt: repo: https://github.com/puppetlabs/puppetlabs-apt.git diff --git a/data/os/RedHat/8.yaml b/data/os/RedHat/8.yaml index a4a0330..a343877 100644 --- a/data/os/RedHat/8.yaml +++ b/data/os/RedHat/8.yaml @@ -1,5 +1,4 @@ --- patroni::manage_postgresql_repo: false -patroni::manage_postgresql_dnf_module: true patroni::python_class_version: '3' patroni::python_venv_version: '3' diff --git a/manifests/init.pp b/manifests/init.pp index 894db0a..77aacca 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -96,8 +96,6 @@ # Refer to PostgreSQL configuration settings `replica_method` setting # @param manage_postgresql_repo # Should the postgresql module manage the package repo -# @param manage_postgresql_dnf_module -# Manage the DNF module for postgresql # @param use_consul # Boolean to use Consul for configuration storage # @param consul_host @@ -300,7 +298,6 @@ Boolean $pgsql_remove_data_directory_on_rewind_failure = false, Array[Hash] $pgsql_replica_method = [], Boolean $manage_postgresql_repo = true, - Boolean $manage_postgresql_dnf_module = false, # Consul Settings Boolean $use_consul = false, @@ -394,7 +391,6 @@ encoding => 'UTF-8', locale => 'en_US.UTF-8', manage_package_repo => $manage_postgresql_repo, - manage_dnf_module => $manage_postgresql_dnf_module, version => $postgresql_version, } @@ -405,8 +401,6 @@ if $manage_postgresql_repo == true { $postgres_repo_require = 'Class[Postgresql::Repo]' - } elsif $manage_postgresql_dnf_module { - $postgres_repo_require = 'Class[Postgresql::Dnfmodule]' } else { $postgres_repo_require = undef } @@ -428,6 +422,13 @@ Package['patroni-postgresql-devel-package'] -> Python::Pip['psycopg2'] } + if $facts['os']['family'] == 'RedHat' and $manage_postgresql_repo and $default_bin_dir != '/usr/bin' { + file { '/usr/bin/pg_config': + ensure => 'link', + target => "${default_bin_dir}/pg_config", + } + } + exec { 'patroni-clear-datadir': path => '/usr/bin:/bin', command => "/bin/rm -rf ${default_data_dir}", diff --git a/metadata.json b/metadata.json index 58da11d..600b209 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/postgresql", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 6.4.0 < 7.0.0" }, { "name": "puppet/python", diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 1cbd3a3..01d763a 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -54,6 +54,13 @@ before: ['Service[patroni]', 'Python::Pip[psycopg2]'], ) end + it do + if platform_data(platform, :pg_config_link) + is_expected.to contain_file('/usr/bin/pg_config').with_ensure('link') + else + is_expected.not_to contain_file('/usr/bin/pg_config') + end + end it do is_expected.to contain_exec('patroni-clear-datadir').with( path: '/usr/bin:/bin', diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 0f6159f..afd4bcd 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -7,12 +7,13 @@ def platform_data(p, d) postgresql_version: '9.6', data_dir: '/var/lib/pgsql/9.6/data', bin_dir: '/usr/pgsql-9.6/bin', + pg_config_link: true, python_class_version: '36', python_venv_version: '3.6', }, 'CentOS-8' => { manage_postgresql_repo: false, - postgres_repo_require: 'Class[Postgresql::Dnfmodule]', + postgres_repo_require: nil, data_dir: '/var/lib/pgsql/data', bin_dir: '/usr/bin', python_venv_version: '3', @@ -41,6 +42,7 @@ def platform_data(p, d) postgresql_version: nil, manage_postgresql_repo: true, postgres_repo_require: 'Class[Postgresql::Repo]', + pg_config_link: false, python_class_version: '3', install_dependencies: ['gcc'], python_venv_version: '3.7', From b9fc8cbe2c879768680c26fa625cbab8b884a6cf Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Thu, 28 Oct 2021 11:38:19 -0400 Subject: [PATCH 16/28] Support Rocky Linux 8, move EL8 acceptance tests to Rocky Linux 8 --- .github/workflows/ci.yaml | 2 +- metadata.json | 6 ++++++ spec/acceptance/nodesets/{centos-8.yml => rocky-8.yml} | 4 ++-- spec/classes/patroni_spec.rb | 6 +++++- spec/spec_helper_local.rb | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) rename spec/acceptance/nodesets/{centos-8.yml => rocky-8.yml} (93%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a18048..b93ccf7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,7 +60,7 @@ jobs: matrix: set: - "centos-7" - - "centos-8" + - "rocky-8" - "debian-9" - "debian-10" - "ubuntu-1804" diff --git a/metadata.json b/metadata.json index 600b209..ecfbf90 100644 --- a/metadata.json +++ b/metadata.json @@ -47,6 +47,12 @@ "8" ] }, + { + "operatingsystem": "Rocky", + "operatingsystemrelease": [ + "8" + ] + }, { "operatingsystem": "Debian", "operatingsystemrelease": [ diff --git a/spec/acceptance/nodesets/centos-8.yml b/spec/acceptance/nodesets/rocky-8.yml similarity index 93% rename from spec/acceptance/nodesets/centos-8.yml rename to spec/acceptance/nodesets/rocky-8.yml index 9798582..81fc62d 100644 --- a/spec/acceptance/nodesets/centos-8.yml +++ b/spec/acceptance/nodesets/rocky-8.yml @@ -6,7 +6,7 @@ HOSTS: - patroni1 platform: el-8-x86_64 hypervisor: docker - image: centos:8 + image: rockylinux/rockylinux:8 docker_preserve_image: true docker_cmd: - '/usr/sbin/init' @@ -21,7 +21,7 @@ HOSTS: - patroni2 platform: el-8-x86_64 hypervisor: docker - image: centos:8 + image: rockylinux/rockylinux:8 docker_preserve_image: true docker_cmd: - '/usr/sbin/init' diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 01d763a..6c80cd0 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -9,7 +9,11 @@ supported_os: [ { 'operatingsystem' => 'CentOS', - 'operatingsystemrelease' => ['7', '8'], + 'operatingsystemrelease' => ['7'], + }, + { + 'operatingsystem' => 'Rocky', + 'operatingsystemrelease' => ['8'], }, { 'operatingsystem' => 'Debian', diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index afd4bcd..6ecc806 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -11,7 +11,7 @@ def platform_data(p, d) python_class_version: '36', python_venv_version: '3.6', }, - 'CentOS-8' => { + 'Rocky-8' => { manage_postgresql_repo: false, postgres_repo_require: nil, data_dir: '/var/lib/pgsql/data', From dc108ef4e8e132b70cfd0001c59f033fa88b8091 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Tue, 2 Nov 2021 12:02:55 -0400 Subject: [PATCH 17/28] Release v1.6.0 --- CHANGELOG.md | 10 ++++++- REFERENCE.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ metadata.json | 2 +- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae727db..087711b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). -## [v1.5.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.5.0) (2021-06-18) +## [v1.6.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.6.0) (2021-11-02) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.5.0...v1.6.0) + +### UNCATEGORIZED PRS; GO LABEL THEM + +- Add ability to configure Patroni DCS configs [\#24](https://github.com/tailored-automation/puppet-module-patroni/pull/24) ([treydock](https://github.com/treydock)) + +## [v1.5.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.5.0) (2021-06-19) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.4.0...v1.5.0) diff --git a/REFERENCE.md b/REFERENCE.md index 426e43a..b15ecb7 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -8,6 +8,11 @@ * [`patroni`](#patroni): Manages a Patroni instance +### Resource types + +* [`patroni_dcs_config`](#patroni_dcs_config): Manages Patroni DCS configuration options +* [`patronictl_config`](#patronictl_config): Abstract type to configure other types + ## Classes ### `patroni` @@ -1093,3 +1098,75 @@ Use custom pip path when installing pip packages Default value: ``undef`` +## Resource types + +### `patroni_dcs_config` + +Manages Patroni DCS configuration options + +#### Examples + +##### Set PostgreSQL max connections + +```puppet +patroni_dcs_config { 'postgresql.params.max_connections': + value => '200', +} +``` + +#### Properties + +The following properties are available in the `patroni_dcs_config` type. + +##### `value` + +The value to assign the DCS configuration + +#### Parameters + +The following parameters are available in the `patroni_dcs_config` type. + +* [`name`](#name) +* [`provider`](#provider) + +##### `name` + +namevar + +The DCS configuration option name + +##### `provider` + +The specific backend to use for this `patroni_dcs_config` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. + +### `patronictl_config` + +**NOTE** This is a private type not intended to be used directly. + +#### Parameters + +The following parameters are available in the `patronictl_config` type. + +* [`config`](#config) +* [`name`](#name) +* [`path`](#path) + +##### `config` + +patronictl config + +Default value: `/opt/app/patroni/etc/postgresql.yml` + +##### `name` + +namevar + +The name of the resource. + +##### `path` + +patronictl path + +Default value: `/opt/app/patroni/bin/patronictl` + diff --git a/metadata.json b/metadata.json index ecfbf90..095410f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "1.5.0", + "version": "1.6.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From c150dae049ad8a96b21cc627f7c18bf45a674d9a Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Tue, 2 Nov 2021 13:24:42 -0400 Subject: [PATCH 18/28] PDK Update --- .sync.yml | 6 ++---- metadata.json | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.sync.yml b/.sync.yml index 7b79f5c..852163e 100644 --- a/.sync.yml +++ b/.sync.yml @@ -16,7 +16,7 @@ acceptance_matrix: set: - centos-7 - - centos-8 + - rocky-8 - debian-9 - debian-10 - ubuntu-1804 @@ -38,11 +38,9 @@ Rakefile: spec/spec_helper.rb: coverage_report: true minimum_code_coverage_percentage: 100 -spec/acceptance/nodesets/centos-6.yml: - delete: true spec/acceptance/nodesets/centos-7.yml: unmanaged: true -spec/acceptance/nodesets/centos-8.yml: +spec/acceptance/nodesets/rocky-8.yml: unmanaged: true spec/acceptance/nodesets/ubuntu-1604.yml: delete: true diff --git a/metadata.json b/metadata.json index 095410f..cedba3a 100644 --- a/metadata.json +++ b/metadata.json @@ -74,7 +74,7 @@ "cluster", "ha" ], - "pdk-version": "1.18.1", + "pdk-version": "2.2.0", "template-url": "https://github.com/tailored-automation/pdk-templates.git#master", - "template-ref": "heads/master-0-g2163167" + "template-ref": "heads/master-0-g4b7397a" } From 9b7f74120f5287195ac7584a77a64d149d0e5e1a Mon Sep 17 00:00:00 2001 From: pmayekar Date: Thu, 3 Mar 2022 17:19:56 +0530 Subject: [PATCH 19/28] adding standby cluster conig --- manifests/init.pp | 12 ++++++++++++ spec/classes/patroni_spec.rb | 17 +++++++++++++++++ templates/postgresql.yml.erb | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 77aacca..c6c8458 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -240,6 +240,14 @@ # Patroni service enable property # @param custom_pip_provider # Use custom pip path when installing pip packages +# @param is_standby +# Boolean to use Standby cluster +# @param standby_cluster_host +# Refer to Standby configuration `host` setting +# @param standby_cluster_port +# Refer to Standby configuration `port` setting +# @param standby_cluster_primary_slot_name +# Refer to Standby configuration `slot` setting class patroni ( # Global Settings @@ -270,6 +278,10 @@ Hash $bootstrap_users = {}, Variant[Undef,String] $bootstrap_post_bootstrap = undef, Variant[Undef,String] $bootstrap_post_init = undef, + Boolean $is_standby = false, + String $standby_cluster_host = '127.0.0.1', + Stdlib::Port $standby_cluster_port = 5432, + Optional[String] $standby_cluster_primary_slot_name = 'patroni', # PostgreSQL Settings String $superuser_username = 'postgres', diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 6c80cd0..e4aebad 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -304,6 +304,23 @@ ) end + context 'is_standby => true' do + let(:params) { { 'scope' => 'testscope', 'is_standby' => true } } + + it 'has valid config' do + content = catalogue.resource('file', 'patroni_config').send(:parameters)[:content] + config = YAML.safe_load(content) + expected = { + 'standby_cluster' => { + 'host' => '127.0.0.1', + 'port' => '5432', + 'primary_slot_name' => 'patroni', + }, + } + expect(config).to include(expected) + end + end + context 'use_etcd => true' do let(:params) { { 'scope' => 'testscope', 'use_etcd' => true } } diff --git a/templates/postgresql.yml.erb b/templates/postgresql.yml.erb index 762e9a3..e9f244f 100644 --- a/templates/postgresql.yml.erb +++ b/templates/postgresql.yml.erb @@ -4,6 +4,12 @@ name: <%= @hostname %> bootstrap: dcs: + <%- if @is_standby -%> + standby_cluster: + host: <%= @standby_cluster_host %> + port: <%= @standby_cluster_port %> + primary_slot_name: <%= @standby_cluster_primary_slot_name %> + <%- end -%> ttl: <%= @dcs_ttl %> loop_wait: <%= @dcs_loop_wait %> retry_timeout: <%= @dcs_retry_timeout %> From 87ce996381023e2b45494db1b7a25884a5bffda7 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Fri, 1 Apr 2022 18:40:28 -0700 Subject: [PATCH 20/28] Fix CI --- .fixtures-latest.yml | 2 +- .fixtures.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.fixtures-latest.yml b/.fixtures-latest.yml index 3a08e54..e46dc43 100644 --- a/.fixtures-latest.yml +++ b/.fixtures-latest.yml @@ -18,7 +18,7 @@ fixtures: systemd: repo: https://github.com/camptocamp/puppet-systemd.git yumrepo_core: - repo: git://github.com/puppetlabs/puppetlabs-yumrepo_core + repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core puppet_version: ">= 6.0.0" symlinks: patroni: "#{source_dir}" diff --git a/.fixtures.yml b/.fixtures.yml index 78db00c..41a7238 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -24,7 +24,7 @@ fixtures: repo: https://github.com/camptocamp/puppet-systemd.git ref: 2.0.0 yumrepo_core: - repo: git://github.com/puppetlabs/puppetlabs-yumrepo_core + repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core ref: 1.0.1 puppet_version: ">= 6.0.0" symlinks: From db67c34d52b2cb300280d8859dd0d52d6046e1a7 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Thu, 8 Sep 2022 16:49:48 -0400 Subject: [PATCH 21/28] PDK update --- examples/patroni.pp | 2 +- metadata.json | 4 ++-- spec/spec_helper.rb | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/patroni.pp b/examples/patroni.pp index 4470a1f..94aaebd 100644 --- a/examples/patroni.pp +++ b/examples/patroni.pp @@ -1,4 +1,4 @@ -class { '::postgresql::globals': +class { 'postgresql::globals': encoding => 'UTF-8', locale => 'en_US.UTF-8', manage_package_repo => true, diff --git a/metadata.json b/metadata.json index cedba3a..58ec906 100644 --- a/metadata.json +++ b/metadata.json @@ -74,7 +74,7 @@ "cluster", "ha" ], - "pdk-version": "2.2.0", + "pdk-version": "2.5.0", "template-url": "https://github.com/tailored-automation/pdk-templates.git#master", - "template-ref": "heads/master-0-g4b7397a" + "template-ref": "remotes/origin/master-0-g684aff8" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bed24fa..9032ed2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,6 +43,7 @@ # by default Puppet runs at warning level Puppet.settings[:strict] = :warning Puppet.settings[:strict_variables] = true + Facter.clear end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do From 1aa29daf9de0d08141f952927a678e7a9738309f Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Fri, 17 Nov 2023 12:58:20 -0500 Subject: [PATCH 22/28] Major updates, see description Drop EL7, Debian 9, Debian 10, Ubuntu 18.04 as they are EOL Add EL9, Debian 11, Ubuntu 20.04 and Ubuntu 22.04 Require Puppet 7 or Puppet 8 Update all module dependencies to support latest versions --- .devcontainer/Dockerfile | 6 + .devcontainer/README.md | 38 ++ .devcontainer/devcontainer.json | 17 + .fixtures-latest.yml | 17 +- .fixtures.yml | 31 +- .github/workflows/ci.yaml | 41 +- .github/workflows/release.yaml | 3 +- .gitignore | 1 + .pdkignore | 3 + .puppet-lint.rc | 3 + .rubocop.yml | 432 +++++++++++++++++- .sync.yml | 40 +- CONTRIBUTING.md | 2 +- Gemfile | 38 +- Rakefile | 20 +- data/os/Debian/10.yaml | 2 - data/os/Debian/11.yaml | 2 + data/os/Debian/9.yaml | 2 - data/os/RedHat.yaml | 1 + data/os/RedHat/8.yaml | 2 +- data/os/RedHat/9.yaml | 4 + data/os/Ubuntu/18.04.yaml | 2 - data/os/Ubuntu/20.04.yaml | 2 + data/os/Ubuntu/22.04.yaml | 2 + manifests/init.pp | 47 +- metadata.json | 47 +- spec/acceptance/nodesets/centos-7.yml | 35 -- .../nodesets/{debian-10.yml => debian-11.yml} | 24 +- spec/acceptance/nodesets/debian-9.yml | 43 -- .../nodesets/{rocky-8.yml => el8.yml} | 8 + spec/acceptance/nodesets/el9.yml | 47 ++ .../{ubuntu-1804.yml => ubuntu-2004.yml} | 20 +- spec/acceptance/nodesets/ubuntu-2204.yml | 45 ++ spec/classes/patroni_spec.rb | 66 +-- spec/spec_helper.rb | 15 +- spec/spec_helper_local.rb | 36 +- 36 files changed, 791 insertions(+), 353 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json delete mode 100644 data/os/Debian/10.yaml create mode 100644 data/os/Debian/11.yaml delete mode 100644 data/os/Debian/9.yaml create mode 100644 data/os/RedHat/9.yaml delete mode 100644 data/os/Ubuntu/18.04.yaml create mode 100644 data/os/Ubuntu/20.04.yaml create mode 100644 data/os/Ubuntu/22.04.yaml delete mode 100644 spec/acceptance/nodesets/centos-7.yml rename spec/acceptance/nodesets/{debian-10.yml => debian-11.yml} (67%) delete mode 100644 spec/acceptance/nodesets/debian-9.yml rename spec/acceptance/nodesets/{rocky-8.yml => el8.yml} (84%) create mode 100644 spec/acceptance/nodesets/el9.yml rename spec/acceptance/nodesets/{ubuntu-1804.yml => ubuntu-2004.yml} (66%) create mode 100644 spec/acceptance/nodesets/ubuntu-2204.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..12ed4ff --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM puppet/pdk:latest + +# [Optional] Uncomment this section to install additional packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..a719361 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,38 @@ +# devcontainer + + +For format details, see https://aka.ms/devcontainer.json. + +For config options, see the README at: +https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet + +``` json +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pdk --version", +} +``` + + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fe7a8b1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ] +} diff --git a/.fixtures-latest.yml b/.fixtures-latest.yml index e46dc43..1a807b4 100644 --- a/.fixtures-latest.yml +++ b/.fixtures-latest.yml @@ -2,23 +2,22 @@ # See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details --- fixtures: - repositories: + forge_modules: stdlib: - repo: https://github.com/puppetlabs/puppetlabs-stdlib.git + repo: puppetlabs/stdlib postgresql: - repo: https://github.com/puppetlabs/puppetlabs-postgresql.git + repo: puppetlabs/postgresql # Needed by Postgresql module apt: - repo: https://github.com/puppetlabs/puppetlabs-apt.git + repo: puppetlabs/apt python: - repo: https://github.com/voxpupuli/puppet-python.git + repo: puppet/python # Needed by Python module epel: - repo: https://github.com/voxpupuli/puppet-epel.git + repo: puppet/epel systemd: - repo: https://github.com/camptocamp/puppet-systemd.git + repo: puppet/systemd yumrepo_core: - repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core - puppet_version: ">= 6.0.0" + repo: puppetlabs/yumrepo_core symlinks: patroni: "#{source_dir}" diff --git a/.fixtures.yml b/.fixtures.yml index 41a7238..2373b43 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,30 +2,29 @@ # See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details --- fixtures: - repositories: + forge_modules: stdlib: - repo: https://github.com/puppetlabs/puppetlabs-stdlib.git - ref: v6.0.0 + repo: puppetlabs/stdlib + ref: '9.4.1' postgresql: - repo: https://github.com/puppetlabs/puppetlabs-postgresql.git - ref: v6.4.0 + repo: puppetlabs/postgresql + ref: '10.0.2' # Needed by Postgresql module apt: - repo: https://github.com/puppetlabs/puppetlabs-apt.git - ref: v7.5.0 + repo: puppetlabs/apt + ref: '9.1.0' python: - repo: https://github.com/voxpupuli/puppet-python.git - ref: v4.1.0 + repo: puppet/python + ref: '7.0.0' # Needed by Python module epel: - repo: https://github.com/voxpupuli/puppet-epel.git - ref: v3.0.0 + repo: puppet/epel + ref: '5.0.0' systemd: - repo: https://github.com/camptocamp/puppet-systemd.git - ref: 2.0.0 + repo: puppet/systemd + ref: '6.1.0' yumrepo_core: - repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core - ref: 1.0.1 - puppet_version: ">= 6.0.0" + repo: puppetlabs/yumrepo_core + ref: '2.0.0' symlinks: patroni: "#{source_dir}" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b93ccf7..3ad9440 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,39 +15,35 @@ jobs: fail-fast: false matrix: include: - - ruby: 2.5.7 - puppet: 6 - fixtures: .fixtures.yml - allow_failure: false - - ruby: 2.7.0 + - ruby: 2.7.8 puppet: 7 fixtures: .fixtures.yml allow_failure: false - - ruby: 2.4.9 - puppet: 5 - fixtures: .fixtures.yml - allow_failure: false - - ruby: 2.5.7 - puppet: 6 + - ruby: 2.7.8 + puppet: 7 fixtures: .fixtures-latest.yml allow_failure: true - - ruby: 2.7.0 - puppet: 7 + - ruby: 3.2.2 + puppet: 8 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 3.2.2 + puppet: 8 fixtures: .fixtures-latest.yml allow_failure: true env: BUNDLE_WITHOUT: system_tests:release PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0" - FACTER_GEM_VERSION: "< 4.0" FIXTURES_YML: ${{ matrix.fixtures }} name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Validate run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint @@ -59,14 +55,14 @@ jobs: fail-fast: false matrix: set: - - "centos-7" - - "rocky-8" - - "debian-9" - - "debian-10" - - "ubuntu-1804" + - "el8" + - "el9" + - "debian-11" + - "ubuntu-2004" + - "ubuntu-2204" puppet: - - "puppet6" - "puppet7" + - "puppet8" env: BUNDLE_WITHOUT: development:release BEAKER_debug: true @@ -83,12 +79,13 @@ jobs: sudo apt-get remove mysql-server --purge sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Run tests run: bundle exec rake beaker diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1e8347b..da72f01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,12 +14,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Build and Deploy env: diff --git a/.gitignore b/.gitignore index 2767022..988dcbb 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml diff --git a/.pdkignore b/.pdkignore index e6215cd..fcf8a0e 100644 --- a/.pdkignore +++ b/.pdkignore @@ -25,6 +25,7 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml /appveyor.yml /.fixtures.yml /Gemfile @@ -40,3 +41,5 @@ /.yardopts /spec/ /.vscode/ +/.sync.yml +/.devcontainer/ diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 53fcb9a..75071c7 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,2 +1,5 @@ +--no-80chars-check +--no-140chars-check +--no-manifest_whitespace_opening_brace_after-check --relative --fail_on_warnings diff --git a/.rubocop.yml b/.rubocop.yml index 5307849..bb2b4a9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,12 @@ --- require: +- rubocop-performance - rubocop-rspec -- rubocop-i18n AllCops: DisplayCopNames: true - TargetRubyVersion: '2.1' + TargetRubyVersion: '2.5' Include: - - "./**/*.rb" + - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" @@ -18,16 +18,9 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" -Metrics/LineLength: +Layout/LineLength: Description: People have wide screens, use them. Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. @@ -36,14 +29,13 @@ RSpec/BeforeAfterAll: RSpec/HookArgument: Description: Prefer explicit :each argument, matching existing module's style EnforcedStyle: each +RSpec/DescribeSymbol: + Exclude: + - spec/unit/facter/**/*.rb Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: true Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact @@ -72,41 +64,193 @@ Style/TrailingCommaInArguments: Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets +Layout/FirstHashElementIndentation: + Enabled: false +Performance/RegexpMatch: + Enabled: false RSpec/MessageSpies: EnforcedStyle: receive +RSpec/NamedSubject: + Enabled: false Style/Documentation: Exclude: - lib/puppet/parser/functions/**/* - spec/**/* +Style/HashEachMethods: + Enabled: false Style/WordArray: EnforcedStyle: brackets +Performance/AncestorsInclude: + Enabled: true +Performance/BigDecimalWithNumericArgument: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/CaseWhenSplat: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/Sum: + Enabled: true Style/CollectionMethods: Enabled: true Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true -GetText/DecorateFunctionMessage: +Bundler/InsecureProtocolSource: + Enabled: false +Gemspec/DuplicatedAssignment: + Enabled: false +Gemspec/OrderedDependencies: + Enabled: false +Gemspec/RequiredRubyVersion: Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: +Gemspec/RubyVersionGlobalsUsage: Enabled: false -GetText/DecorateStringFormattingUsingPercent: +Layout/ArgumentAlignment: + Enabled: false +Layout/BeginEndAlignment: + Enabled: false +Layout/ClosingHeredocIndentation: + Enabled: false +Layout/EmptyComment: + Enabled: false +Layout/EmptyLineAfterGuardClause: + Enabled: false +Layout/EmptyLinesAroundArguments: + Enabled: false +Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: Enabled: false -Layout/IndentHeredoc: +Layout/FirstArgumentIndentation: + Enabled: false +Layout/HashAlignment: + Enabled: false +Layout/HeredocIndentation: + Enabled: false +Layout/LeadingEmptyLines: + Enabled: false +Layout/SpaceAroundMethodCallOperator: + Enabled: false +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: false +Layout/SpaceInsideReferenceBrackets: + Enabled: false +Lint/BigDecimalNew: + Enabled: false +Lint/BooleanSymbol: + Enabled: false +Lint/ConstantDefinitionInBlock: + Enabled: false +Lint/DeprecatedOpenSSLConstant: + Enabled: false +Lint/DisjunctiveAssignmentInConstructor: + Enabled: false +Lint/DuplicateElsifCondition: + Enabled: false +Lint/DuplicateRequire: + Enabled: false +Lint/DuplicateRescueException: + Enabled: false +Lint/EmptyConditionalBody: + Enabled: false +Lint/EmptyFile: + Enabled: false +Lint/ErbNewArguments: + Enabled: false +Lint/FloatComparison: + Enabled: false +Lint/HashCompareByIdentity: + Enabled: false +Lint/IdentityComparison: + Enabled: false +Lint/InterpolationCheck: + Enabled: false +Lint/MissingCopEnableDirective: + Enabled: false +Lint/MixedRegexpCaptureTypes: + Enabled: false +Lint/NestedPercentLiteral: + Enabled: false +Lint/NonDeterministicRequireOrder: + Enabled: false +Lint/OrderedMagicComments: + Enabled: false +Lint/OutOfRangeRegexpRef: + Enabled: false +Lint/RaiseException: + Enabled: false +Lint/RedundantCopEnableDirective: + Enabled: false +Lint/RedundantRequireStatement: + Enabled: false +Lint/RedundantSafeNavigation: + Enabled: false +Lint/RedundantWithIndex: + Enabled: false +Lint/RedundantWithObject: + Enabled: false +Lint/RegexpAsCondition: + Enabled: false +Lint/ReturnInVoidContext: + Enabled: false +Lint/SafeNavigationConsistency: + Enabled: false +Lint/SafeNavigationWithEmpty: + Enabled: false +Lint/SelfAssignment: + Enabled: false +Lint/SendWithMixinArgument: + Enabled: false +Lint/ShadowedArgument: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Lint/ToJSON: + Enabled: false +Lint/TopLevelReturnWithArgument: + Enabled: false +Lint/TrailingCommaInAttributeDeclaration: + Enabled: false +Lint/UnreachableLoop: + Enabled: false +Lint/UriEscapeUnescape: + Enabled: false +Lint/UriRegexp: + Enabled: false +Lint/UselessMethodDefinition: + Enabled: false +Lint/UselessTimes: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/BlockNesting: + Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: @@ -119,19 +263,265 @@ Metrics/ParameterLists: Enabled: false Metrics/PerceivedComplexity: Enabled: false +Migration/DepartmentName: + Enabled: false +Naming/AccessorMethodName: + Enabled: false +Naming/BlockParameterName: + Enabled: false +Naming/HeredocDelimiterCase: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false +Naming/MemoizedInstanceVariableName: + Enabled: false +Naming/MethodParameterName: + Enabled: false +Naming/RescuedExceptionsVariableName: + Enabled: false +Naming/VariableNumber: + Enabled: false +Performance/BindCall: + Enabled: false +Performance/DeletePrefix: + Enabled: false +Performance/DeleteSuffix: + Enabled: false +Performance/InefficientHashSearch: + Enabled: false +Performance/UnfreezeString: + Enabled: false +Performance/UriDefaultParser: + Enabled: false +RSpec/Be: + Enabled: false +RSpec/Capybara/CurrentPathExpectation: + Enabled: false +RSpec/Capybara/FeatureMethods: + Enabled: false +RSpec/Capybara/VisibilityMatcher: + Enabled: false +RSpec/ContextMethod: + Enabled: false +RSpec/ContextWording: + Enabled: false RSpec/DescribeClass: Enabled: false +RSpec/EmptyHook: + Enabled: false +RSpec/EmptyLineAfterExample: + Enabled: false +RSpec/EmptyLineAfterExampleGroup: + Enabled: false +RSpec/EmptyLineAfterHook: + Enabled: false RSpec/ExampleLength: Enabled: false -RSpec/MessageExpectation: +RSpec/ExampleWithoutDescription: + Enabled: false +RSpec/ExpectChange: + Enabled: false +RSpec/ExpectInHook: + Enabled: false +RSpec/FactoryBot/AttributeDefinedStatically: + Enabled: false +RSpec/FactoryBot/CreateList: + Enabled: false +RSpec/FactoryBot/FactoryClassName: + Enabled: false +RSpec/HooksBeforeExamples: + Enabled: false +RSpec/ImplicitBlockExpectation: + Enabled: false +RSpec/ImplicitSubject: + Enabled: false +RSpec/LeakyConstantDeclaration: + Enabled: false +RSpec/LetBeforeExamples: + Enabled: false +RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false +RSpec/MultipleSubjects: + Enabled: false RSpec/NestedGroups: Enabled: false +RSpec/PredicateMatcher: + Enabled: false +RSpec/ReceiveCounts: + Enabled: false +RSpec/ReceiveNever: + Enabled: false +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/RepeatedExampleGroupDescription: + Enabled: false +RSpec/RepeatedIncludeExample: + Enabled: false +RSpec/ReturnFromStub: + Enabled: false +RSpec/SharedExamples: + Enabled: false +RSpec/StubbedMock: + Enabled: false +RSpec/UnspecifiedException: + Enabled: false +RSpec/VariableDefinition: + Enabled: false +RSpec/VoidExpect: + Enabled: false +RSpec/Yield: + Enabled: false +Security/Open: + Enabled: false +Style/AccessModifierDeclarations: + Enabled: false +Style/AccessorGrouping: + Enabled: false Style/AsciiComments: Enabled: false +Style/BisectedAttrAccessor: + Enabled: false +Style/CaseLikeIf: + Enabled: false +Style/ClassEqualityComparison: + Enabled: false +Style/ColonMethodDefinition: + Enabled: false +Style/CombinableLoops: + Enabled: false +Style/CommentedKeyword: + Enabled: false +Style/Dir: + Enabled: false +Style/DoubleCopDisableDirective: + Enabled: false +Style/EmptyBlockParameter: + Enabled: false +Style/EmptyLambdaParameter: + Enabled: false +Style/Encoding: + Enabled: false +Style/EvalWithLocation: + Enabled: false +Style/ExpandPathArguments: + Enabled: false +Style/ExplicitBlockArgument: + Enabled: false +Style/ExponentialNotation: + Enabled: false +Style/FloatDivision: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/GlobalStdStream: + Enabled: false +Style/HashAsLastArrayItem: + Enabled: false +Style/HashLikeCase: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false Style/IfUnlessModifier: Enabled: false +Style/KeywordParametersOrder: + Enabled: false +Style/MinMax: + Enabled: false +Style/MixinUsage: + Enabled: false +Style/MultilineWhenThen: + Enabled: false +Style/NegatedUnless: + Enabled: false +Style/NumericPredicate: + Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/OrAssignment: + Enabled: false +Style/RandomWithOffset: + Enabled: false +Style/RedundantAssignment: + Enabled: false +Style/RedundantCondition: + Enabled: false +Style/RedundantConditional: + Enabled: false +Style/RedundantFetchBlock: + Enabled: false +Style/RedundantFileExtensionInRequire: + Enabled: false +Style/RedundantRegexpCharacterClass: + Enabled: false +Style/RedundantRegexpEscape: + Enabled: false +Style/RedundantSelfAssignment: + Enabled: false +Style/RedundantSort: + Enabled: false +Style/RescueStandardError: + Enabled: false +Style/SingleArgumentDig: + Enabled: false +Style/SlicingWithRange: + Enabled: false +Style/SoleNestedConditional: + Enabled: false +Style/StderrPuts: + Enabled: false +Style/StringConcatenation: + Enabled: false +Style/Strip: + Enabled: false Style/SymbolProc: Enabled: false +Style/TrailingBodyOnClass: + Enabled: false +Style/TrailingBodyOnMethodDefinition: + Enabled: false +Style/TrailingBodyOnModule: + Enabled: false +Style/TrailingCommaInHashLiteral: + Enabled: false +Style/TrailingMethodEndStatement: + Enabled: false +Style/UnpackFirst: + Enabled: false +Lint/DuplicateBranch: + Enabled: false +Lint/DuplicateRegexpCharacterClassElement: + Enabled: false +Lint/EmptyBlock: + Enabled: false +Lint/EmptyClass: + Enabled: false +Lint/NoReturnInBeginEndBlocks: + Enabled: false +Lint/ToEnumArguments: + Enabled: false +Lint/UnexpectedBlockArity: + Enabled: false +Lint/UnmodifiedReduceAccumulator: + Enabled: false +Performance/CollectionLiteralInLoop: + Enabled: false +Style/ArgumentsForwarding: + Enabled: false +Style/CollectionCompact: + Enabled: false +Style/DocumentDynamicEvalDefinition: + Enabled: false +Style/NegatedIfElseCondition: + Enabled: false +Style/NilLambda: + Enabled: false +Style/RedundantArgument: + Enabled: false +Style/SwapValues: + Enabled: false diff --git a/.sync.yml b/.sync.yml index 852163e..b3ec10c 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,28 +1,14 @@ .github/workflows/ci.yaml: - unit_name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) - unit_includes: - - ruby: '2.4.9' - puppet: '5' - fixtures: .fixtures.yml - allow_failure: false - - ruby: '2.5.7' - puppet: '6' - fixtures: .fixtures-latest.yml - allow_failure: true - - ruby: '2.7.0' - puppet: '7' - fixtures: .fixtures-latest.yml - allow_failure: true acceptance_matrix: set: - - centos-7 - - rocky-8 - - debian-9 - - debian-10 - - ubuntu-1804 + - el8 + - el9 + - debian-11 + - ubuntu-2004 + - ubuntu-2204 puppet: - - puppet6 - puppet7 + - puppet8 .travis.yml: delete: true .gitlab-ci.yml: @@ -38,17 +24,13 @@ Rakefile: spec/spec_helper.rb: coverage_report: true minimum_code_coverage_percentage: 100 -spec/acceptance/nodesets/centos-7.yml: +spec/acceptance/nodesets/el8.yml: unmanaged: true -spec/acceptance/nodesets/rocky-8.yml: +spec/acceptance/nodesets/el9.yml: unmanaged: true -spec/acceptance/nodesets/ubuntu-1604.yml: - delete: true -spec/acceptance/nodesets/ubuntu-1804.yml: +spec/acceptance/nodesets/ubuntu-2004.yml: unmanaged: true -spec/acceptance/nodesets/debian-8.yml: - delete: true -spec/acceptance/nodesets/debian-9.yml: +spec/acceptance/nodesets/ubuntu-2204.yml: unmanaged: true -spec/acceptance/nodesets/debian-10.yml: +spec/acceptance/nodesets/debian-11.yml: unmanaged: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7f1765..5e35566 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,4 +3,4 @@ 1. Update metadata.json version, eg: `pdk bundle exec rake module:bump:{major,minor,patch}` 1. Run release task, eg: `pdk bundle exec rake release` 1. Update GitHub pages, eg: `pdk bundle exec rake strings:gh_pages:update` -1. Push to GitHub: `git push --tags origin master` +1. Push to GitHub: `git push --tags origin main` diff --git a/Gemfile b/Gemfile index b8186f7..a7fdc62 100644 --- a/Gemfile +++ b/Gemfile @@ -17,32 +17,24 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do - gem "facter", '< 4.0', require: false - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-lint-param-docs", require: false - gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') - gem "coveralls", require: false + gem "voxpupuli-test", '6.0.0', require: false + gem "rubocop-performance", '~> 1.18', require: false + gem "faraday", '~> 1.0', require: false + gem "github_changelog_generator", require: false + gem "puppet-blacksmith", require: false + gem "puppet-strings", require: false + gem "coveralls", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0') + gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-pe", require: false gem "beaker-hostgenerator" gem "beaker-rspec" gem "beaker-docker" gem "beaker-puppet" + gem "beaker-puppet_install_helper", require: false + gem "beaker-module_install_helper", require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] @@ -61,16 +53,6 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version -if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} - # If we're using a Puppet gem on Windows which handles its own win32-xxx gem - # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). - gems['win32-dir'] = ['<= 0.4.9', require: false] - gems['win32-eventlog'] = ['<= 0.6.5', require: false] - gems['win32-process'] = ['<= 0.7.5', require: false] - gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['0.8.8', require: false] -end - gems.each do |gem_name, gem_params| gem gem_name, *gem_params end diff --git a/Rakefile b/Rakefile index 1505b25..a010b3a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ # frozen_string_literal: true -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? +require 'bundler' +require 'beaker-rspec/rake_task' if Bundler.rubygems.find_name('beaker-rspec').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? @@ -39,9 +40,13 @@ def changelog_future_release returnVal end +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_140chars') +PuppetLint.configuration.send('disable_manifest_whitespace_opening_brace_after') PuppetLint.configuration.send('disable_relative') PuppetLint.configuration.send('fail_on_warnings') + if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? @@ -52,7 +57,7 @@ if Bundler.rubygems.find_name('github_changelog_generator').any? config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." config.add_pr_wo_labels = true config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM" + config.merge_prefix = "### Merged pull requests:" config.configure_sections = { "Changed" => { "prefix" => "### Changed", @@ -60,11 +65,11 @@ if Bundler.rubygems.find_name('github_changelog_generator').any? }, "Added" => { "prefix" => "### Added", - "labels" => ["feature", "enhancement"], + "labels" => ["enhancement", "feature"], }, "Fixed" => { "prefix" => "### Fixed", - "labels" => ["bugfix"], + "labels" => ["bug", "documentation", "bugfix"], }, } end @@ -72,16 +77,15 @@ else desc 'Generate a Changelog from GitHub' task :changelog do raise <= Gem::Version.new('2.2.2')" + version: '~> 1.15' + condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" EOM end end diff --git a/data/os/Debian/10.yaml b/data/os/Debian/10.yaml deleted file mode 100644 index c6f29b0..0000000 --- a/data/os/Debian/10.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -patroni::python_venv_version: '3.7' diff --git a/data/os/Debian/11.yaml b/data/os/Debian/11.yaml new file mode 100644 index 0000000..7483d1a --- /dev/null +++ b/data/os/Debian/11.yaml @@ -0,0 +1,2 @@ +--- +patroni::python_venv_version: '3.9' diff --git a/data/os/Debian/9.yaml b/data/os/Debian/9.yaml deleted file mode 100644 index 71b5b12..0000000 --- a/data/os/Debian/9.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -patroni::python_venv_version: '3.5' diff --git a/data/os/RedHat.yaml b/data/os/RedHat.yaml index 4fbd39f..16c673a 100644 --- a/data/os/RedHat.yaml +++ b/data/os/RedHat.yaml @@ -2,3 +2,4 @@ patroni::config_path: '/opt/app/patroni/etc/postgresql.yml' patroni::install_dependencies: - gcc +patroni::manage_venv_package: false diff --git a/data/os/RedHat/8.yaml b/data/os/RedHat/8.yaml index a343877..a9d39c9 100644 --- a/data/os/RedHat/8.yaml +++ b/data/os/RedHat/8.yaml @@ -1,4 +1,4 @@ --- patroni::manage_postgresql_repo: false patroni::python_class_version: '3' -patroni::python_venv_version: '3' +patroni::python_venv_version: '3.6' diff --git a/data/os/RedHat/9.yaml b/data/os/RedHat/9.yaml new file mode 100644 index 0000000..f19d62b --- /dev/null +++ b/data/os/RedHat/9.yaml @@ -0,0 +1,4 @@ +--- +patroni::manage_postgresql_repo: false +patroni::python_class_version: '3' +patroni::python_venv_version: '3.9' diff --git a/data/os/Ubuntu/18.04.yaml b/data/os/Ubuntu/18.04.yaml deleted file mode 100644 index 5c79d5d..0000000 --- a/data/os/Ubuntu/18.04.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -patroni::python_venv_version: '3.6' diff --git a/data/os/Ubuntu/20.04.yaml b/data/os/Ubuntu/20.04.yaml new file mode 100644 index 0000000..1fe6d21 --- /dev/null +++ b/data/os/Ubuntu/20.04.yaml @@ -0,0 +1,2 @@ +--- +patroni::python_venv_version: '3.8' diff --git a/data/os/Ubuntu/22.04.yaml b/data/os/Ubuntu/22.04.yaml new file mode 100644 index 0000000..7534044 --- /dev/null +++ b/data/os/Ubuntu/22.04.yaml @@ -0,0 +1,2 @@ +--- +patroni::python_venv_version: '3.10' diff --git a/manifests/init.pp b/manifests/init.pp index 77aacca..fc6886a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -224,6 +224,8 @@ # @param python_venv_version # The version of Python to pass to Python virtualenv defined type # Only used when `install_method` is `pip` +# @param manage_venv_package +# Whether to manage the Python venv package # @param config_path # Path to Patroni configuration file # @param config_owner @@ -377,6 +379,7 @@ Stdlib::Absolutepath $install_dir = '/opt/app/patroni', String $python_class_version = '36', String $python_venv_version = '3.6', + Boolean $manage_venv_package = true, String $config_path = '/opt/app/patroni/etc/postgresql.yml', String $config_owner = 'postgres', String $config_group = 'postgres', @@ -447,9 +450,10 @@ if $install_method == 'pip' { if $manage_python { class { 'python': - version => $python_class_version, - dev => 'present', - virtualenv => 'present', + version => $python_class_version, + dev => 'present', + venv => 'present', + manage_venv_package => $manage_venv_package, } } @@ -460,26 +464,12 @@ creates => $install_dir, } - if $facts['os']['family'] == 'RedHat' { - python::virtualenv { 'patroni': - version => $python_venv_version, - venv_dir => $install_dir, - virtualenv => 'virtualenv-3', - systempkgs => true, - distribute => false, - environment => ["PIP_PREFIX=${install_dir}"], - require => Exec['patroni-mkdir-install_dir'], - } - } - - if $facts['os']['family'] == 'Debian' { - python::pyvenv { 'patroni': - version => $python_venv_version, - venv_dir => $install_dir, - systempkgs => true, - environment => ["PIP_PREFIX=${install_dir}"], - require => Exec['patroni-mkdir-install_dir'], - } + python::pyvenv { 'patroni': + version => $python_venv_version, + venv_dir => $install_dir, + systempkgs => true, + environment => ["PIP_PREFIX=${install_dir}"], + require => Exec['patroni-mkdir-install_dir'], } if $custom_pip_provider { @@ -527,11 +517,12 @@ if $install_method == 'pip' { $config_dir = dirname($config_path) file { 'patroni_config_dir': - ensure => 'directory', - path => $config_dir, - owner => 'postgres', - group => 'postgres', - mode => '0755', + ensure => 'directory', + path => $config_dir, + owner => 'postgres', + group => 'postgres', + mode => '0755', + require => Python::Pyvenv['patroni'], } } diff --git a/metadata.json b/metadata.json index 58ec906..f8493d7 100644 --- a/metadata.json +++ b/metadata.json @@ -10,61 +10,54 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 6.4.0 < 7.0.0" + "version_requirement": ">= 6.4.0 < 10.0.0" }, { "name": "puppetlabs/postgresql", - "version_requirement": ">= 6.4.0 < 7.0.0" + "version_requirement": ">= 6.4.0 < 11.0.0" }, { "name": "puppet/python", - "version_requirement": ">= 4.1.0 <6.0.0" + "version_requirement": ">= 6.0.0 <8.0.0" }, { - "name": "camptocamp/systemd", - "version_requirement": ">= 2.0.0 <3.0.0" + "name": "puppet/systemd", + "version_requirement": ">= 5.0.0 <7.0.0" } ], "operatingsystem_support": [ { - "operatingsystem": "CentOS", - "operatingsystemrelease": [ - "7", - "8" - ] - }, - { - "operatingsystem": "OracleLinux", + "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7", - "8" + "8", + "9" ] }, { - "operatingsystem": "RedHat", + "operatingsystem": "Rocky", "operatingsystemrelease": [ - "7", - "8" + "8", + "9" ] }, { - "operatingsystem": "Rocky", + "operatingsystem": "Debian", "operatingsystemrelease": [ - "8" + "11" ] }, { - "operatingsystem": "Debian", + "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "9", - "10" + "20.04", + "22.04" ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 5.5.10 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "tags": [ @@ -74,7 +67,7 @@ "cluster", "ha" ], - "pdk-version": "2.5.0", - "template-url": "https://github.com/tailored-automation/pdk-templates.git#master", - "template-ref": "remotes/origin/master-0-g684aff8" + "pdk-version": "3.0.0", + "template-url": "https://github.com/tailored-automation/pdk-templates.git#main", + "template-ref": "heads/main-0-g8e0611a" } diff --git a/spec/acceptance/nodesets/centos-7.yml b/spec/acceptance/nodesets/centos-7.yml deleted file mode 100644 index a3faf2c..0000000 --- a/spec/acceptance/nodesets/centos-7.yml +++ /dev/null @@ -1,35 +0,0 @@ -HOSTS: - patroni1: - roles: - - agent - - default - - patroni1 - platform: el-7-x86_64 - hypervisor: docker - image: centos:7 - docker_preserve_image: true - docker_cmd: - - '/usr/sbin/init' - docker_image_commands: - - 'yum install -y wget which cronie iproute initscripts' - docker_container_name: 'patroni1-el7' - patroni2: - roles: - - agent - - patroni2 - platform: el-7-x86_64 - hypervisor: docker - image: centos:7 - docker_preserve_image: true - docker_cmd: - - '/usr/sbin/init' - docker_image_commands: - - 'yum install -y wget which cronie iproute initscripts' - docker_container_name: 'patroni2-el7' -CONFIG: - log_level: debug - type: foss -ssh: - password: root - auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/debian-10.yml b/spec/acceptance/nodesets/debian-11.yml similarity index 67% rename from spec/acceptance/nodesets/debian-10.yml rename to spec/acceptance/nodesets/debian-11.yml index c4f5b5b..799125e 100644 --- a/spec/acceptance/nodesets/debian-10.yml +++ b/spec/acceptance/nodesets/debian-11.yml @@ -4,36 +4,44 @@ HOSTS: - agent - default - patroni1 - platform: debian-10-amd64 + platform: debian-11-amd64 hypervisor: docker - image: debian:10 + image: debian:11 docker_preserve_image: true docker_cmd: - '/sbin/init' docker_image_commands: - - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates' + - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates iproute2' - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni1-debian10' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni1-debian11' patroni2: roles: - agent - patroni2 - platform: debian-10-amd64 + platform: debian-11-amd64 hypervisor: docker - image: debian:10 + image: debian:11 docker_preserve_image: true docker_cmd: - '/sbin/init' docker_image_commands: - - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates' + - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates iproute2' - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni2-debian10' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni2-debian11' CONFIG: log_level: debug type: foss diff --git a/spec/acceptance/nodesets/debian-9.yml b/spec/acceptance/nodesets/debian-9.yml deleted file mode 100644 index 7d64f5e..0000000 --- a/spec/acceptance/nodesets/debian-9.yml +++ /dev/null @@ -1,43 +0,0 @@ -HOSTS: - patroni1: - roles: - - agent - - default - - patroni1 - platform: debian-9-amd64 - hypervisor: docker - image: debian:9 - docker_preserve_image: true - docker_cmd: - - '/sbin/init' - docker_image_commands: - - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates' - - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni1-debian9' - patroni2: - roles: - - agent - - patroni2 - platform: debian-9-amd64 - hypervisor: docker - image: debian:9 - docker_preserve_image: true - docker_cmd: - - '/sbin/init' - docker_image_commands: - - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates' - - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni2-debian9' -CONFIG: - log_level: debug - type: foss -ssh: - password: root - auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/rocky-8.yml b/spec/acceptance/nodesets/el8.yml similarity index 84% rename from spec/acceptance/nodesets/rocky-8.yml rename to spec/acceptance/nodesets/el8.yml index 81fc62d..ec57a08 100644 --- a/spec/acceptance/nodesets/rocky-8.yml +++ b/spec/acceptance/nodesets/el8.yml @@ -14,6 +14,10 @@ HOSTS: - 'yum install -y dnf-utils' - 'dnf config-manager --set-enabled powertools' - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 docker_container_name: 'patroni1-el8' patroni2: roles: @@ -29,6 +33,10 @@ HOSTS: - 'yum install -y dnf-utils' - 'dnf config-manager --set-enabled powertools' - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 docker_container_name: 'patroni2-el8' CONFIG: log_level: debug diff --git a/spec/acceptance/nodesets/el9.yml b/spec/acceptance/nodesets/el9.yml new file mode 100644 index 0000000..06d4b91 --- /dev/null +++ b/spec/acceptance/nodesets/el9.yml @@ -0,0 +1,47 @@ +HOSTS: + patroni1: + roles: + - agent + - default + - patroni1 + platform: el-9-x86_64 + hypervisor: docker + image: rockylinux/rockylinux:9 + docker_preserve_image: true + docker_cmd: + - '/usr/sbin/init' + docker_image_commands: + - 'yum install -y dnf-utils' + - 'dnf config-manager --set-enabled crb' + - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni1-el9' + patroni2: + roles: + - agent + - patroni2 + platform: el-9-x86_64 + hypervisor: docker + image: rockylinux/rockylinux:9 + docker_preserve_image: true + docker_cmd: + - '/usr/sbin/init' + docker_image_commands: + - 'yum install -y dnf-utils' + - 'dnf config-manager --set-enabled crb' + - 'yum install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni2-el9' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] + diff --git a/spec/acceptance/nodesets/ubuntu-1804.yml b/spec/acceptance/nodesets/ubuntu-2004.yml similarity index 66% rename from spec/acceptance/nodesets/ubuntu-1804.yml rename to spec/acceptance/nodesets/ubuntu-2004.yml index d7ae7c1..264b536 100644 --- a/spec/acceptance/nodesets/ubuntu-1804.yml +++ b/spec/acceptance/nodesets/ubuntu-2004.yml @@ -4,30 +4,38 @@ HOSTS: - agent - default - patroni1 - platform: ubuntu-18.04-amd64 + platform: ubuntu-20.04-amd64 hypervisor : docker - image: ubuntu:18.04 + image: ubuntu:20.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni1-ubuntu1804' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni1-ubuntu2004' patroni2: roles: - agent - patroni2 - platform: ubuntu-18.04-amd64 + platform: ubuntu-20.04-amd64 hypervisor : docker - image: ubuntu:18.04 + image: ubuntu:20.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' - 'locale-gen en_US.UTF-8' - docker_container_name: 'patroni2-ubuntu1804' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni2-ubuntu2004' CONFIG: log_level: debug type: foss diff --git a/spec/acceptance/nodesets/ubuntu-2204.yml b/spec/acceptance/nodesets/ubuntu-2204.yml new file mode 100644 index 0000000..702b3a0 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-2204.yml @@ -0,0 +1,45 @@ +HOSTS: + patroni1: + roles: + - agent + - default + - patroni1 + platform: ubuntu-22.04-amd64 + hypervisor : docker + image: ubuntu:22.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" + - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni1-ubuntu2204' + patroni2: + roles: + - agent + - patroni2 + platform: ubuntu-22.04-amd64 + hypervisor : docker + image: ubuntu:22.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" + - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'patroni2-ubuntu2204' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] + diff --git a/spec/classes/patroni_spec.rb b/spec/classes/patroni_spec.rb index 6c80cd0..47036e3 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/patroni_spec.rb @@ -8,20 +8,16 @@ # same tests for OracleLinux and RedHat. supported_os: [ { - 'operatingsystem' => 'CentOS', - 'operatingsystemrelease' => ['7'], - }, - { - 'operatingsystem' => 'Rocky', - 'operatingsystemrelease' => ['8'], + 'operatingsystem' => 'RedHat', + 'operatingsystemrelease' => ['7', '8', '9'], }, { 'operatingsystem' => 'Debian', - 'operatingsystemrelease' => ['9', '10'], + 'operatingsystemrelease' => ['11'], }, { 'operatingsystem' => 'Ubuntu', - 'operatingsystemrelease' => ['18.04'], + 'operatingsystemrelease' => ['20.04', '22.04'], }, ], } @@ -79,7 +75,6 @@ is_expected.to contain_class('python').with( version: platform_data(platform, :python_class_version), dev: 'present', - virtualenv: 'present', ) end it 'installs dependencies' do @@ -94,29 +89,14 @@ ) end - case os_facts[:os]['family'] - when 'RedHat' - it do - is_expected.to contain_python__virtualenv('patroni').with( - version: platform_data(platform, :python_venv_version), - venv_dir: '/opt/app/patroni', - virtualenv: 'virtualenv-3', - systempkgs: 'true', - distribute: 'false', - environment: ['PIP_PREFIX=/opt/app/patroni'], - require: 'Exec[patroni-mkdir-install_dir]', - ) - end - when 'Debian' - it do - is_expected.to contain_python__pyvenv('patroni').with( - version: platform_data(platform, :python_venv_version), - venv_dir: '/opt/app/patroni', - systempkgs: 'true', - environment: ['PIP_PREFIX=/opt/app/patroni'], - require: 'Exec[patroni-mkdir-install_dir]', - ) - end + it do + is_expected.to contain_python__pyvenv('patroni').with( + version: platform_data(platform, :python_venv_version), + venv_dir: '/opt/app/patroni', + systempkgs: 'true', + environment: ['PIP_PREFIX=/opt/app/patroni'], + require: 'Exec[patroni-mkdir-install_dir]', + ) end it do @@ -145,6 +125,7 @@ owner: 'postgres', group: 'postgres', mode: '0755', + require: 'Python::Pyvenv[patroni]', ) end @@ -351,7 +332,6 @@ it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_class('python') } it { is_expected.not_to contain_exec('patroni-mkdir-install_dir') } - it { is_expected.not_to contain_python__virtualenv('patroni') } it { is_expected.not_to contain_python__pyenv('patroni') } it { is_expected.not_to contain_python__pip('patroni') } @@ -376,21 +356,11 @@ creates: '/usr/local/patroni', ) end - case os_facts[:os]['family'] - when 'RedHat' - it do - is_expected.to contain_python__virtualenv('patroni').with( - venv_dir: '/usr/local/patroni', - environment: ['PIP_PREFIX=/usr/local/patroni'], - ) - end - when 'Debian' - it do - is_expected.to contain_python__pyvenv('patroni').with( - venv_dir: '/usr/local/patroni', - environment: ['PIP_PREFIX=/usr/local/patroni'], - ) - end + it do + is_expected.to contain_python__pyvenv('patroni').with( + venv_dir: '/usr/local/patroni', + environment: ['PIP_PREFIX=/usr/local/patroni'], + ) end it do is_expected.to contain_python__pip('patroni').with( diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9032ed2..a26dbcb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,7 +25,7 @@ next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) + default_facts.merge!(YAML.safe_load(File.read(f))) rescue => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end @@ -43,12 +43,23 @@ # by default Puppet runs at warning level Puppet.settings[:strict] = :warning Puppet.settings[:strict_variables] = true - Facter.clear end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do RSpec::Puppet::Coverage.report!(100) end + + # Filter backtrace noise + backtrace_exclusion_patterns = [ + %r{spec_helper}, + %r{gems}, + ] + + if c.respond_to?(:backtrace_exclusion_patterns) + c.backtrace_exclusion_patterns = backtrace_exclusion_patterns + elsif c.respond_to?(:backtrace_clean_patterns) + c.backtrace_clean_patterns = backtrace_exclusion_patterns + end end # Ensures that a module is defined diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 6ecc806..48330fe 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -3,7 +3,7 @@ def platform_data(p, d) data = { - 'CentOS-7' => { + 'RedHat-7' => { postgresql_version: '9.6', data_dir: '/var/lib/pgsql/9.6/data', bin_dir: '/usr/pgsql-9.6/bin', @@ -11,30 +11,38 @@ def platform_data(p, d) python_class_version: '36', python_venv_version: '3.6', }, - 'Rocky-8' => { + 'RedHat-8' => { manage_postgresql_repo: false, postgres_repo_require: nil, data_dir: '/var/lib/pgsql/data', bin_dir: '/usr/bin', - python_venv_version: '3', + python_venv_version: '3.6', }, - 'Debian-9' => { - data_dir: '/var/lib/postgresql/9.6/main', - bin_dir: '/usr/lib/postgresql/9.6/bin', - python_venv_version: '3.5', + 'RedHat-9' => { + manage_postgresql_repo: false, + postgres_repo_require: nil, + data_dir: '/var/lib/pgsql/data', + bin_dir: '/usr/bin', + python_venv_version: '3.9', + }, + 'Debian-11' => { + data_dir: '/var/lib/postgresql/13/main', + bin_dir: '/usr/lib/postgresql/13/bin', + python_venv_version: '3.9', config_dir: '/etc/patroni', config_path: '/etc/patroni/config.yml', }, - 'Debian-10' => { - data_dir: '/var/lib/postgresql/11/main', - bin_dir: '/usr/lib/postgresql/11/bin', + 'Ubuntu-20.04' => { + data_dir: '/var/lib/postgresql/12/main', + bin_dir: '/usr/lib/postgresql/12/bin', + python_venv_version: '3.8', config_dir: '/etc/patroni', config_path: '/etc/patroni/config.yml', }, - 'Ubuntu-18.04' => { - data_dir: '/var/lib/postgresql/10/main', - bin_dir: '/usr/lib/postgresql/10/bin', - python_venv_version: '3.6', + 'Ubuntu-22.04' => { + data_dir: '/var/lib/postgresql/14/main', + bin_dir: '/usr/lib/postgresql/14/bin', + python_venv_version: '3.10', config_dir: '/etc/patroni', config_path: '/etc/patroni/config.yml', }, From cacdff3db6c755ef08dd1ec351f09a7e7f8c9f92 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Mon, 27 Nov 2023 11:14:28 -0500 Subject: [PATCH 23/28] Release v2.0.0 --- CHANGELOG.md | 24 +- REFERENCE.md | 637 +++++++++++++++++++++++++------------------------- metadata.json | 2 +- 3 files changed, 345 insertions(+), 318 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 087711b..66dd4f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v2.0.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v2.0.0) (2023-11-27) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.6.0...v2.0.0) + +### Changed + +- Major updates, see description [\#37](https://github.com/tailored-automation/puppet-module-patroni/pull/37) ([treydock](https://github.com/treydock)) + +### Merged pull requests: + +- PDK update [\#34](https://github.com/tailored-automation/puppet-module-patroni/pull/34) ([ghoneycutt](https://github.com/ghoneycutt)) +- Fix CI [\#32](https://github.com/tailored-automation/puppet-module-patroni/pull/32) ([ghoneycutt](https://github.com/ghoneycutt)) +- PDK Update [\#25](https://github.com/tailored-automation/puppet-module-patroni/pull/25) ([treydock](https://github.com/treydock)) + ## [v1.6.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v1.6.0) (2021-11-02) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.5.0...v1.6.0) -### UNCATEGORIZED PRS; GO LABEL THEM +### Added - Add ability to configure Patroni DCS configs [\#24](https://github.com/tailored-automation/puppet-module-patroni/pull/24) ([treydock](https://github.com/treydock)) @@ -31,7 +45,7 @@ All notable changes to this project will be documented in this file. The format [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.2.0...v1.3.0) -### UNCATEGORIZED PRS; GO LABEL THEM +### Merged pull requests: - Fix acceptance tests [\#14](https://github.com/tailored-automation/puppet-module-patroni/pull/14) ([treydock](https://github.com/treydock)) - Make managing the postgresql package repo optional [\#12](https://github.com/tailored-automation/puppet-module-patroni/pull/12) ([ghoneycutt](https://github.com/ghoneycutt)) @@ -62,7 +76,7 @@ All notable changes to this project will be documented in this file. The format [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.0.0...v1.0.1) -### UNCATEGORIZED PRS; GO LABEL THEM +### Merged pull requests: - Fix release process [\#4](https://github.com/tailored-automation/puppet-module-patroni/pull/4) ([treydock](https://github.com/treydock)) - Fix links in metadata and documentation [\#3](https://github.com/tailored-automation/puppet-module-patroni/pull/3) ([ghoneycutt](https://github.com/ghoneycutt)) @@ -71,7 +85,7 @@ All notable changes to this project will be documented in this file. The format [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/0.1.6...v1.0.0) -### UNCATEGORIZED PRS; GO LABEL THEM +### Merged pull requests: - V1 [\#1](https://github.com/tailored-automation/puppet-module-patroni/pull/1) ([ghoneycutt](https://github.com/ghoneycutt)) @@ -105,4 +119,4 @@ All notable changes to this project will be documented in this file. The format -\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/REFERENCE.md b/REFERENCE.md index b15ecb7..6330d4d 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -23,133 +23,134 @@ Manages a Patroni instance The following parameters are available in the `patroni` class: -* [`scope`](#scope) -* [`namespace`](#namespace) -* [`hostname`](#hostname) -* [`dcs_loop_wait`](#dcs_loop_wait) -* [`dcs_ttl`](#dcs_ttl) -* [`dcs_retry_timeout`](#dcs_retry_timeout) -* [`dcs_maximum_lag_on_failover`](#dcs_maximum_lag_on_failover) -* [`dcs_master_start_timeout`](#dcs_master_start_timeout) -* [`dcs_synchronous_mode`](#dcs_synchronous_mode) -* [`dcs_synchronous_mode_strict`](#dcs_synchronous_mode_strict) -* [`dcs_postgresql_use_pg_rewind`](#dcs_postgresql_use_pg_rewind) -* [`dcs_postgresql_use_slots`](#dcs_postgresql_use_slots) -* [`dcs_postgresql_recovery_conf`](#dcs_postgresql_recovery_conf) -* [`dcs_postgresql_parameters`](#dcs_postgresql_parameters) -* [`bootstrap_method`](#bootstrap_method) -* [`initdb_data_checksums`](#initdb_data_checksums) -* [`initdb_encoding`](#initdb_encoding) -* [`initdb_locale`](#initdb_locale) -* [`bootstrap_pg_hba`](#bootstrap_pg_hba) -* [`bootstrap_users`](#bootstrap_users) -* [`bootstrap_post_bootstrap`](#bootstrap_post_bootstrap) -* [`bootstrap_post_init`](#bootstrap_post_init) -* [`superuser_username`](#superuser_username) -* [`superuser_password`](#superuser_password) -* [`replication_username`](#replication_username) -* [`replication_password`](#replication_password) -* [`callback_on_reload`](#callback_on_reload) -* [`callback_on_restart`](#callback_on_restart) -* [`callback_on_role_change`](#callback_on_role_change) -* [`callback_on_start`](#callback_on_start) -* [`callback_on_stop`](#callback_on_stop) -* [`pgsql_connect_address`](#pgsql_connect_address) -* [`pgsql_create_replica_methods`](#pgsql_create_replica_methods) -* [`pgsql_data_dir`](#pgsql_data_dir) -* [`pgsql_config_dir`](#pgsql_config_dir) -* [`pgsql_bin_dir`](#pgsql_bin_dir) -* [`pgsql_listen`](#pgsql_listen) -* [`pgsql_use_unix_socket`](#pgsql_use_unix_socket) -* [`pgsql_pgpass_path`](#pgsql_pgpass_path) -* [`pgsql_recovery_conf`](#pgsql_recovery_conf) -* [`pgsql_custom_conf`](#pgsql_custom_conf) -* [`pgsql_parameters`](#pgsql_parameters) -* [`pgsql_pg_hba`](#pgsql_pg_hba) -* [`pgsql_pg_ctl_timeout`](#pgsql_pg_ctl_timeout) -* [`pgsql_use_pg_rewind`](#pgsql_use_pg_rewind) -* [`pgsql_remove_data_directory_on_rewind_failure`](#pgsql_remove_data_directory_on_rewind_failure) -* [`pgsql_replica_method`](#pgsql_replica_method) -* [`manage_postgresql_repo`](#manage_postgresql_repo) -* [`use_consul`](#use_consul) -* [`consul_host`](#consul_host) -* [`consul_url`](#consul_url) -* [`consul_port`](#consul_port) -* [`consul_scheme`](#consul_scheme) -* [`consul_token`](#consul_token) -* [`consul_verify`](#consul_verify) -* [`consul_register_service`](#consul_register_service) -* [`consul_service_check_interval`](#consul_service_check_interval) -* [`consul_consistency`](#consul_consistency) -* [`consul_cacert`](#consul_cacert) -* [`consul_cert`](#consul_cert) -* [`consul_key`](#consul_key) -* [`consul_dc`](#consul_dc) -* [`consul_checks`](#consul_checks) -* [`use_etcd`](#use_etcd) -* [`etcd_host`](#etcd_host) -* [`etcd_hosts`](#etcd_hosts) -* [`etcd_url`](#etcd_url) -* [`etcd_proxyurl`](#etcd_proxyurl) -* [`etcd_srv`](#etcd_srv) -* [`etcd_protocol`](#etcd_protocol) -* [`etcd_username`](#etcd_username) -* [`etcd_password`](#etcd_password) -* [`etcd_cacert`](#etcd_cacert) -* [`etcd_cert`](#etcd_cert) -* [`etcd_key`](#etcd_key) -* [`use_exhibitor`](#use_exhibitor) -* [`exhibitor_hosts`](#exhibitor_hosts) -* [`exhibitor_poll_interval`](#exhibitor_poll_interval) -* [`exhibitor_port`](#exhibitor_port) -* [`use_kubernetes`](#use_kubernetes) -* [`kubernetes_namespace`](#kubernetes_namespace) -* [`kubernetes_labels`](#kubernetes_labels) -* [`kubernetes_scope_label`](#kubernetes_scope_label) -* [`kubernetes_role_label`](#kubernetes_role_label) -* [`kubernetes_use_endpoints`](#kubernetes_use_endpoints) -* [`kubernetes_pod_ip`](#kubernetes_pod_ip) -* [`kubernetes_ports`](#kubernetes_ports) -* [`restapi_ciphers`](#restapi_ciphers) -* [`restapi_connect_address`](#restapi_connect_address) -* [`restapi_listen`](#restapi_listen) -* [`restapi_username`](#restapi_username) -* [`restapi_password`](#restapi_password) -* [`restapi_certfile`](#restapi_certfile) -* [`restapi_keyfile`](#restapi_keyfile) -* [`restapi_cafile`](#restapi_cafile) -* [`restapi_verify_client`](#restapi_verify_client) -* [`use_zookeeper`](#use_zookeeper) -* [`zookeeper_hosts`](#zookeeper_hosts) -* [`watchdog_mode`](#watchdog_mode) -* [`watchdog_device`](#watchdog_device) -* [`watchdog_safety_margin`](#watchdog_safety_margin) -* [`manage_postgresql`](#manage_postgresql) -* [`postgresql_version`](#postgresql_version) -* [`package_name`](#package_name) -* [`version`](#version) -* [`install_dependencies`](#install_dependencies) -* [`manage_python`](#manage_python) -* [`install_method`](#install_method) -* [`install_dir`](#install_dir) -* [`python_class_version`](#python_class_version) -* [`python_venv_version`](#python_venv_version) -* [`config_path`](#config_path) -* [`config_owner`](#config_owner) -* [`config_group`](#config_group) -* [`config_mode`](#config_mode) -* [`service_name`](#service_name) -* [`service_ensure`](#service_ensure) -* [`service_enable`](#service_enable) -* [`custom_pip_provider`](#custom_pip_provider) - -##### `scope` +* [`scope`](#-patroni--scope) +* [`namespace`](#-patroni--namespace) +* [`hostname`](#-patroni--hostname) +* [`dcs_loop_wait`](#-patroni--dcs_loop_wait) +* [`dcs_ttl`](#-patroni--dcs_ttl) +* [`dcs_retry_timeout`](#-patroni--dcs_retry_timeout) +* [`dcs_maximum_lag_on_failover`](#-patroni--dcs_maximum_lag_on_failover) +* [`dcs_master_start_timeout`](#-patroni--dcs_master_start_timeout) +* [`dcs_synchronous_mode`](#-patroni--dcs_synchronous_mode) +* [`dcs_synchronous_mode_strict`](#-patroni--dcs_synchronous_mode_strict) +* [`dcs_postgresql_use_pg_rewind`](#-patroni--dcs_postgresql_use_pg_rewind) +* [`dcs_postgresql_use_slots`](#-patroni--dcs_postgresql_use_slots) +* [`dcs_postgresql_recovery_conf`](#-patroni--dcs_postgresql_recovery_conf) +* [`dcs_postgresql_parameters`](#-patroni--dcs_postgresql_parameters) +* [`bootstrap_method`](#-patroni--bootstrap_method) +* [`initdb_data_checksums`](#-patroni--initdb_data_checksums) +* [`initdb_encoding`](#-patroni--initdb_encoding) +* [`initdb_locale`](#-patroni--initdb_locale) +* [`bootstrap_pg_hba`](#-patroni--bootstrap_pg_hba) +* [`bootstrap_users`](#-patroni--bootstrap_users) +* [`bootstrap_post_bootstrap`](#-patroni--bootstrap_post_bootstrap) +* [`bootstrap_post_init`](#-patroni--bootstrap_post_init) +* [`superuser_username`](#-patroni--superuser_username) +* [`superuser_password`](#-patroni--superuser_password) +* [`replication_username`](#-patroni--replication_username) +* [`replication_password`](#-patroni--replication_password) +* [`callback_on_reload`](#-patroni--callback_on_reload) +* [`callback_on_restart`](#-patroni--callback_on_restart) +* [`callback_on_role_change`](#-patroni--callback_on_role_change) +* [`callback_on_start`](#-patroni--callback_on_start) +* [`callback_on_stop`](#-patroni--callback_on_stop) +* [`pgsql_connect_address`](#-patroni--pgsql_connect_address) +* [`pgsql_create_replica_methods`](#-patroni--pgsql_create_replica_methods) +* [`pgsql_data_dir`](#-patroni--pgsql_data_dir) +* [`pgsql_config_dir`](#-patroni--pgsql_config_dir) +* [`pgsql_bin_dir`](#-patroni--pgsql_bin_dir) +* [`pgsql_listen`](#-patroni--pgsql_listen) +* [`pgsql_use_unix_socket`](#-patroni--pgsql_use_unix_socket) +* [`pgsql_pgpass_path`](#-patroni--pgsql_pgpass_path) +* [`pgsql_recovery_conf`](#-patroni--pgsql_recovery_conf) +* [`pgsql_custom_conf`](#-patroni--pgsql_custom_conf) +* [`pgsql_parameters`](#-patroni--pgsql_parameters) +* [`pgsql_pg_hba`](#-patroni--pgsql_pg_hba) +* [`pgsql_pg_ctl_timeout`](#-patroni--pgsql_pg_ctl_timeout) +* [`pgsql_use_pg_rewind`](#-patroni--pgsql_use_pg_rewind) +* [`pgsql_remove_data_directory_on_rewind_failure`](#-patroni--pgsql_remove_data_directory_on_rewind_failure) +* [`pgsql_replica_method`](#-patroni--pgsql_replica_method) +* [`manage_postgresql_repo`](#-patroni--manage_postgresql_repo) +* [`use_consul`](#-patroni--use_consul) +* [`consul_host`](#-patroni--consul_host) +* [`consul_url`](#-patroni--consul_url) +* [`consul_port`](#-patroni--consul_port) +* [`consul_scheme`](#-patroni--consul_scheme) +* [`consul_token`](#-patroni--consul_token) +* [`consul_verify`](#-patroni--consul_verify) +* [`consul_register_service`](#-patroni--consul_register_service) +* [`consul_service_check_interval`](#-patroni--consul_service_check_interval) +* [`consul_consistency`](#-patroni--consul_consistency) +* [`consul_cacert`](#-patroni--consul_cacert) +* [`consul_cert`](#-patroni--consul_cert) +* [`consul_key`](#-patroni--consul_key) +* [`consul_dc`](#-patroni--consul_dc) +* [`consul_checks`](#-patroni--consul_checks) +* [`use_etcd`](#-patroni--use_etcd) +* [`etcd_host`](#-patroni--etcd_host) +* [`etcd_hosts`](#-patroni--etcd_hosts) +* [`etcd_url`](#-patroni--etcd_url) +* [`etcd_proxyurl`](#-patroni--etcd_proxyurl) +* [`etcd_srv`](#-patroni--etcd_srv) +* [`etcd_protocol`](#-patroni--etcd_protocol) +* [`etcd_username`](#-patroni--etcd_username) +* [`etcd_password`](#-patroni--etcd_password) +* [`etcd_cacert`](#-patroni--etcd_cacert) +* [`etcd_cert`](#-patroni--etcd_cert) +* [`etcd_key`](#-patroni--etcd_key) +* [`use_exhibitor`](#-patroni--use_exhibitor) +* [`exhibitor_hosts`](#-patroni--exhibitor_hosts) +* [`exhibitor_poll_interval`](#-patroni--exhibitor_poll_interval) +* [`exhibitor_port`](#-patroni--exhibitor_port) +* [`use_kubernetes`](#-patroni--use_kubernetes) +* [`kubernetes_namespace`](#-patroni--kubernetes_namespace) +* [`kubernetes_labels`](#-patroni--kubernetes_labels) +* [`kubernetes_scope_label`](#-patroni--kubernetes_scope_label) +* [`kubernetes_role_label`](#-patroni--kubernetes_role_label) +* [`kubernetes_use_endpoints`](#-patroni--kubernetes_use_endpoints) +* [`kubernetes_pod_ip`](#-patroni--kubernetes_pod_ip) +* [`kubernetes_ports`](#-patroni--kubernetes_ports) +* [`restapi_ciphers`](#-patroni--restapi_ciphers) +* [`restapi_connect_address`](#-patroni--restapi_connect_address) +* [`restapi_listen`](#-patroni--restapi_listen) +* [`restapi_username`](#-patroni--restapi_username) +* [`restapi_password`](#-patroni--restapi_password) +* [`restapi_certfile`](#-patroni--restapi_certfile) +* [`restapi_keyfile`](#-patroni--restapi_keyfile) +* [`restapi_cafile`](#-patroni--restapi_cafile) +* [`restapi_verify_client`](#-patroni--restapi_verify_client) +* [`use_zookeeper`](#-patroni--use_zookeeper) +* [`zookeeper_hosts`](#-patroni--zookeeper_hosts) +* [`watchdog_mode`](#-patroni--watchdog_mode) +* [`watchdog_device`](#-patroni--watchdog_device) +* [`watchdog_safety_margin`](#-patroni--watchdog_safety_margin) +* [`manage_postgresql`](#-patroni--manage_postgresql) +* [`postgresql_version`](#-patroni--postgresql_version) +* [`package_name`](#-patroni--package_name) +* [`version`](#-patroni--version) +* [`install_dependencies`](#-patroni--install_dependencies) +* [`manage_python`](#-patroni--manage_python) +* [`install_method`](#-patroni--install_method) +* [`install_dir`](#-patroni--install_dir) +* [`python_class_version`](#-patroni--python_class_version) +* [`python_venv_version`](#-patroni--python_venv_version) +* [`manage_venv_package`](#-patroni--manage_venv_package) +* [`config_path`](#-patroni--config_path) +* [`config_owner`](#-patroni--config_owner) +* [`config_group`](#-patroni--config_group) +* [`config_mode`](#-patroni--config_mode) +* [`service_name`](#-patroni--service_name) +* [`service_ensure`](#-patroni--service_ensure) +* [`service_enable`](#-patroni--service_enable) +* [`custom_pip_provider`](#-patroni--custom_pip_provider) + +##### `scope` Data type: `String` Refer to Patroni Global `scope` setting -##### `namespace` +##### `namespace` Data type: `String` @@ -157,7 +158,7 @@ Refer to Patroni Global `namespace` setting Default value: `'/service/'` -##### `hostname` +##### `hostname` Data type: `String` @@ -165,7 +166,7 @@ Refer to Patroni Global `name` setting Default value: `$facts['networking']['hostname']` -##### `dcs_loop_wait` +##### `dcs_loop_wait` Data type: `Integer` @@ -173,7 +174,7 @@ Refer to Patroni Dynamic Configuration Settings `loop_wait` setting Default value: `10` -##### `dcs_ttl` +##### `dcs_ttl` Data type: `Integer` @@ -181,7 +182,7 @@ Refer to Patroni Dynamic Configuration Settings `ttl` setting Default value: `30` -##### `dcs_retry_timeout` +##### `dcs_retry_timeout` Data type: `Integer` @@ -189,7 +190,7 @@ Refer to Patroni Dynamic Configuration Settings `retry_timeout` setting Default value: `10` -##### `dcs_maximum_lag_on_failover` +##### `dcs_maximum_lag_on_failover` Data type: `Integer` @@ -197,7 +198,7 @@ Refer to Patroni Dynamic Configuration Settings `maximum_lag_on_failover` settin Default value: `1048576` -##### `dcs_master_start_timeout` +##### `dcs_master_start_timeout` Data type: `Integer` @@ -205,39 +206,39 @@ Refer to Patroni Dynamic Configuration Settings `master_start_timeout` setting Default value: `300` -##### `dcs_synchronous_mode` +##### `dcs_synchronous_mode` Data type: `Boolean` Refer to Patroni Dynamic Configuration Settings `synchronous_mode` setting -Default value: ``false`` +Default value: `false` -##### `dcs_synchronous_mode_strict` +##### `dcs_synchronous_mode_strict` Data type: `Boolean` Refer to Patroni Dynamic Configuration Settings `synchronous_mode_strict` setting -Default value: ``false`` +Default value: `false` -##### `dcs_postgresql_use_pg_rewind` +##### `dcs_postgresql_use_pg_rewind` Data type: `Boolean` Refer to Patroni Dynamic Configuration Settings `postgresql_use_pg_rewind` setting -Default value: ``true`` +Default value: `true` -##### `dcs_postgresql_use_slots` +##### `dcs_postgresql_use_slots` Data type: `Boolean` Refer to Patroni Dynamic Configuration Settings `postgresql_use_slots` setting -Default value: ``true`` +Default value: `true` -##### `dcs_postgresql_recovery_conf` +##### `dcs_postgresql_recovery_conf` Data type: `Hash` @@ -245,7 +246,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_recovery_conf` setti Default value: `{}` -##### `dcs_postgresql_parameters` +##### `dcs_postgresql_parameters` Data type: `Hash` @@ -253,7 +254,7 @@ Refer to Patroni Dynamic Configuration Settings `postgresql_parameters` setting Default value: `{}` -##### `bootstrap_method` +##### `bootstrap_method` Data type: `String[1]` @@ -261,15 +262,15 @@ Refer to Bootstrap configuration settings `method` setting Default value: `'initdb'` -##### `initdb_data_checksums` +##### `initdb_data_checksums` Data type: `Boolean` Refer to Bootstrap configuration settings `data-checksums` setting -Default value: ``true`` +Default value: `true` -##### `initdb_encoding` +##### `initdb_encoding` Data type: `String` @@ -277,7 +278,7 @@ Refer to Bootstrap configuration settings `encoding` setting Default value: `'UTF8'` -##### `initdb_locale` +##### `initdb_locale` Data type: `String` @@ -285,18 +286,22 @@ Refer to Bootstrap configuration settings `locale` setting Default value: `'en_US.utf8'` -##### `bootstrap_pg_hba` +##### `bootstrap_pg_hba` Data type: `Array[String]` Refer to Bootstrap configuration settings `pg_hba` setting -Default value: `[ +Default value: + +```puppet +[ 'host all all 0.0.0.0/0 md5', 'host replication rep_user 0.0.0.0/0 md5', - ]` + ] +``` -##### `bootstrap_users` +##### `bootstrap_users` Data type: `Hash` @@ -304,23 +309,23 @@ Refer to Bootstrap configuration settings `users` setting Default value: `{}` -##### `bootstrap_post_bootstrap` +##### `bootstrap_post_bootstrap` Data type: `Variant[Undef,String]` Refer to Bootstrap configuration settings `post_bootstrap` setting -Default value: ``undef`` +Default value: `undef` -##### `bootstrap_post_init` +##### `bootstrap_post_init` Data type: `Variant[Undef,String]` Refer to Bootstrap configuration settings `post_init` setting -Default value: ``undef`` +Default value: `undef` -##### `superuser_username` +##### `superuser_username` Data type: `String` @@ -328,7 +333,7 @@ Refer to PostgreSQL configuration settings superuser username Default value: `'postgres'` -##### `superuser_password` +##### `superuser_password` Data type: `String` @@ -336,7 +341,7 @@ Refer to PostgreSQL configuration settings superuser password Default value: `'changeme'` -##### `replication_username` +##### `replication_username` Data type: `String` @@ -344,7 +349,7 @@ Refer to PostgreSQL configuration settings replication username Default value: `'rep_user'` -##### `replication_password` +##### `replication_password` Data type: `String` @@ -352,47 +357,47 @@ Refer to PostgreSQL configuration settings replication password Default value: `'changeme'` -##### `callback_on_reload` +##### `callback_on_reload` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings callbacks `on_reload` -Default value: ``undef`` +Default value: `undef` -##### `callback_on_restart` +##### `callback_on_restart` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings callbacks `on_restart` -Default value: ``undef`` +Default value: `undef` -##### `callback_on_role_change` +##### `callback_on_role_change` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings callbacks `on_role_change` -Default value: ``undef`` +Default value: `undef` -##### `callback_on_start` +##### `callback_on_start` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings callbacks `on_start` -Default value: ``undef`` +Default value: `undef` -##### `callback_on_stop` +##### `callback_on_stop` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings callbacks `on_stop` -Default value: ``undef`` +Default value: `undef` -##### `pgsql_connect_address` +##### `pgsql_connect_address` Data type: `String` @@ -400,7 +405,7 @@ Refer to PostgreSQL configuration settings `connect_address` setting Default value: `"${facts['networking']['fqdn']}:5432"` -##### `pgsql_create_replica_methods` +##### `pgsql_create_replica_methods` Data type: `Array[String]` @@ -408,31 +413,31 @@ Refer to PostgreSQL configuration settings `create_replica_methods` setting Default value: `['basebackup']` -##### `pgsql_data_dir` +##### `pgsql_data_dir` Data type: `Optional[Stdlib::Unixpath]` Refer to PostgreSQL configuration settings `data_dir` setting -Default value: ``undef`` +Default value: `undef` -##### `pgsql_config_dir` +##### `pgsql_config_dir` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings `config_dir` setting -Default value: ``undef`` +Default value: `undef` -##### `pgsql_bin_dir` +##### `pgsql_bin_dir` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings `bin_dir` setting -Default value: ``undef`` +Default value: `undef` -##### `pgsql_listen` +##### `pgsql_listen` Data type: `String` @@ -440,15 +445,15 @@ Refer to PostgreSQL configuration settings `listen` setting Default value: `'0.0.0.0:5432'` -##### `pgsql_use_unix_socket` +##### `pgsql_use_unix_socket` Data type: `Boolean` Refer to PostgreSQL configuration settings `use_unix_socket` setting -Default value: ``false`` +Default value: `false` -##### `pgsql_pgpass_path` +##### `pgsql_pgpass_path` Data type: `String` @@ -456,7 +461,7 @@ Refer to PostgreSQL configuration settings `pgpass_path` setting Default value: `'/tmp/pgpass0'` -##### `pgsql_recovery_conf` +##### `pgsql_recovery_conf` Data type: `Hash` @@ -464,15 +469,15 @@ Refer to PostgreSQL configuration settings `recovery_conf` setting Default value: `{}` -##### `pgsql_custom_conf` +##### `pgsql_custom_conf` Data type: `Variant[Undef,String]` Refer to PostgreSQL configuration settings `custom_conf` setting -Default value: ``undef`` +Default value: `undef` -##### `pgsql_parameters` +##### `pgsql_parameters` Data type: `Hash` @@ -480,7 +485,7 @@ Refer to PostgreSQL configuration settings `parameters` setting Default value: `{}` -##### `pgsql_pg_hba` +##### `pgsql_pg_hba` Data type: `Array[String]` @@ -488,7 +493,7 @@ Refer to PostgreSQL configuration settings `pg_hba` setting Default value: `[]` -##### `pgsql_pg_ctl_timeout` +##### `pgsql_pg_ctl_timeout` Data type: `Integer` @@ -496,23 +501,23 @@ Refer to PostgreSQL configuration settings `pg_ctl_timeout` setting Default value: `60` -##### `pgsql_use_pg_rewind` +##### `pgsql_use_pg_rewind` Data type: `Boolean` Refer to PostgreSQL configuration settings `use_pg_rewind` setting -Default value: ``true`` +Default value: `true` -##### `pgsql_remove_data_directory_on_rewind_failure` +##### `pgsql_remove_data_directory_on_rewind_failure` Data type: `Boolean` Refer to PostgreSQL configuration settings `remove_data_directory_on_rewind_failure` setting -Default value: ``false`` +Default value: `false` -##### `pgsql_replica_method` +##### `pgsql_replica_method` Data type: `Array[Hash]` @@ -520,23 +525,23 @@ Refer to PostgreSQL configuration settings `replica_method` setting Default value: `[]` -##### `manage_postgresql_repo` +##### `manage_postgresql_repo` Data type: `Boolean` Should the postgresql module manage the package repo -Default value: ``true`` +Default value: `true` -##### `use_consul` +##### `use_consul` Data type: `Boolean` Boolean to use Consul for configuration storage -Default value: ``false`` +Default value: `false` -##### `consul_host` +##### `consul_host` Data type: `String` @@ -544,15 +549,15 @@ Refer to Consul configuration `host` setting Default value: `'localhost'` -##### `consul_url` +##### `consul_url` Data type: `Variant[Undef,String]` Refer to Consul configuration `url` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_port` +##### `consul_port` Data type: `Stdlib::Port` @@ -560,7 +565,7 @@ Refer to Consul configuration `port` setting Default value: `8500` -##### `consul_scheme` +##### `consul_scheme` Data type: `Enum['http','https']` @@ -568,95 +573,95 @@ Refer to Consul configuration `scheme` setting Default value: `'http'` -##### `consul_token` +##### `consul_token` Data type: `Variant[Undef,String]` Refer to Consul configuration `token` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_verify` +##### `consul_verify` Data type: `Boolean` Refer to Consul configuration `verify` setting -Default value: ``false`` +Default value: `false` -##### `consul_register_service` +##### `consul_register_service` Data type: `Optional[Boolean]` Refer to Consul configuration `register_service` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_service_check_interval` +##### `consul_service_check_interval` Data type: `Optional[String]` Refer to Consul configuration `service_check_interval` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_consistency` +##### `consul_consistency` Data type: `Optional[Enum['default', 'consistent', 'stale']]` Refer to Consul configuration `consistency` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_cacert` +##### `consul_cacert` Data type: `Variant[Undef,String]` Refer to Consul configuration `cacert` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_cert` +##### `consul_cert` Data type: `Variant[Undef,String]` Refer to Consul configuration `cert` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_key` +##### `consul_key` Data type: `Variant[Undef,String]` Refer to Consul configuration `key` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_dc` +##### `consul_dc` Data type: `Variant[Undef,String]` Refer to Consul configuration `dc` setting -Default value: ``undef`` +Default value: `undef` -##### `consul_checks` +##### `consul_checks` Data type: `Variant[Undef,String]` Refer to Consul configuration `checks` setting -Default value: ``undef`` +Default value: `undef` -##### `use_etcd` +##### `use_etcd` Data type: `Boolean` Boolean to use Etcd for configuration storage -Default value: ``false`` +Default value: `false` -##### `etcd_host` +##### `etcd_host` Data type: `String` @@ -664,7 +669,7 @@ Refer to Etcd configuration `host` setting Default value: `'127.0.0.1:2379'` -##### `etcd_hosts` +##### `etcd_hosts` Data type: `Array[String]` @@ -672,31 +677,31 @@ Refer to Etcd configuration `hosts` setting Default value: `[]` -##### `etcd_url` +##### `etcd_url` Data type: `Variant[Undef,String]` Refer to Etcd configuration `url` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_proxyurl` +##### `etcd_proxyurl` Data type: `Variant[Undef,String]` Refer to Etcd configuration `proxy` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_srv` +##### `etcd_srv` Data type: `Variant[Undef,String]` Refer to Etcd configuration `srv` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_protocol` +##### `etcd_protocol` Data type: `Enum['http','https']` @@ -704,55 +709,55 @@ Refer to Etcd configuration `protocol` setting Default value: `'http'` -##### `etcd_username` +##### `etcd_username` Data type: `Variant[Undef,String]` Refer to Etcd configuration `username` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_password` +##### `etcd_password` Data type: `Variant[Undef,String]` Refer to Etcd configuration `password` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_cacert` +##### `etcd_cacert` Data type: `Variant[Undef,String]` Refer to Etcd configuration `cacert` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_cert` +##### `etcd_cert` Data type: `Variant[Undef,String]` Refer to Etcd configuration `cert` setting -Default value: ``undef`` +Default value: `undef` -##### `etcd_key` +##### `etcd_key` Data type: `Variant[Undef,String]` Refer to Etcd configuration `key` setting -Default value: ``undef`` +Default value: `undef` -##### `use_exhibitor` +##### `use_exhibitor` Data type: `Boolean` Boolean to use Exhibitor configuration storage -Default value: ``false`` +Default value: `false` -##### `exhibitor_hosts` +##### `exhibitor_hosts` Data type: `Array[String]` @@ -760,7 +765,7 @@ Refer to Exhibitor configuration `hosts` setting Default value: `[]` -##### `exhibitor_poll_interval` +##### `exhibitor_poll_interval` Data type: `Integer` @@ -768,7 +773,7 @@ Refer to Exhibitor configuration `poll_interval` setting Default value: `10` -##### `exhibitor_port` +##### `exhibitor_port` Data type: `Integer` @@ -776,15 +781,15 @@ Refer to Exhibitor configuration `port` setting Default value: `8080` -##### `use_kubernetes` +##### `use_kubernetes` Data type: `Boolean` Boolean to use Kubernetes configuration storage -Default value: ``false`` +Default value: `false` -##### `kubernetes_namespace` +##### `kubernetes_namespace` Data type: `String` @@ -792,7 +797,7 @@ Refer to Kubernetes configuration `namespace` setting Default value: `'default'` -##### `kubernetes_labels` +##### `kubernetes_labels` Data type: `Hash` @@ -800,55 +805,55 @@ Refer to Kubernetes configuration `labels` setting Default value: `{}` -##### `kubernetes_scope_label` +##### `kubernetes_scope_label` Data type: `Variant[Undef,String]` Refer to Kubernetes configuration `scope_label` setting -Default value: ``undef`` +Default value: `undef` -##### `kubernetes_role_label` +##### `kubernetes_role_label` Data type: `Variant[Undef,String]` Refer to Kubernetes configuration `role_label` setting -Default value: ``undef`` +Default value: `undef` -##### `kubernetes_use_endpoints` +##### `kubernetes_use_endpoints` Data type: `Boolean` Refer to Kubernetes configuration `use_endpoints` setting -Default value: ``false`` +Default value: `false` -##### `kubernetes_pod_ip` +##### `kubernetes_pod_ip` Data type: `Variant[Undef,String]` Refer to Kubernetes configuration `pod_ip` setting -Default value: ``undef`` +Default value: `undef` -##### `kubernetes_ports` +##### `kubernetes_ports` Data type: `Variant[Undef,String]` Refer to Kubernetes configuration `ports` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_ciphers` +##### `restapi_ciphers` Data type: `Optional[String]` Refer to REST API configuration `ciphers` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_connect_address` +##### `restapi_connect_address` Data type: `String` @@ -856,7 +861,7 @@ Refer to REST API configuration `connect_address` setting Default value: `"${facts['networking']['fqdn']}:8008"` -##### `restapi_listen` +##### `restapi_listen` Data type: `String` @@ -864,63 +869,63 @@ Refer to REST API configuration `listen` setting Default value: `'0.0.0.0:8008'` -##### `restapi_username` +##### `restapi_username` Data type: `Variant[Undef,String]` Refer to REST API configuration `username` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_password` +##### `restapi_password` Data type: `Variant[Undef,String]` Refer to REST API configuration `password` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_certfile` +##### `restapi_certfile` Data type: `Variant[Undef,String]` Refer to REST API configuration `certfile` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_keyfile` +##### `restapi_keyfile` Data type: `Variant[Undef,String]` Refer to REST API configuration `keyfile` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_cafile` +##### `restapi_cafile` Data type: `Optional[String]` Refer to REST API configuration `cafile` setting -Default value: ``undef`` +Default value: `undef` -##### `restapi_verify_client` +##### `restapi_verify_client` Data type: `Optional[Enum['none','optional','required']]` Refer to REST API configuration `verify_client` setting -Default value: ``undef`` +Default value: `undef` -##### `use_zookeeper` +##### `use_zookeeper` Data type: `Boolean` Boolean to enable Zookeeper configuration storage -Default value: ``false`` +Default value: `false` -##### `zookeeper_hosts` +##### `zookeeper_hosts` Data type: `Array[String]` @@ -928,7 +933,7 @@ Refer to Zookeeper configuration `hosts` setting Default value: `[]` -##### `watchdog_mode` +##### `watchdog_mode` Data type: `Enum['off','automatic','required']` @@ -936,7 +941,7 @@ Refer to Watchdog configuration `mode` setting Default value: `'automatic'` -##### `watchdog_device` +##### `watchdog_device` Data type: `String` @@ -944,7 +949,7 @@ Refer to Watchdog configuration `device` setting Default value: `'/dev/watchdog'` -##### `watchdog_safety_margin` +##### `watchdog_safety_margin` Data type: `Integer` @@ -952,23 +957,23 @@ Refer to Watchdog configuration `safety_margin` setting Default value: `5` -##### `manage_postgresql` +##### `manage_postgresql` Data type: `Boolean` Boolean to determine if postgresql is managed -Default value: ``true`` +Default value: `true` -##### `postgresql_version` +##### `postgresql_version` Data type: `Optional[String]` Version of postgresql passed to postgresql::globals class -Default value: ``undef`` +Default value: `undef` -##### `package_name` +##### `package_name` Data type: `String` @@ -976,7 +981,7 @@ Patroni package name, only used when `install_method` is `package` Default value: `'patroni'` -##### `version` +##### `version` Data type: `String` @@ -984,7 +989,7 @@ Version of Patroni to install Default value: `'present'` -##### `install_dependencies` +##### `install_dependencies` Data type: `Array` @@ -992,15 +997,15 @@ Install dependencies, only used when `install_method` is `pip` Default value: `[]` -##### `manage_python` +##### `manage_python` Data type: `Boolean` Manage Python class, only used when `install_method` is `pip` -Default value: ``true`` +Default value: `true` -##### `install_method` +##### `install_method` Data type: `Enum['package','pip']` @@ -1008,7 +1013,7 @@ Install method Default value: `'pip'` -##### `install_dir` +##### `install_dir` Data type: `Stdlib::Absolutepath` @@ -1016,7 +1021,7 @@ Install directory, only used when `install_method` is `pip` Default value: `'/opt/app/patroni'` -##### `python_class_version` +##### `python_class_version` Data type: `String` @@ -1025,7 +1030,7 @@ Only used when `install_method` is `pip` Default value: `'36'` -##### `python_venv_version` +##### `python_venv_version` Data type: `String` @@ -1034,7 +1039,15 @@ Only used when `install_method` is `pip` Default value: `'3.6'` -##### `config_path` +##### `manage_venv_package` + +Data type: `Boolean` + +Whether to manage the Python venv package + +Default value: `true` + +##### `config_path` Data type: `String` @@ -1042,7 +1055,7 @@ Path to Patroni configuration file Default value: `'/opt/app/patroni/etc/postgresql.yml'` -##### `config_owner` +##### `config_owner` Data type: `String` @@ -1050,7 +1063,7 @@ Patroni configuration file owner Default value: `'postgres'` -##### `config_group` +##### `config_group` Data type: `String` @@ -1058,7 +1071,7 @@ Patroni configuration file group Default value: `'postgres'` -##### `config_mode` +##### `config_mode` Data type: `String` @@ -1066,7 +1079,7 @@ Patroni configuration file mode Default value: `'0600'` -##### `service_name` +##### `service_name` Data type: `String` @@ -1074,7 +1087,7 @@ Name of Patroni service Default value: `'patroni'` -##### `service_ensure` +##### `service_ensure` Data type: `String` @@ -1082,21 +1095,21 @@ Patroni service ensure property Default value: `'running'` -##### `service_enable` +##### `service_enable` Data type: `Boolean` Patroni service enable property -Default value: ``true`` +Default value: `true` -##### `custom_pip_provider` +##### `custom_pip_provider` Data type: `Optional[String[1]]` Use custom pip path when installing pip packages -Default value: ``undef`` +Default value: `undef` ## Resource types @@ -1126,16 +1139,16 @@ The value to assign the DCS configuration The following parameters are available in the `patroni_dcs_config` type. -* [`name`](#name) -* [`provider`](#provider) +* [`name`](#-patroni_dcs_config--name) +* [`provider`](#-patroni_dcs_config--provider) -##### `name` +##### `name` namevar The DCS configuration option name -##### `provider` +##### `provider` The specific backend to use for this `patroni_dcs_config` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1148,23 +1161,23 @@ usually discover the appropriate provider for your platform. The following parameters are available in the `patronictl_config` type. -* [`config`](#config) -* [`name`](#name) -* [`path`](#path) +* [`config`](#-patronictl_config--config) +* [`name`](#-patronictl_config--name) +* [`path`](#-patronictl_config--path) -##### `config` +##### `config` patronictl config Default value: `/opt/app/patroni/etc/postgresql.yml` -##### `name` +##### `name` namevar The name of the resource. -##### `path` +##### `path` patronictl path diff --git a/metadata.json b/metadata.json index f8493d7..d11c637 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "1.6.0", + "version": "2.0.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From 01941cb9ab6a50cb09c853a51330a0241cc5b247 Mon Sep 17 00:00:00 2001 From: Henri Nougayrede Date: Mon, 29 Jul 2024 15:20:28 +0200 Subject: [PATCH 24/28] Fix crash if pg password starting with bracket --- templates/postgresql.yml.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/postgresql.yml.erb b/templates/postgresql.yml.erb index 762e9a3..fba9301 100644 --- a/templates/postgresql.yml.erb +++ b/templates/postgresql.yml.erb @@ -79,10 +79,10 @@ postgresql: authentication: superuser: username: <%= @superuser_username %> - password: <%= @superuser_password %> + password: '<%= @superuser_password %>' replication: username: <%= @replication_username %> - password: <%= @replication_password %> + password: '<%= @replication_password %>' <% unless @callback_on_reload == nil && @callback_on_restart == nil && @callback_on_role_change == nil && @callback_on_start == nil && @callback_on_stop == nil -%> callbacks: <% if @callback_on_reload != nil -%> From 7ef9c47ec0095f77fc3f13af41efdc2e018d1820 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 4 Jan 2025 15:35:03 -0500 Subject: [PATCH 25/28] Fix existing issues so tests work again --- .rubocop.yml | 2 ++ REFERENCE.md | 36 +++++++++++++++++++ manifests/init.pp | 2 +- .../classes/{patroni_spec.rb => init_spec.rb} | 8 ++--- 4 files changed, 43 insertions(+), 5 deletions(-) rename spec/classes/{patroni_spec.rb => init_spec.rb} (98%) diff --git a/.rubocop.yml b/.rubocop.yml index bb2b4a9..9bf7843 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -439,6 +439,8 @@ Style/MultilineWhenThen: Enabled: false Style/NegatedUnless: Enabled: false +Style/NumericLiterals: + Enabled: false Style/NumericPredicate: Enabled: false Style/OptionalBooleanParameter: diff --git a/REFERENCE.md b/REFERENCE.md index 6330d4d..96b5791 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -143,6 +143,10 @@ The following parameters are available in the `patroni` class: * [`service_ensure`](#-patroni--service_ensure) * [`service_enable`](#-patroni--service_enable) * [`custom_pip_provider`](#-patroni--custom_pip_provider) +* [`is_standby`](#-patroni--is_standby) +* [`standby_cluster_host`](#-patroni--standby_cluster_host) +* [`standby_cluster_port`](#-patroni--standby_cluster_port) +* [`standby_cluster_primary_slot_name`](#-patroni--standby_cluster_primary_slot_name) ##### `scope` @@ -1111,6 +1115,38 @@ Use custom pip path when installing pip packages Default value: `undef` +##### `is_standby` + +Data type: `Boolean` + +Boolean to use Standby cluster + +Default value: `false` + +##### `standby_cluster_host` + +Data type: `String` + +Refer to Standby configuration `host` setting + +Default value: `'127.0.0.1'` + +##### `standby_cluster_port` + +Data type: `Stdlib::Port` + +Refer to Standby configuration `port` setting + +Default value: `5432` + +##### `standby_cluster_primary_slot_name` + +Data type: `Variant[String[1], Optional[String[1]]]` + +Refer to Standby configuration `slot` setting + +Default value: `'patroni'` + ## Resource types ### `patroni_dcs_config` diff --git a/manifests/init.pp b/manifests/init.pp index 9e09ac8..8d18d6a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -283,7 +283,7 @@ Boolean $is_standby = false, String $standby_cluster_host = '127.0.0.1', Stdlib::Port $standby_cluster_port = 5432, - Optional[String] $standby_cluster_primary_slot_name = 'patroni', + Variant[String[1], Optional[String[1]]] $standby_cluster_primary_slot_name = 'patroni', # PostgreSQL Settings String $superuser_username = 'postgres', diff --git a/spec/classes/patroni_spec.rb b/spec/classes/init_spec.rb similarity index 98% rename from spec/classes/patroni_spec.rb rename to spec/classes/init_spec.rb index 5ea38f8..f536146 100644 --- a/spec/classes/patroni_spec.rb +++ b/spec/classes/init_spec.rb @@ -9,7 +9,7 @@ supported_os: [ { 'operatingsystem' => 'RedHat', - 'operatingsystemrelease' => ['7', '8', '9'], + 'operatingsystemrelease' => ['8', '9'], }, { 'operatingsystem' => 'Debian', @@ -22,7 +22,7 @@ ], } - on_supported_os(test_on).each do |os, os_facts| + on_supported_os(test_on).sort.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } let(:node) { 'localhost' } @@ -294,11 +294,11 @@ expected = { 'standby_cluster' => { 'host' => '127.0.0.1', - 'port' => '5432', + 'port' => 5432, 'primary_slot_name' => 'patroni', }, } - expect(config).to include(expected) + expect(config['bootstrap']['dcs']).to include(expected) end end From 1427658ffac414e91233084d97cd6a5b07b961e4 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 4 Jan 2025 15:58:44 -0500 Subject: [PATCH 26/28] Release v2.0.1 --- CHANGELOG.md | 11 +++++++++++ metadata.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66dd4f9..caf5bfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v2.0.1](https://github.com/tailored-automation/puppet-module-patroni/tree/v2.0.1) (2025-01-04) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v2.0.0...v2.0.1) + +### Merged pull requests: + +- Fix existing issues so tests work again [\#47](https://github.com/tailored-automation/puppet-module-patroni/pull/47) ([ghoneycutt](https://github.com/ghoneycutt)) +- Fix crash if pg password starting with bracket [\#42](https://github.com/tailored-automation/puppet-module-patroni/pull/42) ([ghoneycutt](https://github.com/ghoneycutt)) +- Fix crash if pg password starting with bracket [\#39](https://github.com/tailored-automation/puppet-module-patroni/pull/39) ([mouchymouchy](https://github.com/mouchymouchy)) +- adding standby cluster config [\#31](https://github.com/tailored-automation/puppet-module-patroni/pull/31) ([plmayekar](https://github.com/plmayekar)) + ## [v2.0.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v2.0.0) (2023-11-27) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v1.6.0...v2.0.0) diff --git a/metadata.json b/metadata.json index d11c637..a091507 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "2.0.0", + "version": "2.0.1", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0", From b52e737df209e5645375f702baa38736b9baf2e4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2024 14:26:21 +0100 Subject: [PATCH 27/28] Harden the datatypes --- REFERENCE.md | 34 +++++++++++++++++----------------- manifests/init.pp | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 96b5791..12bd9f2 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -150,13 +150,13 @@ The following parameters are available in the `patroni` class: ##### `scope` -Data type: `String` +Data type: `String[1]` Refer to Patroni Global `scope` setting ##### `namespace` -Data type: `String` +Data type: `String[1]` Refer to Patroni Global `namespace` setting @@ -931,7 +931,7 @@ Default value: `false` ##### `zookeeper_hosts` -Data type: `Array[String]` +Data type: `Array[String[1]]` Refer to Zookeeper configuration `hosts` setting @@ -947,7 +947,7 @@ Default value: `'automatic'` ##### `watchdog_device` -Data type: `String` +Data type: `Stdlib::Absolutepath` Refer to Watchdog configuration `device` setting @@ -971,7 +971,7 @@ Default value: `true` ##### `postgresql_version` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Version of postgresql passed to postgresql::globals class @@ -979,7 +979,7 @@ Default value: `undef` ##### `package_name` -Data type: `String` +Data type: `String[1]` Patroni package name, only used when `install_method` is `package` @@ -987,7 +987,7 @@ Default value: `'patroni'` ##### `version` -Data type: `String` +Data type: `String[1]` Version of Patroni to install @@ -995,7 +995,7 @@ Default value: `'present'` ##### `install_dependencies` -Data type: `Array` +Data type: `Array[String[1]]` Install dependencies, only used when `install_method` is `pip` @@ -1027,7 +1027,7 @@ Default value: `'/opt/app/patroni'` ##### `python_class_version` -Data type: `String` +Data type: `String[1]` The version of Python to pass to Python class Only used when `install_method` is `pip` @@ -1036,7 +1036,7 @@ Default value: `'36'` ##### `python_venv_version` -Data type: `String` +Data type: `String[1]` The version of Python to pass to Python virtualenv defined type Only used when `install_method` is `pip` @@ -1053,7 +1053,7 @@ Default value: `true` ##### `config_path` -Data type: `String` +Data type: `Stdlib::Absolutepath` Path to Patroni configuration file @@ -1061,7 +1061,7 @@ Default value: `'/opt/app/patroni/etc/postgresql.yml'` ##### `config_owner` -Data type: `String` +Data type: `String[1]` Patroni configuration file owner @@ -1069,7 +1069,7 @@ Default value: `'postgres'` ##### `config_group` -Data type: `String` +Data type: `String[1]` Patroni configuration file group @@ -1077,7 +1077,7 @@ Default value: `'postgres'` ##### `config_mode` -Data type: `String` +Data type: `Stdlib::Filemode` Patroni configuration file mode @@ -1085,7 +1085,7 @@ Default value: `'0600'` ##### `service_name` -Data type: `String` +Data type: `String[1]` Name of Patroni service @@ -1093,7 +1093,7 @@ Default value: `'patroni'` ##### `service_ensure` -Data type: `String` +Data type: `Enum['running', 'stopped']` Patroni service ensure property @@ -1141,7 +1141,7 @@ Default value: `5432` ##### `standby_cluster_primary_slot_name` -Data type: `Variant[String[1], Optional[String[1]]]` +Data type: `String[1]` Refer to Standby configuration `slot` setting diff --git a/manifests/init.pp b/manifests/init.pp index 8d18d6a..c6a0194 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -253,8 +253,8 @@ class patroni ( # Global Settings - String $scope, - String $namespace = '/service/', + String[1] $scope, + String[1] $namespace = '/service/', String $hostname = $facts['networking']['hostname'], # Bootstrap Settings @@ -283,7 +283,7 @@ Boolean $is_standby = false, String $standby_cluster_host = '127.0.0.1', Stdlib::Port $standby_cluster_port = 5432, - Variant[String[1], Optional[String[1]]] $standby_cluster_primary_slot_name = 'patroni', + String[1] $standby_cluster_primary_slot_name = 'patroni', # PostgreSQL Settings String $superuser_username = 'postgres', @@ -373,31 +373,31 @@ # ZooKeeper Settings Boolean $use_zookeeper = false, - Array[String] $zookeeper_hosts = [], + Array[String[1]] $zookeeper_hosts = [], # Watchdog Settings Enum['off','automatic','required'] $watchdog_mode = 'automatic', - String $watchdog_device = '/dev/watchdog', + Stdlib::Absolutepath $watchdog_device = '/dev/watchdog', Integer $watchdog_safety_margin = 5, # Module Specific Settings Boolean $manage_postgresql = true, - Optional[String] $postgresql_version = undef, - String $package_name = 'patroni', - String $version = 'present', - Array $install_dependencies = [], + Optional[String[1]] $postgresql_version = undef, + String[1] $package_name = 'patroni', + String[1] $version = 'present', + Array[String[1]] $install_dependencies = [], Boolean $manage_python = true, Enum['package','pip'] $install_method = 'pip', Stdlib::Absolutepath $install_dir = '/opt/app/patroni', - String $python_class_version = '36', - String $python_venv_version = '3.6', + String[1] $python_class_version = '36', + String[1] $python_venv_version = '3.6', Boolean $manage_venv_package = true, - String $config_path = '/opt/app/patroni/etc/postgresql.yml', - String $config_owner = 'postgres', - String $config_group = 'postgres', - String $config_mode = '0600', - String $service_name = 'patroni', - String $service_ensure = 'running', + Stdlib::Absolutepath $config_path = '/opt/app/patroni/etc/postgresql.yml', + String[1] $config_owner = 'postgres', + String[1] $config_group = 'postgres', + Stdlib::Filemode $config_mode = '0600', + String[1] $service_name = 'patroni', + Enum['running', 'stopped'] $service_ensure = 'running', Boolean $service_enable = true, Optional[String[1]] $custom_pip_provider = undef, ) { From a47bbe35378ad12cac4aa90fa9ee82a5d5f4bafd Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 4 Jan 2025 16:44:01 -0500 Subject: [PATCH 28/28] Release v2.1.0 --- CHANGELOG.md | 13 ++++++++++++- metadata.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf5bfd..a1309e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v2.1.0](https://github.com/tailored-automation/puppet-module-patroni/tree/v2.1.0) (2025-01-04) + +[Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v2.0.1...v2.1.0) + +### Added + +- Harden the datatypes [\#48](https://github.com/tailored-automation/puppet-module-patroni/pull/48) ([ghoneycutt](https://github.com/ghoneycutt)) + ## [v2.0.1](https://github.com/tailored-automation/puppet-module-patroni/tree/v2.0.1) (2025-01-04) [Full Changelog](https://github.com/tailored-automation/puppet-module-patroni/compare/v2.0.0...v2.0.1) -### Merged pull requests: +### Fixed - Fix existing issues so tests work again [\#47](https://github.com/tailored-automation/puppet-module-patroni/pull/47) ([ghoneycutt](https://github.com/ghoneycutt)) + +### Merged pull requests: + - Fix crash if pg password starting with bracket [\#42](https://github.com/tailored-automation/puppet-module-patroni/pull/42) ([ghoneycutt](https://github.com/ghoneycutt)) - Fix crash if pg password starting with bracket [\#39](https://github.com/tailored-automation/puppet-module-patroni/pull/39) ([mouchymouchy](https://github.com/mouchymouchy)) - adding standby cluster config [\#31](https://github.com/tailored-automation/puppet-module-patroni/pull/31) ([plmayekar](https://github.com/plmayekar)) diff --git a/metadata.json b/metadata.json index a091507..9cd21b6 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "tailoredautomation-patroni", - "version": "2.0.1", + "version": "2.1.0", "author": "tailoredautomation", "summary": "Install and manages Patroni for high-availability PostgreSQL", "license": "Apache-2.0",