@@ -526,7 +526,7 @@ def _make_key(self, addr):
526
526
:meta private:
527
527
"""
528
528
529
- return '{0}:{1}' . format ( addr ['host' ], addr ['port' ])
529
+ return f" { addr ['host' ]} : { addr ['port' ]} "
530
530
531
531
def _get_new_state (self , unit ):
532
532
"""
@@ -546,38 +546,33 @@ def _get_new_state(self, unit):
546
546
try :
547
547
conn .connect ()
548
548
except NetworkError as exc :
549
- msg = "Failed to connect to {0}:{1}" .format (
550
- unit .addr ['host' ], unit .addr ['port' ])
549
+ msg = f"Failed to connect to { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
551
550
warn (msg , ClusterConnectWarning )
552
551
return InstanceState (Status .UNHEALTHY )
553
552
554
553
try :
555
554
resp = conn .call ('box.info' )
556
555
except NetworkError as exc :
557
- msg = "Failed to get box.info for {0}:{1}, reason: {2}" .format (
558
- unit .addr ['host' ], unit .addr ['port' ], repr (exc ))
556
+ msg = f"Failed to get box.info for { unit .addr ['host' ]} :{ unit .addr ['port' ]} , reason: { repr (exc )} "
559
557
warn (msg , PoolTolopogyWarning )
560
558
return InstanceState (Status .UNHEALTHY )
561
559
562
560
try :
563
561
read_only = resp .data [0 ]['ro' ]
564
562
except (IndexError , KeyError ) as exc :
565
- msg = "Incorrect box.info response from {0}:{1}" .format (
566
- unit .addr ['host' ], unit .addr ['port' ])
563
+ msg = f"Incorrect box.info response from { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
567
564
warn (msg , PoolTolopogyWarning )
568
565
return InstanceState (Status .UNHEALTHY )
569
566
570
567
try :
571
568
status = resp .data [0 ]['status' ]
572
569
573
570
if status != 'running' :
574
- msg = "{0}:{1} instance status is not 'running'" .format (
575
- unit .addr ['host' ], unit .addr ['port' ])
571
+ msg = f"{ unit .addr ['host' ]} :{ unit .addr ['port' ]} instance status is not 'running'"
576
572
warn (msg , PoolTolopogyWarning )
577
573
return InstanceState (Status .UNHEALTHY )
578
574
except (IndexError , KeyError ) as exc :
579
- msg = "Incorrect box.info response from {0}:{1}" .format (
580
- unit .addr ['host' ], unit .addr ['port' ])
575
+ msg = f"Incorrect box.info response from { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
581
576
warn (msg , PoolTolopogyWarning )
582
577
return InstanceState (Status .UNHEALTHY )
583
578
0 commit comments