Tidyup alternatives system priority hardcoding

This commit is contained in:
Noel McLoughin
2018-01-14 16:12:17 +00:00
committed by noelmcloughlin
parent a87ccfb0ed
commit db90890184
5 changed files with 25 additions and 29 deletions

View File

@@ -9,16 +9,12 @@
{%- endif %}
{%- if includes -%}
include:
{{ includes|yaml(false)|indent(2) }}
{%- endif %}
{%- set pkgs = [postgres.pkg] + postgres.pkgs_extra %}
# Install, configure and start PostgreSQL server
postgresql-server:
pkg.installed:
- pkgs: {{ pkgs }}
@@ -28,27 +24,23 @@ postgresql-server:
- pkgrepo: postgresql-repo
{%- endif %}
{%- if 'bin_dir' in postgres %}
# Make server binaries available in $PATH
{%- for bin in postgres.server_bins %}
{%- set path = salt['file.join'](postgres.bin_dir, bin) %}
# Alternatives system. Make server binaries available in $PATH
{%- if 'bin_dir' in postgres and postgres.linux.altpriority %}
{%- for bin in postgres.server_bins %}
{%- set path = salt['file.join'](postgres.bin_dir, bin) %}
{{ bin }}:
alternatives.install:
- link: {{ salt['file.join']('/usr/bin', bin) }}
- path: {{ path }}
- priority: 30
- priority: {{ postgres.linux.altpriority }}
- onlyif: test -f {{ path }}
- require:
- pkg: postgresql-server
- require_in:
- cmd: postgresql-cluster-prepared
{%- endfor %}
{%- endfor %}
{%- endif %}
postgresql-cluster-prepared:
@@ -138,7 +130,6 @@ postgresql-tablespace-dir-{{ name }}:
{%- if not postgres.bake_image %}
# Start PostgreSQL server using OS init
postgresql-running:
service.running:
- name: {{ postgres.service }}