Ejemplo n.º 1
0
 def tearDown(self):
     super(TestInstance, self).tearDown()
     try:
         for instance in self.instances:
             if instance.id:
                 self.conn.dms.delete_instance(instance)
                 resource.wait_for_delete(
                     session=self.conn.dms,
                     resource=instance,
                     interval=2,
                     wait=60)
     except openstack.exceptions.SDKException as e:
         _logger.warning('Got exception during clearing resources %s'
                         % e.message)
     self._deinitialize_network()
Ejemplo n.º 2
0
    def test_wait_for_delete(self):
        sess = mock.Mock()
        sot = FakeResource.new(**fake_data)
        sot.get = mock.MagicMock()
        sot.get.side_effect = [sot, exceptions.NotFoundException(mock.Mock())]

        self.assertEqual(sot, resource.wait_for_delete(sess, sot, 1, 2))
Ejemplo n.º 3
0
    def wait_for_delete(self, value, interval=2, wait=120):
        """Wait for the resource to be deleted.

        :param value: The resource to wait on to be deleted.
        :type value: :class:`~openstack.resource.Resource`
        :param interval: Number of seconds to wait between checks.
        :param wait: Maximum number of seconds to wait for the delete.

        :return: Method returns resource on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
                 to delete failed to occur in wait seconds.
        """
        return resource.wait_for_delete(self, value, interval, wait)
Ejemplo n.º 4
0
    def wait_for_delete(self, value, interval=2, wait=120):
        """Wait for the resource to be deleted.

        :param value: The resource to wait on to be deleted.
        :type value: :class:`~openstack.resource.Resource`
        :param interval: Number of seconds to wait between checks.
        :param wait: Maximum number of seconds to wait for the delete.

        :return: Method returns resource on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
                 to delete failed to occur in wait seconds.
        """
        return resource.wait_for_delete(self._session, value, interval, wait)
Ejemplo n.º 5
0
    def wait_for_delete(self, res, interval=2, wait=120):
        """Wait for a resource to be deleted.

        :param res: The resource to wait on to be deleted.
        :type resource: A :class:`~openstack.resource.Resource` object.
        :param interval: Number of seconds to wait before to consecutive
                         checks. Default to 2.
        :param wait: Maximum number of seconds to wait before the change.
                     Default to 120.
        :returns: The resource is returned on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
                 to delete failed to occur in the specified seconds.
        """
        return resource.wait_for_delete(self, res, interval, wait)
Ejemplo n.º 6
0
    def wait_for_delete(self, res, interval=2, wait=120):
        """Wait for a resource to be deleted.

        :param res: The resource to wait on to be deleted.
        :type resource: A :class:`~openstack.resource.Resource` object.
        :param interval: Number of seconds to wait before to consecutive
                         checks. Default to 2.
        :param wait: Maximum number of seconds to wait before the change.
                     Default to 120.
        :returns: The resource is returned on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
                 to delete failed to occur in the specified seconds.
        """
        return resource.wait_for_delete(self, res, interval, wait)
 def wait_for_delete_recordset(self, recordset, interval=2, wait=180):
     """Wait for the recordset to be deleted.
     :param recordset:
         The :class:`~otcextensions.sdk.dns.v2.recordset.Recordset`
         or recordset ID to wait on to be deleted.
     :param int interval:
         Number of seconds to wait before to consecutive checks.
         Default to 2.
     :param int wait:
         Maximum number of seconds to wait for the delete.
         Default to 180.
     :return: Method returns self on success.
     :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
              to status failed to occur in wait seconds.
     """
     recordset = self._get_resource(_rs.Recordset, recordset)
     return resource.wait_for_delete(self, recordset, interval, wait)
 def wait_for_delete_zone(self, zone, interval=2, wait=180):
     """Wait for the zone to be deleted.
     :param zone:
         The :class:`~otcextensions.sdk.dns.v2.zone.Zone`
         or zone ID to wait on to be deleted.
     :param int interval:
         Number of seconds to wait before to consecutive checks.
         Default to 2.
     :param int wait:
         Maximum number of seconds to wait for the delete.
         Default to 180.
     :return: Method returns self on success.
     :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
              to status failed to occur in wait seconds.
     """
     zone = self._get_resource(_zone.Zone, zone)
     return resource.wait_for_delete(self, zone, interval, wait)
    def wait_for_delete_gateway(self, gateway, interval=2, wait=180):
        """Wait for the gateway to be deleted.

        :param gateway:
            The :class:`~otcextensions.sdk.nat.v2.gateway.Gateway`
            or instance ID to wait on to be deleted.
        :param int interval:
            Number of seconds to wait before to consecutive checks.
            Default to 2.
        :param int wait:
            Maximum number of seconds to wait for the delete.
            Default to 180.
        :return: Method returns self on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
                 to status failed to occur in wait seconds.
        """
        gateway = self._get_resource(_gateway.Gateway, gateway)
        return resource.wait_for_delete(self, gateway, interval, wait)
Ejemplo n.º 10
0
    def wait_for_delete_group(self, group, interval=2, wait=60):
        """Wait for the group to be deleted.

        :param group:
            The :class:`~otcextensions.sdk.auto_scaling.v1.group.Group`
            or group ID to wait on to be deleted.
        :param int interval:
            Number of seconds to wait before to consecutive checks.
            Default to 2.
        :param int wait:
            Maximum number of seconds to wait for the delete.
            Default to 60.
        :return: Method returns self on success.
        :raises: :class:`~openstack.exceptions.ResourceTimeout` transition
                 to status failed to occur in wait seconds.
        """
        group = self._get_resource(_group.Group, group)
        return resource.wait_for_delete(self, group, interval, wait)
Ejemplo n.º 11
0
 def test_delete_subnet(self):
     subnet = self._create_subnet(False)
     self.conn.vpc.delete_subnet(subnet, ignore_missing=False)
     resource.wait_for_delete(self.conn.vpc, subnet, 2, 120)
Ejemplo n.º 12
0
 def _delete_subnet(self, subnet):
     resource.wait_for_status(self.conn.vpc, subnet, "ACTIVE", None, 2, 20)
     self.conn.vpc.delete_subnet(subnet, ignore_missing=False)
     resource.wait_for_delete(self.conn.vpc, subnet, 2, 60)