From 35cc0401d623074949eae1713bbae3ee865c6d14 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Tue, 3 Oct 2023 08:21:08 +1100 Subject: [PATCH] move connectivity checks earlier --- install-koji-farm.sh | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/install-koji-farm.sh b/install-koji-farm.sh index 432e89e..8e9f9ea 100644 --- a/install-koji-farm.sh +++ b/install-koji-farm.sh @@ -28,6 +28,37 @@ if [ $DEBUG ] ; then QUIET="-v" fi +echo "Checking connectivity..." +# install any required packages +if [[ -z $(dnf list installed | grep epel-release) ]] ; then + dnf install -y epel-release $QUIET +fi +if [[ -z $(dnf list installed | grep netcat) ]] ; then + dnf install -y netcat $QUIET +fi + +if [[ ! $KOJI_WEB_FQDN = $KOJI_HUB_FQDN ]] ; then + # check that I can conmnect + if [[ -z $(nc -z $KOJI_WEB_FQDN 22 2>&1 | grep succeeded) ]] ; then + echo "I cannot connect to the web server at $KOJI_WEB_FQDN! Is it online? " + echo "Options:" + echo "- turn on the server" + echo "- add this server into the /etc/hosts file on this server" + exit 1 + fi +fi + +for FQDN in ${KOJI_BUILD_FQDNS} ; do + # check that I can conmnect + if [[ -z $(nc -z $FQDN 22 2>&1 | grep succeeded) ]] ; then + echo "I cannot connect to builder at $FQDN! Is it online? " + echo "Options:" + echo "- turn on the server" + echo "- add this server into the /etc/hosts file on this server" + exit 1 + fi +done + # pull down the deploy scripts SCRIPT_GIT="https://src.koozali.org/smedev/smeserver-koji/raw/branch/master/koji-setup" SCRIPT_DIR="$(echo ~)/bin" @@ -41,37 +72,6 @@ curl $SILENT $SCRIPT_GIT/koji-bootstrap-build.sh > $SCRIPT_DIR/koji-bootstrap-bu curl $SILENT $SCRIPT_GIT/koji-add-user.sh > $SCRIPT_DIR/koji-add-user.sh chmod o+x $SCRIPT_DIR/*.sh -# install any required packages -if [[ -z $(dnf list installed | grep epel-release) ]] ; then - dnf install -y epel-release $QUIET -fi -if [[ -z $(dnf list installed | grep netcat) ]] ; then - dnf install -y netcat $QUIET -fi - -if [[ ! $KOJI_WEB_FQDN = $KOJI_HUB_FQDN ]] ; then - # check that I can conmnect - RESP=$(nc -z $KOJI_WEB_FQDN 22 2>&1 | grep succeeded) - if [[ -z $RESP ]] ; then - echo "I cannot connect to the web server at $KOJI_WEB_FQDN! Is it online? " - echo "Options:" - echo "- turn on the server" - echo "- add this server into the /etc/hosts file on this server" - exit 1 - fi -fi -for FQDN in ${KOJI_BUILD_FQDNS} ; do - # check that I can conmnect - RESP=$(nc -z $FQDN 22 2>&1 | grep succeeded) - if [[ -z $RESP ]] ; then - echo "I cannot connect to builder at $FQDN! Is it online? " - echo "Options:" - echo "- turn on the server" - echo "- add this server into the /etc/hosts file on this server" - exit 1 - fi -done - # ask for required parameters (ssh settings and build server FQDN) echo "Please enter the following details for generating your SSL keys" while true ; do