Message ID | 1482842296-28702-1-git-send-email-mayosemmel@gmail.com |
---|---|
State | Superseded |
Headers | show |
diff --git a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh index 4c20974..1448014 100755 --- a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh +++ b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh @@ -26,6 +26,9 @@ xml_data=$( wget -q -O - "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest if [ -z "$xml_data" ]; then echo "xml_data is not set" exit 1 +elif echo "$xml_data"|grep "can't connect to remote host" ;then + echo "The Netmon Server cannot be reached." + exit 1 elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then echo "This Router is not present in the Netmon Database." delete_myself
Moin Am Dienstag, den 27.12.2016, 13:38 +0100 schrieb Jan Kraus: > The error only occurs if there isn't any network connection. > Closes https://mantis.freifunk-franken.de/view.php?id=23 Hier wäre es schön "Fixes #23" zu schreiben. Das kann das Mantis inzwischen auch erkennen und dann die Tickets automatisch auf resolved setzen. > > Signed-off-by: Jan Kraus <mayosemmel@gmail.com> Schaut gut aus, wobei man vermutlich ein paar Zeilen drunter nochmal zusätzlich prüfen sollte, ob wirklich Koordinaten gesetzt sind oder nicht. ------ %< ------ hostname=$( echo $xml_data |grep -o '<hostname>.*<\/hostname>'|sed -e 's/<\/\?hostname>//g' ) description=$( echo $xml_data |grep -o '<description>.*<\/description>'|sed -e 's/<\/\?description>//g' ) latitude=$( echo $xml_data |grep -o '<latitude>.*<\/latitude>'|sed -e 's/<\/\?latitude>//g' ) longitude=$( echo $xml_data |grep -o '<longitude>.*<\/longitude>'|sed -e 's/<\/\?longitude>//g' ) + +if [ -z "$latitude" ] || [ -z "$longitude" ]; then + echo "No coordinates, looks like an error" + exit 1 +fi #Check for netmon default coordinates if [ "$latitude" -eq 0 ] && [ "$longitude" -eq 0 ]; then echo "Unable to retrieve coordinates from Netmon." ------ >% ------ Ist nur ein Vorschlag. Ich würde den Commit auch so nehmen, von daher: Reviewed-by: Tim Niemeyer <tim@tn-x.org> Tim > --- > .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh > index 4c20974..1448014 100755 > --- a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh > +++ b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh > @@ -26,6 +26,9 @@ xml_data=$( wget -q -O - "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest > if [ -z "$xml_data" ]; then > echo "xml_data is not set" > exit 1 > +elif echo "$xml_data"|grep "can't connect to remote host" ;then > + echo "The Netmon Server cannot be reached." > + exit 1 > elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then > echo "This Router is not present in the Netmon Database." > delete_myself > -- > 2.1.4 >
The error only occurs if there isn't any network connection. Closes https://mantis.freifunk-franken.de/view.php?id=23 Signed-off-by: Jan Kraus <mayosemmel@gmail.com> --- .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh | 3 +++ 1 file changed, 3 insertions(+)