Exemplo n.º 1
0
    def get_dir_size_test(self):
        """Test the get_dir_size function."""

        # dev null should have a size == 0
        self.assertEqual(get_dir_size('/dev/null'), 0)

        # incorrect path should also return 0
        self.assertEqual(get_dir_size('/dev/null/foo'), 0)

        # check if an int is always returned
        self.assertIsInstance(get_dir_size('/dev/null'), int)
        self.assertIsInstance(get_dir_size('/dev/null/foo'), int)
Exemplo n.º 2
0
    def _get_required_space():
        # TODO: This is not that fast as I thought (a few seconds). Caching or solved in task?
        size = get_dir_size("/") * 1024

        # we don't know the size -- this should not happen
        if size == 0:
            log.debug("Space required is not known. This should not happen!")
            return None
        else:
            return size
Exemplo n.º 3
0
    def space_required(self):
        """Get space required for the source image.

        TODO: Add missing check if source is ready. Until then you shouldn't call this when
        source is not ready.

        TODO: This is not that fast as I thought (a few seconds). Caching or task?

        :return: required size in bytes
        :rtype: int
        """
        return get_dir_size("/") * 1024
Exemplo n.º 4
0
 def space_required(self):
     from pyanaconda.modules.payload.base.utils import get_dir_size
     return Size(get_dir_size("/") * 1024)
Exemplo n.º 5
0
 def space_required(self):
     return Size(get_dir_size("/") * 1024)