Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3766978
D3132.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3132.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D3132: Handle the odd case no package is needed in roles/dbserver-pgsql/server
Attached
Detach File
Event Timeline
Log In to Comment