@@ -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' ) :
343343signal_name = os .path .join (self .data_dir ,"standby.signal" )
344344# cross-python touch(). It is vulnerable to races, but who cares?
345345with open (signal_name ,'a' ):
@@ -371,7 +371,7 @@ def _create_recovery_conf(self, username, slot=None):
371371
372372line += "primary_slot_name={}\n " .format (slot )
373373
374- if self .version >= '12' :
374+ if self .version >= PgVer ( '12' ) :
375375self .append_conf (line = line )
376376else :
377377self .append_conf (filename = RECOVERY_CONF_FILE ,line = line )
@@ -517,9 +517,9 @@ def get_auth_method(t):
517517# binary replication
518518if 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' ) :
523523self .append_conf (hot_standby = True ,
524524wal_keep_segments = WAL_KEEP_SEGMENTS ,
525525wal_level = wal_level )# yapf: disable
@@ -530,7 +530,7 @@ def get_auth_method(t):
530530
531531# logical replication
532532if allow_logical :
533- if self ._pg_version < '10' :
533+ if self ._pg_version < PgVer ( '10' ) :
534534raise 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
622622data = 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' ) :
762762check_query = "SELECT pg_is_in_recovery()"
763763
764764self .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' ) :
11621162if isinstance (standbys ,Iterable ):
11631163standbys = First (1 ,standbys )
11641164else :
@@ -1179,7 +1179,7 @@ def catchup(self, dbname=None, username=None):
11791179if not self .master :
11801180raise TestgresException ("Node doesn't have a master" )
11811181
1182- if self ._pg_version >= '10' :
1182+ if self ._pg_version >= PgVer ( '10' ) :
11831183poll_lsn = "select pg_catalog.pg_current_wal_lsn()::text"
11841184wait_lsn = "select pg_catalog.pg_last_wal_replay_lsn() >= '{}'::pg_lsn"
11851185else :