replace curl --retry with bash builtins (#101)
This commit is contained in:
parent
56272613f2
commit
98ef70e29b
259
orcli
259
orcli
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This script was generated by bashly 0.9.4 (https://bashly.dannyb.co)
|
# This script was generated by bashly 1.0.3 (https://bashly.dannyb.co)
|
||||||
# Modifying it manually is not recommended
|
# Modifying it manually is not recommended
|
||||||
|
|
||||||
# :wrapper.bash3_bouncer
|
# :wrapper.bash3_bouncer
|
||||||
|
@ -139,11 +139,6 @@ orcli_delete_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--force, -f"
|
printf " %s\n" "--force, -f"
|
||||||
|
@ -155,6 +150,11 @@ orcli_delete_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -229,11 +229,6 @@ orcli_import_csv_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--separator SEPARATOR"
|
printf " %s\n" "--separator SEPARATOR"
|
||||||
|
@ -331,6 +326,11 @@ orcli_import_csv_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -373,11 +373,6 @@ orcli_import_tsv_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--blankCellsAsStrings"
|
printf " %s\n" "--blankCellsAsStrings"
|
||||||
|
@ -469,6 +464,11 @@ orcli_import_tsv_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -613,17 +613,17 @@ orcli_transform_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--quiet, -q"
|
printf " %s\n" "--quiet, -q"
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -704,11 +704,6 @@ orcli_export_tsv_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--facets FACETS"
|
printf " %s\n" "--facets FACETS"
|
||||||
|
@ -732,6 +727,11 @@ orcli_export_tsv_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -772,11 +772,6 @@ orcli_export_template_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--separator SEPARATOR"
|
printf " %s\n" "--separator SEPARATOR"
|
||||||
|
@ -822,6 +817,11 @@ orcli_export_template_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -869,11 +869,6 @@ orcli_run_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "%s\n" "Options:"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
# :command.usage_fixed_flags
|
|
||||||
printf " %s\n" "--help, -h"
|
|
||||||
printf " Show this help\n"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# :command.usage_flags
|
# :command.usage_flags
|
||||||
# :flag.usage
|
# :flag.usage
|
||||||
printf " %s\n" "--memory RAM"
|
printf " %s\n" "--memory RAM"
|
||||||
|
@ -897,6 +892,11 @@ orcli_run_usage() {
|
||||||
printf " suppress log output, print errors only\n"
|
printf " suppress log output, print errors only\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# :command.usage_fixed_flags
|
||||||
|
printf " %s\n" "--help, -h"
|
||||||
|
printf " Show this help\n"
|
||||||
|
echo
|
||||||
|
|
||||||
# :command.usage_args
|
# :command.usage_args
|
||||||
printf "%s\n" "Arguments:"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
|
@ -943,8 +943,8 @@ normalize_input() {
|
||||||
}
|
}
|
||||||
# :command.inspect_args
|
# :command.inspect_args
|
||||||
inspect_args() {
|
inspect_args() {
|
||||||
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
|
||||||
if ((${#args[@]})); then
|
if ((${#args[@]})); then
|
||||||
|
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
||||||
echo args:
|
echo args:
|
||||||
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
||||||
else
|
else
|
||||||
|
@ -959,6 +959,14 @@ inspect_args() {
|
||||||
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ((${#deps[@]})); then
|
||||||
|
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
|
||||||
|
echo
|
||||||
|
echo deps:
|
||||||
|
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# :command.user_lib
|
# :command.user_lib
|
||||||
|
@ -1556,14 +1564,20 @@ orcli_test_command() {
|
||||||
# update trap to kill OpenRefine on error or exit
|
# update trap to kill OpenRefine on error or exit
|
||||||
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-3333*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-3333*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
||||||
|
|
||||||
# wait until OpenRefine is running (timeout 15s + 15s)
|
# wait until OpenRefine is running (timeout 20s)
|
||||||
if ! curl -fs --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
ready="n"
|
||||||
# try again with IPv4 only
|
for i in {1..20}; do
|
||||||
if ! curl -fs -4 --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
if curl -fs "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
||||||
error "starting OpenRefine server failed!"
|
ready="y"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
|
if [[ "$ready" == "y" ]]; then
|
||||||
log "started OpenRefine with tmp workspace ${OPENREFINE_TMPDIR}"
|
log "started OpenRefine with tmp workspace ${OPENREFINE_TMPDIR}"
|
||||||
|
else
|
||||||
|
error "starting OpenRefine server failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute tests in subshell
|
# execute tests in subshell
|
||||||
|
@ -1845,14 +1859,20 @@ orcli_run_command() {
|
||||||
# update trap to kill OpenRefine on error or exit
|
# update trap to kill OpenRefine on error or exit
|
||||||
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-${OPENREFINE_URL##*:}*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-${OPENREFINE_URL##*:}*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
||||||
|
|
||||||
# wait until OpenRefine is running (timeout 15s + 15s)
|
# wait until OpenRefine is running (timeout 20s)
|
||||||
if ! curl -fs --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
ready="n"
|
||||||
# try again with IPv4 only
|
for i in {1..20}; do
|
||||||
if ! curl -fs -4 --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
if curl -fs "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
||||||
error "starting OpenRefine server failed!"
|
ready="y"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
|
if [[ "$ready" == "y" ]]; then
|
||||||
log "started OpenRefine" "port: ${args[--port]}" "memory: ${args[--memory]}" "tmpdir: ${OPENREFINE_TMPDIR}" "pid: ${OPENREFINE_PID}"
|
log "started OpenRefine" "port: ${args[--port]}" "memory: ${args[--memory]}" "tmpdir: ${OPENREFINE_TMPDIR}" "pid: ${OPENREFINE_PID}"
|
||||||
|
else
|
||||||
|
error "starting OpenRefine server failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute script(s) in subshell
|
# execute script(s) in subshell
|
||||||
|
@ -1929,13 +1949,17 @@ parse_requirements() {
|
||||||
export OPENREFINE_URL="${OPENREFINE_URL:-http://localhost:3333}"
|
export OPENREFINE_URL="${OPENREFINE_URL:-http://localhost:3333}"
|
||||||
|
|
||||||
# :command.dependencies_filter
|
# :command.dependencies_filter
|
||||||
if ! command -v curl >/dev/null 2>&1; then
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
deps['curl']="$(command -v curl | head -n1)"
|
||||||
|
else
|
||||||
printf "missing dependency: curl\n" >&2
|
printf "missing dependency: curl\n" >&2
|
||||||
printf "%s\n" "https://curl.se" >&2
|
printf "%s\n" "https://curl.se" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v jq >/dev/null 2>&1; then
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
deps['jq']="$(command -v jq | head -n1)"
|
||||||
|
else
|
||||||
printf "missing dependency: jq\n" >&2
|
printf "missing dependency: jq\n" >&2
|
||||||
printf "%s\n" "https://github.com/stedolan/jq" >&2
|
printf "%s\n" "https://github.com/stedolan/jq" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -3360,7 +3384,7 @@ orcli_export_template_parse_requirements() {
|
||||||
[[ -n ${args['--encoding']:-} ]] || args['--encoding']="UTF-8"
|
[[ -n ${args['--encoding']:-} ]] || args['--encoding']="UTF-8"
|
||||||
|
|
||||||
# :command.whitelist_filter
|
# :command.whitelist_filter
|
||||||
if [[ ! ${args['--mode']} =~ ^(rows|records)$ ]]; then
|
if [[ ${args['--mode']} ]] && [[ ! ${args['--mode']} =~ ^(rows|records)$ ]]; then
|
||||||
printf "%s\n" "--mode must be one of: rows, records" >&2
|
printf "%s\n" "--mode must be one of: rows, records" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -3483,129 +3507,26 @@ initialize() {
|
||||||
# :command.run
|
# :command.run
|
||||||
run() {
|
run() {
|
||||||
declare -A args=()
|
declare -A args=()
|
||||||
|
declare -A deps=()
|
||||||
declare -a other_args=()
|
declare -a other_args=()
|
||||||
declare -a input=()
|
declare -a input=()
|
||||||
normalize_input "$@"
|
normalize_input "$@"
|
||||||
parse_requirements "${input[@]}"
|
parse_requirements "${input[@]}"
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
"completions")
|
"completions") orcli_completions_command ;;
|
||||||
if [[ ${args['--help']:-} ]]; then
|
"delete") orcli_delete_command ;;
|
||||||
long_usage=yes
|
"import") orcli_import_command ;;
|
||||||
orcli_completions_usage
|
"import csv") orcli_import_csv_command ;;
|
||||||
else
|
"import tsv") orcli_import_tsv_command ;;
|
||||||
orcli_completions_command
|
"list") orcli_list_command ;;
|
||||||
fi
|
"info") orcli_info_command ;;
|
||||||
;;
|
"test") orcli_test_command ;;
|
||||||
|
"transform") orcli_transform_command ;;
|
||||||
"delete")
|
"export") orcli_export_command ;;
|
||||||
if [[ ${args['--help']:-} ]]; then
|
"export tsv") orcli_export_tsv_command ;;
|
||||||
long_usage=yes
|
"export template") orcli_export_template_command ;;
|
||||||
orcli_delete_usage
|
"run") orcli_run_command ;;
|
||||||
else
|
|
||||||
orcli_delete_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"import")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_import_usage
|
|
||||||
else
|
|
||||||
orcli_import_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"import csv")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_import_csv_usage
|
|
||||||
else
|
|
||||||
orcli_import_csv_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"import tsv")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_import_tsv_usage
|
|
||||||
else
|
|
||||||
orcli_import_tsv_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"list")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_list_usage
|
|
||||||
else
|
|
||||||
orcli_list_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"info")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_info_usage
|
|
||||||
else
|
|
||||||
orcli_info_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"test")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_test_usage
|
|
||||||
else
|
|
||||||
orcli_test_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"transform")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_transform_usage
|
|
||||||
else
|
|
||||||
orcli_transform_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"export")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_export_usage
|
|
||||||
else
|
|
||||||
orcli_export_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"export tsv")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_export_tsv_usage
|
|
||||||
else
|
|
||||||
orcli_export_tsv_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"export template")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_export_template_usage
|
|
||||||
else
|
|
||||||
orcli_export_template_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"run")
|
|
||||||
if [[ ${args['--help']:-} ]]; then
|
|
||||||
long_usage=yes
|
|
||||||
orcli_run_usage
|
|
||||||
else
|
|
||||||
orcli_run_command
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,20 @@ OPENREFINE_PID="$!"
|
||||||
# update trap to kill OpenRefine on error or exit
|
# update trap to kill OpenRefine on error or exit
|
||||||
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-${OPENREFINE_URL##*:}*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-${OPENREFINE_URL##*:}*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
||||||
|
|
||||||
# wait until OpenRefine is running (timeout 15s + 15s)
|
# wait until OpenRefine is running (timeout 20s)
|
||||||
if ! curl -fs --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
ready="n"
|
||||||
# try again with IPv4 only
|
for i in {1..20}; do
|
||||||
if ! curl -fs -4 --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
if curl -fs "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
||||||
error "starting OpenRefine server failed!"
|
ready="y"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
|
if [[ "$ready" == "y" ]]; then
|
||||||
log "started OpenRefine" "port: ${args[--port]}" "memory: ${args[--memory]}" "tmpdir: ${OPENREFINE_TMPDIR}" "pid: ${OPENREFINE_PID}"
|
log "started OpenRefine" "port: ${args[--port]}" "memory: ${args[--memory]}" "tmpdir: ${OPENREFINE_TMPDIR}" "pid: ${OPENREFINE_PID}"
|
||||||
|
else
|
||||||
|
error "starting OpenRefine server failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute script(s) in subshell
|
# execute script(s) in subshell
|
||||||
|
|
|
@ -34,14 +34,20 @@ OPENREFINE_PID="$!"
|
||||||
# update trap to kill OpenRefine on error or exit
|
# update trap to kill OpenRefine on error or exit
|
||||||
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-3333*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
trap '{ rm -rf "$OPENREFINE_TMPDIR"; rm -rf /tmp/jetty-127_0_0_1-3333*; kill -9 "$OPENREFINE_PID"; }' 0 2 3 15
|
||||||
|
|
||||||
# wait until OpenRefine is running (timeout 15s + 15s)
|
# wait until OpenRefine is running (timeout 20s)
|
||||||
if ! curl -fs --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
ready="n"
|
||||||
# try again with IPv4 only
|
for i in {1..20}; do
|
||||||
if ! curl -fs -4 --retry 15 --retry-connrefused --retry-delay 1 "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
if curl -fs "${OPENREFINE_URL}/command/core/get-version" &>/dev/null; then
|
||||||
error "starting OpenRefine server failed!"
|
ready="y"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
|
if [[ "$ready" == "y" ]]; then
|
||||||
log "started OpenRefine with tmp workspace ${OPENREFINE_TMPDIR}"
|
log "started OpenRefine with tmp workspace ${OPENREFINE_TMPDIR}"
|
||||||
|
else
|
||||||
|
error "starting OpenRefine server failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute tests in subshell
|
# execute tests in subshell
|
||||||
|
|
Loading…
Reference in New Issue