Format code with black
This commit is contained in:
parent
375bf6a982
commit
22ae634a87
15
src/pgmon.py
15
src/pgmon.py
@ -496,6 +496,7 @@ def get_cluster_version():
|
||||
|
||||
return cluster_version
|
||||
|
||||
|
||||
def version_num_to_release(version_num):
|
||||
"""
|
||||
Extract the revease from a version_num.
|
||||
@ -515,7 +516,7 @@ def parse_version_rss(raw_rss, release):
|
||||
Parse the raw RSS from the versions.rss feed to extract the latest version of
|
||||
PostgreSQL that's availabe for the cluster being monitored.
|
||||
|
||||
This sets these global variables:
|
||||
This sets these global variables:
|
||||
latest_version
|
||||
latest_version_next_check
|
||||
release_supported
|
||||
@ -531,7 +532,9 @@ def parse_version_rss(raw_rss, release):
|
||||
global release_supported
|
||||
|
||||
# Regular expressions for parsing the RSS document
|
||||
version_line = re.compile(r".*?([0-9][0-9.]+) is the latest release in the {} series.*".format(release))
|
||||
version_line = re.compile(
|
||||
r".*?([0-9][0-9.]+) is the latest release in the {} series.*".format(release)
|
||||
)
|
||||
unsupported_line = re.compile(r"^This version is unsupported")
|
||||
|
||||
# Loop through the RSS until we find the current release
|
||||
@ -550,9 +553,7 @@ def parse_version_rss(raw_rss, release):
|
||||
"{}{:02}{:02}".format(parts[0], parts[1], parts[2])
|
||||
)
|
||||
else:
|
||||
latest_version = int(
|
||||
"{}00{:02}".format(parts[0], parts[1])
|
||||
)
|
||||
latest_version = int("{}00{:02}".format(parts[0], parts[1]))
|
||||
elif release_found:
|
||||
# The next line after the version tells if the version is supported
|
||||
if unsupported_line.match(line):
|
||||
@ -563,9 +564,7 @@ def parse_version_rss(raw_rss, release):
|
||||
|
||||
# Make sure we actually found it
|
||||
if not release_found:
|
||||
raise LatestVersionCheckError(
|
||||
"Current release ({}) not found".format(release)
|
||||
)
|
||||
raise LatestVersionCheckError("Current release ({}) not found".format(release))
|
||||
|
||||
log.info(
|
||||
"Got latest PostgreSQL version: {} supported={}".format(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user