Ejemplo n.º 1
0
def _ValidateUnpackedSourceSize(path, include_ignored_files):
    ignore_regex = GetIgnoreFilesRegex(include_ignored_files)
    size_b = file_utils.GetTreeSizeBytes(path, ignore_regex)
    size_limit_mb = 512
    size_limit_b = size_limit_mb * 2**20
    if size_b > size_limit_b:
        raise exceptions.OversizedDeployment(
            str(size_b) + 'B',
            str(size_limit_b) + 'B')
Ejemplo n.º 2
0
def _ValidateUnpackedSourceSize(path):
    chooser = _GetChooser(path)
    predicate = chooser.IsIncluded
    size_b = file_utils.GetTreeSizeBytes(path, predicate=predicate)
    size_limit_mb = 512
    size_limit_b = size_limit_mb * 2**20
    if size_b > size_limit_b:
        raise exceptions.OversizedDeployment(
            str(size_b) + 'B',
            str(size_limit_b) + 'B')
Ejemplo n.º 3
0
def _ValidateUnpackedSourceSize(path):
  """Validate size of unpacked source files."""
  chooser = _GetChooser(path)
  predicate = chooser.IsIncluded
  try:
    size_b = file_utils.GetTreeSizeBytes(path, predicate=predicate)
  except OSError as e:
    raise exceptions.FunctionsError(
        'Error building source archive from path [{path}]. '
        'Could not validate source files: [{error}]. '
        'Please ensure that path [{path}] contains function code or '
        'specify another directory with --source'.format(path=path, error=e))
  size_limit_mb = 512
  size_limit_b = size_limit_mb * 2 ** 20
  if size_b > size_limit_b:
    raise exceptions.OversizedDeployment(
        str(size_b) + 'B', str(size_limit_b) + 'B')