Skip to content

Commit

Permalink
Harden the datatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Dec 3, 2024
1 parent 027c75e commit 87a801e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 32 deletions.
68 changes: 52 additions & 16 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,20 @@ 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)

##### <a name="-patroni--scope"></a>`scope`

Data type: `String`
Data type: `String[1]`

Refer to Patroni Global `scope` setting

##### <a name="-patroni--namespace"></a>`namespace`

Data type: `String`
Data type: `String[1]`

Refer to Patroni Global `namespace` setting

Expand Down Expand Up @@ -927,7 +931,7 @@ Default value: `false`

##### <a name="-patroni--zookeeper_hosts"></a>`zookeeper_hosts`

Data type: `Array[String]`
Data type: `Array[String[1]]`

Refer to Zookeeper configuration `hosts` setting

Expand All @@ -943,7 +947,7 @@ Default value: `'automatic'`

##### <a name="-patroni--watchdog_device"></a>`watchdog_device`

Data type: `String`
Data type: `Stdlib::Absolutepath`

Refer to Watchdog configuration `device` setting

Expand All @@ -967,31 +971,31 @@ Default value: `true`

##### <a name="-patroni--postgresql_version"></a>`postgresql_version`

Data type: `Optional[String]`
Data type: `Optional[String[1]]`

Version of postgresql passed to postgresql::globals class

Default value: `undef`

##### <a name="-patroni--package_name"></a>`package_name`

Data type: `String`
Data type: `String[1]`

Patroni package name, only used when `install_method` is `package`

Default value: `'patroni'`

##### <a name="-patroni--version"></a>`version`

Data type: `String`
Data type: `String[1]`

Version of Patroni to install

Default value: `'present'`

##### <a name="-patroni--install_dependencies"></a>`install_dependencies`

Data type: `Array`
Data type: `Array[String[1]]`

Install dependencies, only used when `install_method` is `pip`

Expand Down Expand Up @@ -1023,7 +1027,7 @@ Default value: `'/opt/app/patroni'`

##### <a name="-patroni--python_class_version"></a>`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`
Expand All @@ -1032,7 +1036,7 @@ Default value: `'36'`

##### <a name="-patroni--python_venv_version"></a>`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`
Expand All @@ -1049,47 +1053,47 @@ Default value: `true`

##### <a name="-patroni--config_path"></a>`config_path`

Data type: `String`
Data type: `Stdlib::Absolutepath`

Path to Patroni configuration file

Default value: `'/opt/app/patroni/etc/postgresql.yml'`

##### <a name="-patroni--config_owner"></a>`config_owner`

Data type: `String`
Data type: `String[1]`

Patroni configuration file owner

Default value: `'postgres'`

##### <a name="-patroni--config_group"></a>`config_group`

Data type: `String`
Data type: `String[1]`

Patroni configuration file group

Default value: `'postgres'`

##### <a name="-patroni--config_mode"></a>`config_mode`

Data type: `String`
Data type: `Stdlib::Filemode`

Patroni configuration file mode

Default value: `'0600'`

##### <a name="-patroni--service_name"></a>`service_name`

Data type: `String`
Data type: `String[1]`

Name of Patroni service

Default value: `'patroni'`

##### <a name="-patroni--service_ensure"></a>`service_ensure`

Data type: `String`
Data type: `Enum['running', 'stopped']`

Patroni service ensure property

Expand All @@ -1111,6 +1115,38 @@ Use custom pip path when installing pip packages

Default value: `undef`

##### <a name="-patroni--is_standby"></a>`is_standby`

Data type: `Boolean`

Boolean to use Standby cluster

Default value: `false`

##### <a name="-patroni--standby_cluster_host"></a>`standby_cluster_host`

Data type: `String`

Refer to Standby configuration `host` setting

Default value: `'127.0.0.1'`

##### <a name="-patroni--standby_cluster_port"></a>`standby_cluster_port`

Data type: `Stdlib::Port`

Refer to Standby configuration `port` setting

Default value: `5432`

##### <a name="-patroni--standby_cluster_primary_slot_name"></a>`standby_cluster_primary_slot_name`

Data type: `Optional[String]`

Refer to Standby configuration `slot` setting

Default value: `'patroni'`

## Resource types

### <a name="patroni_dcs_config"></a>`patroni_dcs_config`
Expand Down
32 changes: 16 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
) {
Expand Down

0 comments on commit 87a801e

Please sign in to comment.