diff options
| author | Jonathan Bauer | 2018-01-18 18:18:08 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2018-01-18 18:18:08 +0100 |
| commit | baa34483eebd572840f8f748fc4ad3bd63c023fa (patch) | |
| tree | 58a61b61f680ee1d0098a81ac1a30e5ad9882e25 | |
| parent | ask systemctl where dracut-mount is ... (diff) | |
| download | systemd-init-baa34483eebd572840f8f748fc4ad3bd63c023fa.tar.gz systemd-init-baa34483eebd572840f8f748fc4ad3bd63c023fa.tar.xz systemd-init-baa34483eebd572840f8f748fc4ad3bd63c023fa.zip | |
add support for slxsrv=@<ip>
+ retry downloading config if it fails, to catch some network delays....
| -rwxr-xr-x | builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh | 18 | ||||
| -rwxr-xr-x | builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh | 20 |
2 files changed, 19 insertions, 19 deletions
diff --git a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh index 8c3bed23..263eff75 100755 --- a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh +++ b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh @@ -16,18 +16,16 @@ exceptions.try slx_server_base="$(getarg slxbase=)" exceptions.activate - logging.info "Download config.tgz from '${slx_server}'..." + logging.info "Download config.tgz from '${slx_server#@}'..." IFS_backup="$IFS" IFS=',' - for host in ${slx_server}; do - logging.info "Trying host \"$host\"." - if wget --timeout 5 \ - "http://${host}/${slx_server_base}/config.tgz" \ - --output-document "/etc/config.tgz" - then - break - fi - done + for TIMEOUT in 1 1 2 3; do + if wget --timeout 5 \ + "http://${slx_server#@}/${slx_server_base}/config.tgz" \ + --output-document "/etc/config.tgz"; then + break + fi + done IFS="$IFS_backup" if [[ ! -e "/etc/config.tgz" ]]; then diff --git a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh index 23c5f004..6b2eb93d 100755 --- a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh +++ b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh @@ -23,17 +23,15 @@ slx_server="$(getarg slxsrv=)" slx_server_base="$(getarg slxbase=)" exceptions.activate -logging.info 'Getting configuration file.' +logging.info "Download SLX configuration from: \"$slx_server\"." IFS_backup="$IFS" IFS=',' -for host in ${slx_server}; do - logging.info "Trying host \"$host\"." - if wget --timeout 5 \ - "http://${host}/${slx_server_base}/${configuration_file_name}" \ - --output-document '/etc/openslx' - then - break - fi +for TIMEOUT in 1 1 2 3; do + if wget --timeout $TIMEOUT \ + "http://${slx_server#@}/${slx_server_base}/${configuration_file_name}" \ + --output-document '/etc/openslx'; then + break + fi done IFS="$IFS_backup" @@ -41,6 +39,10 @@ if [[ ! -e "/etc/openslx" ]]; then logging.warn "Downloading OpenSLX configuration file from any of the servers \"${slx_server}\" at location \"${slx_server_base}/${configuration_file_name}\" failed. Return code: $return_code" exit 1 fi + +# slxsrv overrides SLX_DNBD3_SERVERS if prefixed with @ +[ "${slx_server#@}" != "${slx_server}" ] && sed -i "s/^SLX_DNBD3_SERVERS=.*/SLX_DNBD3_SERVERS='${slx_server#@}'/" "/etc/openslx" + } exceptions.catch { |
