Skip to content
Snippets Groups Projects
Unverified Commit 8d750db9 authored by Omar Padron's avatar Omar Padron Committed by GitHub
Browse files

remove catch-all exception handling in buildcache command (#15185)

* remove catch-all exception handling in buildcache command

* fix test
parent 676eb56a
Branches
Tags
No related merge requests found
......@@ -366,13 +366,9 @@ def _createtarball(env, spec_yaml, packages, directory, key, no_deps, force,
for spec in specs:
tty.msg('creating binary cache file for package %s ' % spec.format())
try:
bindist.build_tarball(spec, outdir, force, rel,
unsigned, allow_root, signkey,
not no_rebuild_index)
except Exception as e:
tty.warn('%s' % e)
pass
bindist.build_tarball(spec, outdir, force, rel,
unsigned, allow_root, signkey,
not no_rebuild_index)
def createtarball(args):
......
......@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import errno
import platform
import pytest
......@@ -11,6 +12,7 @@
import spack.binary_distribution
buildcache = spack.main.SpackCommand('buildcache')
install = spack.main.SpackCommand('install')
@pytest.fixture()
......@@ -41,3 +43,16 @@ def test_buildcache_list_duplicates(mock_get_specs, capsys):
output = buildcache('list', 'mpileaks', '@2.3')
assert output.count('mpileaks') == 3
def test_buildcache_create_fail_on_perm_denied(
install_mockery, mock_fetch, monkeypatch, tmpdir):
"""Ensure that buildcache create fails on permission denied error."""
install('trivial-install-test-package')
tmpdir.chmod(0)
with pytest.raises(OSError) as error:
buildcache('create', '-d', str(tmpdir),
'--unsigned', 'trivial-install-test-package')
assert error.value.errno == errno.EACCES
tmpdir.chmod(0o700)
......@@ -205,6 +205,8 @@ def push_to_url(
# needs to be done in separate steps.
shutil.copy2(local_file_path, remote_file_path)
os.remove(local_file_path)
else:
raise
elif remote_url.scheme == 's3':
if extra_args is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment