@@ -1597,18 +1597,24 @@ async def _execute(
1597
1597
result .args = (msg ,) + result .args [1 :]
1598
1598
raise result
1599
1599
1600
- default_node = nodes .get (client .get_default_node ().name )
1601
- if default_node is not None :
1602
- # This pipeline execution used the default node, check if we need
1603
- # to replace it.
1604
- # Note: when the error is raised we'll reset the default node in the
1605
- # caller function.
1606
- for cmd in default_node [1 ]:
1607
- # Check if it has a command that failed with a relevant
1608
- # exception
1609
- if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1610
- client .replace_default_node ()
1611
- break
1600
+ default_cluster_node = client .get_default_node ()
1601
+
1602
+ # Check whether the default node was used. In some cases,
1603
+ # 'client.get_default_node()' may return None. The check below
1604
+ # prevents a potential AttributeError.
1605
+ if default_cluster_node is not None :
1606
+ default_node = nodes .get (default_cluster_node .name )
1607
+ if default_node is not None :
1608
+ # This pipeline execution used the default node, check if we need
1609
+ # to replace it.
1610
+ # Note: when the error is raised we'll reset the default node in the
1611
+ # caller function.
1612
+ for cmd in default_node [1 ]:
1613
+ # Check if it has a command that failed with a relevant
1614
+ # exception
1615
+ if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1616
+ client .replace_default_node ()
1617
+ break
1612
1618
1613
1619
return [cmd .result for cmd in stack ]
1614
1620
0 commit comments