ocs_ci/ocs/ocp.py
def wait_for_delete(self, resource_name='', timeout=60, sleep=3):
        """
        Wait for a resource to be deleted

        Args:
            resource_name (str): The name of the resource to wait
                for (e.g.my-pv1)
            timeout (int): Time in seconds to wait
            sleep (int): Sampling time in seconds

        Raises:
            CommandFailed: If failed to verify the resource deletion
            TimeoutError: If resource is not deleted within specified timeout

        Returns:
            bool: True in case resource deletion is successful

        """
        start_time = time.time()
        while True:
            try:
                self.get(resource_name=resource_name)
            except CommandFailed as ex:
                if "NotFound" in str(ex):
                    log.info(
                        f"{self.kind} {resource_name} got deleted successfully"
                    )
                    return True
                else:
                    raise ex

            if timeout < (time.time() - start_time):
                describe_out = self.describe(resource_name=resource_name)
                msg = (
                    f"Timeout when waiting for {resource_name} to delete. "
                    f"Describe output: {describe_out}"
                )
                raise TimeoutError(msg)
            time.sleep(sleep)

        Wait for a resource to be deleted

        Args:
            resource_name (str): The name of the resource to wait
                for (e.g.my-pv1)
            timeout (int): Time in seconds to wait
            sleep (int): Sampling time in seconds

        Raises:
            CommandFailed: If failed to verify the resource deletion
            TimeoutError: If resource is not deleted within specified timeout

        Returns:
            bool: True in case resource deletion is successful

        
Wait for a resource to be deleted
Wait for a resource to be deleted
def wait_for_delete(self, resource_name='', timeout=60, sleep=3):
        start_time = time.time()
        while True:
            try:
                self.get(resource_name=resource_name)
            except CommandFailed as ex:
                if "NotFound" in str(ex):
                    log.info(
                        f"{self.kind} {resource_name} got deleted successfully"
                    )
                    return True
                else:
                    raise ex
            if timeout < (time.time() - start_time):
                describe_out = self.describe(resource_name=resource_name)
                msg = (
                    f"Timeout when waiting for {resource_name} to delete. "
                    f"Describe output: {describe_out}"
                )
                raise TimeoutError(msg)
            time.sleep(sleep)
def wait_for_delete ( self , resource_name = '' , timeout = 60 , sleep = 3 ) : start_time = time . time ( ) while True : try : self . get ( resource_name = resource_name ) except CommandFailed as ex : if "NotFound" in str ( ex ) : log . info ( f"{self.kind} {resource_name} got deleted successfully" ) return True else : raise ex if timeout < ( time . time ( ) - start_time ) : describe_out = self . describe ( resource_name = resource_name ) msg = ( f"Timeout when waiting for {resource_name} to delete. " f"Describe output: {describe_out}" ) raise TimeoutError ( msg ) time . sleep ( sleep )
Wait for a resource to be deleted
Wait for a resource to be deleted
"""
        Wait for a resource to be deleted

        Args:
            resource_name (str): The name of the resource to wait
                for (e.g.my-pv1)
            timeout (int): Time in seconds to wait
            sleep (int): Sampling time in seconds

        Raises:
            CommandFailed: If failed to verify the resource deletion
            TimeoutError: If resource is not deleted within specified timeout

        Returns:
            bool: True in case resource deletion is successful

        """
True in case resource deletion is successful
True in case resource deletion is successful
bool
If failed to verify the resource deletion
If failed to verify the resource deletion
CommandFailed
If resource is not deleted within specified timeout
If resource is not deleted within specified timeout
TimeoutError
self
resource_name
The name of the resource to wait
for
The name of the resource to wait for
timeout
Time in seconds to wait
Time in seconds to wait
sleep
Sampling time in seconds
Sampling time in seconds