Beispiel #1
0
 def deprovision_swift(self):
     """
     Delete the Swift containers.
     """
     if settings.SWIFT_ENABLE and self.swift_provisioned:
         for container_name in self.swift_container_names:
             try:
                 openstack.delete_swift_container(
                     container_name,
                     user=self.swift_openstack_user,
                     password=self.swift_openstack_password,
                     tenant=self.swift_openstack_tenant,
                     auth_url=self.swift_openstack_auth_url,
                     region=self.swift_openstack_region,
                 )
             except SwiftClientException:
                 # If deleting a Swift container fails, we still want to continue.
                 self.logger.exception('Could not delete Swift container "%s".', container_name)
         self.swift_provisioned = False
         self.save()
Beispiel #2
0
 def test_delete_swift_containerr(self, auth):
     """Test for delete_swift_container function."""
     self.service.delete.return_value = [None] * 10 # Response contents are ignored
     openstack.delete_swift_container(CONTAINER_NAME, **auth)
     self.service.delete.assert_called_once_with(CONTAINER_NAME)
     self.basic_checks(auth)