From 15c0f95f1ffb3dd53553db2fcf3ac4bdda475a2b Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Thu, 19 Mar 2020 18:27:04 +0100 Subject: [PATCH] install-jar: avoid silent swallowing of curl download failure --- geopyspark/command/configuration.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/geopyspark/command/configuration.py b/geopyspark/command/configuration.py index 664e29f9..f78fbd66 100644 --- a/geopyspark/command/configuration.py +++ b/geopyspark/command/configuration.py @@ -6,6 +6,7 @@ import os from os import path import argparse +import subprocess from geopyspark.geopyspark_constants import JAR, CWD @@ -31,12 +32,14 @@ def write_jar_path(jar_path): f.write(jar_path) def download_jar(jar_path): - import subprocess - jar_location = path.join(jar_path, JAR) - write_jar_path(jar_location) - subprocess.call(['curl', '-L', JAR_URL, '-o', jar_location]) + print("Downloading", JAR_URL) + # Will raise exception when curl download fails (e.g. 404 not found) + subprocess.check_call(['curl', '-L', '--fail', JAR_URL, '-o', jar_location]) + print("Downloaded to", jar_location) + + write_jar_path(jar_location) def get_jar_path(): default_jar_location = path.join(DEFAULT_JAR_PATH, JAR)