Skip to content

Commit 11ab36b

Browse files
committed
Inline file contents in the catalog
The file() function can read a file form a module and return the content. This happens server side and is included in the catalog. This saves a request to the fileserver at runtime. That request can fail for various reasons (it's still a network). It also means that a cached catalog is sufficient and an agent can reapply it without a Puppetserver running. These files are small enough to inline in the catalog.
1 parent ecc63f1 commit 11ab36b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

manifests/client.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
}
2727

2828
file { $validcon_script_path:
29-
ensure => $file_ensure,
30-
source => 'puppet:///modules/postgresql/validate_postgresql_connection.sh',
31-
owner => 0,
32-
group => 0,
33-
mode => '0755',
29+
ensure => $file_ensure,
30+
content => file('postgresql/validate_postgresql_connection.sh'),
31+
owner => 0,
32+
group => 0,
33+
mode => '0755',
3434
}
3535
}

manifests/repo/yum_postgresql_org.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
$gpg_key_path = "/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}"
66

77
file { $gpg_key_path:
8-
source => 'puppet:///modules/postgresql/RPM-GPG-KEY-PGDG',
9-
owner => 'root',
10-
group => 'root',
11-
mode => '0644',
12-
before => Yumrepo['yum.postgresql.org'],
8+
content => file('postgresql/RPM-GPG-KEY-PGDG'),
9+
owner => 'root',
10+
group => 'root',
11+
mode => '0644',
12+
before => Yumrepo['yum.postgresql.org'],
1313
}
1414

1515
if($facts['os']['name'] == 'Fedora') {

0 commit comments

Comments
 (0)