Skip to content

Commit 36fe367

Browse files
asmigalaAndrej Smigala
authored andcommitted
Fix pgdg package name for 8.4
The package names for PostgreSQL 8.4 follow a slightly different naming pattern. Fixed the matching logic in get_repo_rpm_release.py. Also changed the script to output the whole package name, which is then used in the install task. This is to prevent having to fiddle with jinja filters in the install task to get the correct download url.
1 parent 1fad47e commit 36fe367

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

files/get_repo_rpm_release.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@
2222
raise
2323

2424
pg_version = url.split('/')[3]
25-
re_pattern = 'href=[\'"]pgdg-%s%s-%s-([\d+]).noarch.rpm[\'"]' % (dist, pg_version.replace('.', ''), pg_version)
25+
if pg_version[0] == "8" and dist != "sl":
26+
re_pattern = 'href=[\'"](pgdg-%s-%s-[\d+].noarch.rpm)[\'"]' % (dist, pg_version)
27+
else:
28+
re_pattern = 'href=[\'"](pgdg-%s%s-%s-[\d+].noarch.rpm)[\'"]' % (dist, pg_version.replace('.', ''), pg_version)
2629
match = re.findall(re_pattern, repo.read(), flags=re.I)
2730

2831
assert match, "No matching %s pgdg repository packages found for version %s at %s" % (dist, pg_version, url)
2932

30-
print max([ int(x) for x in match ])
33+
print match[0]
3134

3235
sys.exit(0)

tasks/redhat.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
# helper script to parse the directory list and figure it out.
1717
- name: Determine latest pgdg repository package (RedHat)
1818
script: get_repo_rpm_release.py http://yum.postgresql.org/{{ postgresql_version }}/{{ postgresql_pgdg_families[ansible_distribution] | default("redhat") }}/{{ postgresql_pgdg_shortfamilies[ansible_distribution] | default("rhel") }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/ {{ postgresql_pgdg_dists[ansible_distribution] }}
19-
register: pgdg_repo_pkg_release
19+
register: pgdg_repo_pkg_name
2020
when: repo_pkg_installed.failed is defined and repo_pkg_installed.failed
2121

2222
- name: Install pgdg repository package (RedHat)
23-
yum: name=http://yum.postgresql.org/{{ postgresql_version }}/{{ postgresql_pgdg_families[ansible_distribution] | default("redhat") }}/{{ postgresql_pgdg_shortfamilies[ansible_distribution] | default("rhel") }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/pgdg-{{ postgresql_pgdg_dists[ansible_distribution] }}{{ postgresql_version | replace('.', '') }}-{{ postgresql_version }}-{{ pgdg_repo_pkg_release.stdout.strip() }}.noarch.rpm
23+
yum: name=http://yum.postgresql.org/{{ postgresql_version }}/{{ postgresql_pgdg_families[ansible_distribution] | default("redhat") }}/{{ postgresql_pgdg_shortfamilies[ansible_distribution] | default("rhel") }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/{{ pgdg_repo_pkg_name.stdout.strip() }}
2424
when: repo_pkg_installed.failed is defined and repo_pkg_installed.failed
2525

2626
- name: Install PostgreSQL (RedHat)

0 commit comments

Comments
 (0)