-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
332fe7b
commit 9d2f69a
Showing
10 changed files
with
242 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{%- from "postgres/map.jinja" import postgres with context -%} | ||
#remove release installed by formula | ||
postgresql-client-removed: | ||
pkg.removed: | ||
- pkgs: | ||
{% if postgres.pkg_client %} | ||
- {{ postgres.pkg_client }} | ||
{% endif %} | ||
{%- if postgres.remove.multiple_releases %} | ||
#search for and cleandown multiple releases | ||
{% for release in postgres.remove.releases %} | ||
{% if 'bin_dir' in postgres %} | ||
{%- for bin in postgres.client_bins %} | ||
{% set path = '/usr/pgsql-' + release|string + '/bin/' + bin %} | ||
postgresql{{ release }}-client-{{ bin }}-alternative-remove: | ||
alternatives.remove: | ||
- name: {{ bin }} | ||
- path: {{ path }} | ||
{% if grains.os in ('Fedora', 'CentOS',) %} | ||
{# bypass bug #} | ||
- onlyif: alternatives --display {{ bin }} | ||
{% else %} | ||
- onlyif: test -f {{ path }} | ||
{% endif %} | ||
- require_in: | ||
- pkg: postgresql{{ release }}-client-pkgs-removed | ||
{%- endfor %} | ||
{%- endif %} | ||
postgresql{{ release }}-client-pkgs-removed: | ||
pkg.purged: | ||
- pkgs: | ||
- postgresql | ||
- postgresql-{{ release }} | ||
- postgresql-{{ release|replace('.', '') }} | ||
- postgresql{{ release }}-common | ||
- postgresql{{ release }}-jdbc | ||
- postgresql{{ release }} | ||
- postgresql{{ release|replace('.', '') }} | ||
{% endfor %} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{%- from "postgres/map.jinja" import postgres with context -%} | ||
# remove release installed by formula | ||
postgresql-devel-removed: | ||
pkg.removed: | ||
- pkgs: | ||
{% if postgres.pkg_dev %} | ||
- {{ postgres.pkg_dev }} | ||
{% endif %} | ||
{% if postgres.pkg_libpq_dev %} | ||
- {{ postgres.pkg_libpq_dev }} | ||
{% endif %} | ||
{% if postgres.pkg_python %} | ||
- {{ postgres.pkg_python }} | ||
{% endif %} | ||
{%- if postgres.remove.multiple_releases %} | ||
#search for and cleandown multiple releases | ||
{% for release in postgres.remove.releases %} | ||
{% if 'bin_dir' in postgres %} | ||
{%- for bin in postgres.dev_bins %} | ||
{% set path = '/usr/pgsql-' + release|string + '/bin/' + bin %} | ||
postgresql{{ release }}-devel-{{ bin }}-alternative-remove: | ||
alternatives.remove: | ||
- name: {{ bin }} | ||
- path: {{ path }} | ||
{% if grains.os in ('Fedora', 'CentOS',) %} | ||
{# bypass bug #} | ||
- onlyif: alternatives --display {{ bin }} | ||
{% else %} | ||
- onlyif: test -f {{ path }} | ||
{% endif %} | ||
- require_in: | ||
- pkg: postgresql{{ release }}-devel-pkgs-removed | ||
{%- endfor %} | ||
{%- endif %} | ||
postgresql{{ release }}-devel-pkgs-removed: | ||
pkg.purged: | ||
- pkgs: | ||
- postgresql-dev | ||
- postgresql-dev-{{ release|replace('.', '') }} | ||
- postgresql-server-dev | ||
- postgresql-server-dev-{{ release|replace('.', '') }} | ||
- postgresql{{ release }}-jdbc | ||
- postgresql{{ release|replace('.', '') }}-jdbc | ||
- postgresql-{{ release }} | ||
- postgresql-{{ release|replace('.', '') }} | ||
- {{ postgres.pkg_python or "postgresql-python" }} | ||
{% endfor %} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,5 @@ | ||
{% from tpldir + "/map.jinja" import postgres with context %} | ||
|
||
postgresql-dead: | ||
service.dead: | ||
- name: {{ postgres.service }} | ||
postgresql-removed: | ||
pkg.removed: | ||
- pkgs: | ||
{% if postgres.pkg %} | ||
- {{ postgres.pkg }} | ||
{% endif %} | ||
{% if postgres.pkg_client %} | ||
- {{ postgres.pkg_client }} | ||
{% endif %} | ||
{% if postgres.pkg_dev %} | ||
- {{ postgres.pkg_dev }} | ||
{% endif %} | ||
{% if postgres.pkg_libpq_dev %} | ||
- {{ postgres.pkg_libpq_dev }} | ||
{% endif %} | ||
{% if postgres.pkgs_extra %} | ||
{% for pkg in postgres.pkgs_extra %} | ||
- {{ pkg }} | ||
{% endfor %} | ||
{% endif %} | ||
postgres-dir-absent: | ||
file.absent: | ||
- names: | ||
- {{ postgres.conf_dir }} | ||
- {{ postgres.data_dir }} | ||
include: | ||
- postgres.server.remove | ||
- postgres.client.remove | ||
- postgres.dev.remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{%- from "postgres/map.jinja" import postgres with context %} | ||
postgresql-dead: | ||
service.dead: | ||
- name: {{ postgres.service }} | ||
- enable: False | ||
postgresql-repo-removed: | ||
pkgrepo.absent: | ||
- name: {{ postgres.pkg_repo.name }} | ||
{%- if 'pkg_repo_keyid' in postgres %} | ||
- keyid: {{ postgres.pkg_repo_keyid }} | ||
{%- endif %} | ||
#remove release installed by formula | ||
postgresql-server-removed: | ||
pkg.removed: | ||
- pkgs: | ||
{% if postgres.pkg %} | ||
- {{ postgres.pkg }} | ||
{% endif %} | ||
{% if postgres.pkgs_extra %} | ||
{% for pkg in postgres.pkgs_extra %} | ||
- {{ pkg }} | ||
{% endfor %} | ||
{% endif %} | ||
{%- if postgres.remove.multiple_releases %} | ||
#search for and cleandown multiple releases | ||
{% for release in postgres.remove.releases %} | ||
postgresql{{ release }}-server-pkgs-removed: | ||
pkg.purged: | ||
- pkgs: | ||
- {{ postgres.pkg if postgres.pkg else "postgresql" }} | ||
- postgresql-server | ||
- postgresql-libs | ||
- postgresql-contrib | ||
- postgresql-server-{{ release }} | ||
- postgresql-libs-{{ release }} | ||
- postgresql-contrib-{{ release }} | ||
- postgresql{{ release }}-contrib | ||
- postgresql{{ release }}-server | ||
- postgresql{{ release }}-libs | ||
- postgresql{{ release }}-contrib | ||
- postgresql{{ release|replace('.', '') }}-contrib | ||
- postgresql{{ release|replace('.', '') }}-server | ||
- postgresql{{ release|replace('.', '') }}-libs | ||
- postgresql{{ release|replace('.', '') }}-contrib | ||
{% if 'bin_dir' in postgres %} | ||
{% for bin in postgres.server_bins %} | ||
{% set path = '/usr/pgsql-' + release|string + '/bin/' + bin %} | ||
postgresql{{ release }}-server-{{ bin }}-alternative-remove: | ||
alternatives.remove: | ||
- name: {{ bin }} | ||
- path: {{ path }} | ||
{% if grains.os in ('Fedora', 'CentOS',) %} | ||
{# bypass bug #} | ||
- onlyif: alternatives --display {{ bin }} | ||
{% else %} | ||
- onlyif: test -f {{ path }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{%- if postgres.remove.data %} | ||
#allow data loss? default is no | ||
postgresql{{ release }}-dataconf-removed: | ||
file.absent: | ||
- names: | ||
- {{ postgres.conf_dir }} | ||
- {{ postgres.data_dir }} | ||
- /var/lib/postgresql | ||
- /var/lib/pgsql | ||
{% for name, tblspace in postgres.tablespaces|dictsort() %} | ||
postgresql{{ release }}-tablespace-dir-{{ name }}-removed: | ||
file.absent: | ||
- name: {{ tblspace.directory }} | ||
- require: | ||
- file: postgresql{{ release }}-dataconf-removed | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{%- endif %} |