@@ -339,7 +339,7 @@ def _create_recovery_conf(self, username, slot=None):
339339 "primary_conninfo='{}'\n "
340340 ).format (options_string (** conninfo )) # yapf: disable
341341 # Since 12 recovery.conf had disappeared
342- if self .version >= '12' :
342+ if self .version >= PgVer ( '12' ) :
343343 signal_name = os .path .join (self .data_dir , "standby.signal" )
344344 # cross-python touch(). It is vulnerable to races, but who cares?
345345 with open (signal_name , 'a' ):
@@ -371,7 +371,7 @@ def _create_recovery_conf(self, username, slot=None):
371371
372372 line += "primary_slot_name={}\n " .format (slot )
373373
374- if self .version >= '12' :
374+ if self .version >= PgVer ( '12' ) :
375375 self .append_conf (line = line )
376376 else :
377377 self .append_conf (filename = RECOVERY_CONF_FILE , line = line )
@@ -517,9 +517,9 @@ def get_auth_method(t):
517517 # binary replication
518518 if allow_streaming :
519519 # select a proper wal_level for PostgreSQL
520- wal_level = 'replica' if self ._pg_version >= '9.6' else 'hot_standby'
520+ wal_level = 'replica' if self ._pg_version >= PgVer ( '9.6' ) else 'hot_standby'
521521
522- if self ._pg_version < '13' :
522+ if self ._pg_version < PgVer ( '13' ) :
523523 self .append_conf (hot_standby = True ,
524524 wal_keep_segments = WAL_KEEP_SEGMENTS ,
525525 wal_level = wal_level ) # yapf: disable
@@ -530,7 +530,7 @@ def get_auth_method(t):
530530
531531 # logical replication
532532 if allow_logical :
533- if self ._pg_version < '10' :
533+ if self ._pg_version < PgVer ( '10' ) :
534534 raise InitNodeException ("Logical replication is only "
535535 "available on PostgreSQL 10 and newer" )
536536
@@ -616,7 +616,7 @@ def get_control_data(self):
616616
617617 # this one is tricky (blame PG 9.4)
618618 _params = [get_bin_path ("pg_controldata" )]
619- _params += ["-D" ] if self ._pg_version >= '9.5' else []
619+ _params += ["-D" ] if self ._pg_version >= PgVer ( '9.5' ) else []
620620 _params += [self .data_dir ]
621621
622622 data = execute_utility (_params , self .utils_log_file )
@@ -758,7 +758,7 @@ def promote(self, dbname=None, username=None):
758758
759759 # for versions below 10 `promote` is asynchronous so we need to wait
760760 # until it actually becomes writable
761- if self ._pg_version < '10' :
761+ if self ._pg_version < PgVer ( '10' ) :
762762 check_query = "SELECT pg_is_in_recovery()"
763763
764764 self .poll_query_until (query = check_query ,
@@ -1158,7 +1158,7 @@ def set_synchronous_standbys(self, standbys):
11581158 master.restart()
11591159
11601160 """
1161- if self ._pg_version >= '9.6' :
1161+ if self ._pg_version >= PgVer ( '9.6' ) :
11621162 if isinstance (standbys , Iterable ):
11631163 standbys = First (1 , standbys )
11641164 else :
@@ -1179,7 +1179,7 @@ def catchup(self, dbname=None, username=None):
11791179 if not self .master :
11801180 raise TestgresException ("Node doesn't have a master" )
11811181
1182- if self ._pg_version >= '10' :
1182+ if self ._pg_version >= PgVer ( '10' ) :
11831183 poll_lsn = "select pg_catalog.pg_current_wal_lsn()::text"
11841184 wait_lsn = "select pg_catalog.pg_last_wal_replay_lsn() >= '{}'::pg_lsn"
11851185 else :
0 commit comments