Skip to content

Commit 5a5574b

Browse files
author
Adrian Dvergsdal
committed
Add support for --data-checksums on initdb
1 parent 7ae6c33 commit 5a5574b

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

manifests/globals.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
$repo_baseurl = undef,
4848

4949
$needs_initdb = undef,
50+
$data_checksums = undef,
5051

5152
$encoding = undef,
5253
$locale = undef,

manifests/params.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
$encoding = $postgresql::globals::encoding
1313
$locale = $postgresql::globals::locale
1414
$timezone = $postgresql::globals::timezone
15+
$data_checksums = $postgresql::globals::data_checksums
1516
$service_ensure = 'running'
1617
$service_enable = true
1718
$service_manage = true
@@ -308,6 +309,10 @@
308309
}
309310
}
310311

312+
if($data_checksums && versioncmp($globals_version, '9.3') < 0) {
313+
fail('data_checksums require version 9.3 or greater')
314+
}
315+
311316
$validcon_script_path = pick($validcon_script_path, '/usr/local/bin/validate_postgresql_connection.sh')
312317
$initdb_path = pick($initdb_path, "${bindir}/initdb")
313318
$pg_hba_conf_path = pick($pg_hba_conf_path, "${confdir}/pg_hba.conf")

manifests/server.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
$group = $postgresql::params::group,
4646

4747
$needs_initdb = $postgresql::params::needs_initdb,
48+
$data_checksums = $postgresql::params::data_checksums,
4849

4950
$encoding = $postgresql::params::encoding,
5051
$locale = $postgresql::params::locale,

manifests/server/initdb.pp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# PRIVATE CLASS: do not call directly
22
class postgresql::server::initdb {
33
$needs_initdb = $postgresql::server::needs_initdb
4+
$data_checksums = $postgresql::server::data_checksums
45
$initdb_path = $postgresql::server::initdb_path
56
$datadir = $postgresql::server::datadir
67
$xlogdir = $postgresql::server::xlogdir
@@ -74,6 +75,11 @@
7475
default => "${ic_base} --xlogdir '${xlogdir}'"
7576
}
7677

78+
$ic_checksums = $data_checksums ? {
79+
true => "${ic_xlog} --data-checksums",
80+
default => $ic_xlog,
81+
}
82+
7783
# The xlogdir need to be present before initdb runs.
7884
# If xlogdir is default it's created by package installer
7985
if($xlogdir) {
@@ -83,8 +89,8 @@
8389
}
8490

8591
$initdb_command = $locale ? {
86-
undef => $ic_xlog,
87-
default => "${ic_xlog} --locale '${locale}'"
92+
undef => $ic_checksums,
93+
default => "${ic_checksum} --locale '${locale}'"
8894
}
8995

9096
# This runs the initdb command, we use the existance of the PG_VERSION

0 commit comments

Comments
 (0)