Page MenuHomeDevCentral

D3132.diff
No OneTemporary

D3132.diff

diff --git a/roles/dbserver-pgsql/server/software.sls b/roles/dbserver-pgsql/server/software.sls
--- a/roles/dbserver-pgsql/server/software.sls
+++ b/roles/dbserver-pgsql/server/software.sls
@@ -1,3 +1,5 @@
+#!py
+
# -------------------------------------------------------------
# Salt — Database server — PostgreSQL
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -5,18 +7,39 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% from "map.jinja" import packages with context %}
-
# -------------------------------------------------------------
# PostgreSQL server
+#
+# Packages to install:
+# - PostgreSQL, excepted on FreeBSD: already done in .build
+# - PostgreSQL contrib, if so configured in pillar
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-postgresql_server_software:
- pkg.installed:
- - pkgs:
- {% if grains['os'] != 'FreeBSD' %}
- - {{ packages.postgresql }}
- {% endif %}
- {% if pillar["dbserver_postgresql"]["server"]["with_contrib"] | default(False) %}
- - {{ packages["postgresql-contrib"] }}
- {% endif %}
+
+def get_packages():
+ packages = []
+ map_packages = __salt__["jinja.load_map"]("map.jinja", "packages")
+
+ if __grains__["os"] != "FreeBSD":
+ packages.append(map_packages["postgresql"])
+
+ if __salt__["pillar.get"]("dbserver_postgresql:server:with_contrib"):
+ packages.append(map_packages["postgresql-contrib"])
+
+ return packages
+
+
+def run():
+ packages = get_packages()
+
+ if not packages:
+ # FreeBSD server without contrib: no more package to install
+ return {}
+
+ return {
+ "postgresql_server_software": {
+ "pkg.installed": [
+ {"pkgs": get_packages()},
+ ]
+ }
+ }

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 21:36 (18 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258956
Default Alt Text
D3132.diff (1 KB)

Event Timeline