Fix the PG version regex.

This commit is contained in:
Oleksii Kliukin
2016-07-11 15:21:31 +02:00
parent c91eda8d78
commit b17483b7dd
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ class RestApiHandler(BaseHTTPRequestHandler):
data = "PostgreSQL role should be either master or replica"
break
elif k == 'postgres_version':
if not re.match(r'([1-9][0-9]?\.){2}[1-9][0-9]?$', request[k]):
if not re.match(r'[1-9][0-9]?(\.(0|([1-9][0-9]?))){2}$', request[k]):
status_code = 400
data = "PostgreSQL version should be in the first.major.minor format"
break
+1 -1
View File
@@ -430,7 +430,7 @@ class TestHa(unittest.TestCase):
self.p._role = 'replica'
self.p.server_version = 90500
self.p._pending_restart = True
self.assertFalse(self.ha.restart_matches("master", "9.5.2", True))
self.assertFalse(self.ha.restart_matches("master", "9.5.0", True))
self.assertFalse(self.ha.restart_matches("replica", "9.4.3", True))
self.p._pending_restart = False
self.assertFalse(self.ha.restart_matches("replica", "9.5.2", True))