summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Klychkov <aaklychkov@mail.ru>2021-02-05 22:22:02 +0300
committerGitHub <noreply@github.com>2021-02-05 13:22:02 -0600
commit98973468dab7a19c12499297d6f0143e9e4ee0f1 (patch)
treeee532b5dd0bfa0a4b0743d3fd547ea835414b2b6
parent2b217c9c9bf0ec10196a212f962026c39ce5be2b (diff)
downloadansible-98973468dab7a19c12499297d6f0143e9e4ee0f1.tar.gz
postgresql_ping, postgresql_info: fix crash related to PgSQL version parsing (#73285)
Co-authored-by: Andrew Klychkov <andrew.klychkov@gmail.com>
-rw-r--r--changelogs/fragments/43-postgresql_modules_fix_version_parsing.yml3
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_info.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_ping.py2
3 files changed, 5 insertions, 2 deletions
diff --git a/changelogs/fragments/43-postgresql_modules_fix_version_parsing.yml b/changelogs/fragments/43-postgresql_modules_fix_version_parsing.yml
new file mode 100644
index 0000000000..a328d94e83
--- /dev/null
+++ b/changelogs/fragments/43-postgresql_modules_fix_version_parsing.yml
@@ -0,0 +1,3 @@
+bugfixes:
+- postgresql_ping - fix crash caused by wrong PgSQL version parsing (https://github.com/ansible-collections/community.postgresql/issues/40).
+- postgresql_info - fix crash caused by wrong PgSQL version parsing (https://github.com/ansible-collections/community.postgresql/issues/40).
diff --git a/lib/ansible/modules/database/postgresql/postgresql_info.py b/lib/ansible/modules/database/postgresql/postgresql_info.py
index ff9ca49cb6..878bdfae97 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_info.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_info.py
@@ -839,7 +839,7 @@ class PgClusterInfo(object):
raw = raw.split()[1].split('.')
self.pg_info["version"] = dict(
major=int(raw[0]),
- minor=int(raw[1]),
+ minor=int(raw[1].rstrip(',')),
)
def get_db_info(self):
diff --git a/lib/ansible/modules/database/postgresql/postgresql_ping.py b/lib/ansible/modules/database/postgresql/postgresql_ping.py
index cbd4d6e39f..3af8a40e6a 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_ping.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_ping.py
@@ -103,7 +103,7 @@ class PgPing(object):
raw = raw.split()[1].split('.')
self.version = dict(
major=int(raw[0]),
- minor=int(raw[1]),
+ minor=int(raw[1].rstrip(',')),
)