@@ -1612,18 +1612,24 @@ async def _execute(
1612
1612
result .args = (msg ,) + result .args [1 :]
1613
1613
raise result
1614
1614
1615
- default_node = nodes .get (client .get_default_node ().name )
1616
- if default_node is not None :
1617
- # This pipeline execution used the default node, check if we need
1618
- # to replace it.
1619
- # Note: when the error is raised we'll reset the default node in the
1620
- # caller function.
1621
- for cmd in default_node [1 ]:
1622
- # Check if it has a command that failed with a relevant
1623
- # exception
1624
- if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1625
- client .replace_default_node ()
1626
- break
1615
+ default_cluster_node = client .get_default_node ()
1616
+
1617
+ # Check whether the default node was used. In some cases,
1618
+ # 'client.get_default_node()' may return None. The check below
1619
+ # prevents a potential AttributeError.
1620
+ if default_cluster_node is not None :
1621
+ default_node = nodes .get (default_cluster_node .name )
1622
+ if default_node is not None :
1623
+ # This pipeline execution used the default node, check if we need
1624
+ # to replace it.
1625
+ # Note: when the error is raised we'll reset the default node in the
1626
+ # caller function.
1627
+ for cmd in default_node [1 ]:
1628
+ # Check if it has a command that failed with a relevant
1629
+ # exception
1630
+ if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1631
+ client .replace_default_node ()
1632
+ break
1627
1633
1628
1634
return [cmd .result for cmd in stack ]
1629
1635
0 commit comments