File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change 1111from time import sleep
1212from ..module_utils .utils import PayloadMapper
1313from ..module_utils .rest_client import RestClient
14- from ..module_utils .errors import ScaleComputingError
14+ from ..module_utils .errors import ScaleComputingError , ScaleTimeoutError
1515from ..module_utils .typed_classes import TypedClusterToAnsible , TypedTaskTag
1616from typing import Any
1717
@@ -84,18 +84,14 @@ def shutdown(
8484 dict (forceShutdown = force_shutdown ),
8585 check_mode ,
8686 )
87- except ScaleComputingError as e :
88- # To avoid timeout when there are a lot of VMs to shutdown
89- if "Request timed out" in str (e ):
90- try :
91- while True :
92- # get cluster until "[Errno 111] Connection refused"
93- Cluster .get (rest_client )
94- sleep (5 )
95- except ScaleComputingError as e2 :
96- if "Connection refused" in str (e2 ): # cluster is shutdown
97- pass
98- else :
99- raise e2 # Some other unexpected error
100- else :
101- raise e # UnexpectedAPIResponse error
87+ # To avoid timeout when there are a lot of VMs to shutdown
88+ except ScaleTimeoutError :
89+ pass
90+
91+ try :
92+ while True :
93+ # get cluster until "[Errno 111] Connection refused"
94+ Cluster .get (rest_client )
95+ sleep (5 )
96+ except ConnectionRefusedError :
97+ pass
You can’t perform that action at this time.
0 commit comments