osmith has submitted this change. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/36936?usp=email )
Change subject: scripts/osmotestconfig: rmtree: no ignore_errors ......................................................................
scripts/osmotestconfig: rmtree: no ignore_errors
Do not ignore errors with shutil.rmtree(). The script expects to be able to delete the directory, otherwise it will fail later on. So this hides the original error and leads to a more confusing error later on.
Change-Id: I41616bb27af0d8b7da124ef309cd4a6e53be6597 --- M scripts/osmotestconfig.py 1 file changed, 15 insertions(+), 1 deletion(-)
Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/scripts/osmotestconfig.py b/scripts/osmotestconfig.py index 8840741..6580fc7 100755 --- a/scripts/osmotestconfig.py +++ b/scripts/osmotestconfig.py @@ -68,7 +68,8 @@ return ret
def copy_config(dirname, config): - shutil.rmtree(dirname, True) + if os.path.exists(dirname): + shutil.rmtree(dirname) ign = shutil.ignore_patterns('*.cfg') shutil.copytree(os.path.dirname(config), dirname, ignore=ign) os.chmod(dirname, stat.S_IRWXU)