Commit 9234f346 authored by Robert Ricci's avatar Robert Ricci
Browse files

Introduce a DELTA for doing comparisons of lat/long.

Note: I can't figure out how to get python to let me put linebreaks
into if conditionals. So, there's one nast long line right now - if
someone who knows python better could fix this, great!
parent b1f3b14f
......@@ -90,6 +90,10 @@ ATTR_NIL_VALUES = ('None',)
# identify a planetlab node
# The amount by which latitude and longitude are allowed to differ before we
# classify them ask changed
PLABNODE = "@prefix@/sbin/plabnode"
SSH = "@prefix@/bin/sshtb"
NAMED_SETUP = "@prefix@/sbin/named_setup"
......@@ -433,6 +437,14 @@ class Plab:
for attr in ent:
if ent[attr] in ATTR_NIL_VALUES:
elif (attr == "LATITUDE") or (attr == "LONGITUDE"):
# Special rules for latitude and longitude to avoid
# FP errors
if (ent[attr] != None and plabent[attr] != None) and (ent[attr] != "" and plabent[attr] != "") and ((float(ent[attr]) > (float(plabent[attr]) + LATLONG_DELTA)) or (float(ent[attr]) < (float(plabent[attr]) - LATLONG_DELTA))):
diff[attr] = (ent[attr], plabent[attr])
same[attr] = ent[attr]
elif ent[attr] == plabent[attr]:
same[attr] = ent[attr]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment