Skip to content

Commit

Permalink
handle exceptions from info_XDR_build_version
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-spike committed May 11, 2020
1 parent 63f5da0 commit 2541e53
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
21 changes: 17 additions & 4 deletions lib/basiccontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def do_dc(self, line):
nodes_running_v49_or_lower = False

for node in stats:
node_xdr_build_major_version = int(xdr_builds[node][0])
try:
node_xdr_build_major_version = int(xdr_builds[node][0])
except:
continue

if node_xdr_build_major_version >= 5:
nodes_running_v5_or_higher = True
Expand Down Expand Up @@ -249,7 +252,10 @@ def do_xdr(self, line):
xdr5_stats = {}

for node in stats:
node_xdr_build_major_version = int(xdr_builds[node][0])
try:
node_xdr_build_major_version = int(xdr_builds[node][0])
except:
continue

if node_xdr_build_major_version < 5:
old_xdr_stats[node] = stats[node]
Expand Down Expand Up @@ -853,7 +859,11 @@ def do_xdr(self, line):
xdr5_stats = {}

for node in xdr_stats:
node_xdr_build_major_version = int(xdr_builds[node][0])
try:
node_xdr_build_major_version = int(xdr_builds[node][0])
except:
continue

if node_xdr_build_major_version < 5:
old_xdr_stats[node] = xdr_stats[node]
else:
Expand Down Expand Up @@ -917,7 +927,10 @@ def do_dc(self, line):
for dc in dc_stats.values():

for node in dc:
node_xdr_build_major_version = int(xdr_builds[node][0])
try:
node_xdr_build_major_version = int(xdr_builds[node][0])
except:
continue

if node_xdr_build_major_version >= 5:
nodes_running_v5_or_higher = True
Expand Down
5 changes: 5 additions & 0 deletions lib/client/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ def is_XDR_enabled(self):

# 'enable-xdr' was removed in XDR5.0, so check that get-config:context=xdr does not return an error.
if util.info_valid(config):
try:
xdr_enabled = config['enable-xdr']
return xdr_enabled == 'true'
except Exception:
pass
return True

return False
Expand Down
21 changes: 17 additions & 4 deletions lib/collectinfocontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def do_xdr(self, line):

for xdr_node in xdr_stats[timestamp].keys():
xdr_enable[xdr_node] = True
node_xdr_build_major_version = int(builds[xdr_node][0])
try:
node_xdr_build_major_version = int(builds[xdr_node][0])
except:
continue

if node_xdr_build_major_version < 5:
old_xdr_stats[xdr_node] = xdr_stats[timestamp][xdr_node]
Expand Down Expand Up @@ -221,7 +224,11 @@ def do_dc(self, line):
pass

for version in builds.values():
node_xdr_build_major_version = int(version[0])
try:
node_xdr_build_major_version = int(version[0])
except:
continue

if node_xdr_build_major_version >= 5:
nodes_running_v5_or_higher = True
else:
Expand Down Expand Up @@ -754,7 +761,10 @@ def do_xdr(self, line):
for_mods = self.mods['for']

for xdr_node in xdr_stats[timestamp]:
node_xdr_build_major_version = int(builds[xdr_node][0])
try:
node_xdr_build_major_version = int(builds[xdr_node][0])
except:
continue

if node_xdr_build_major_version < 5:
old_xdr_stats[xdr_node] = xdr_stats[timestamp][xdr_node]
Expand Down Expand Up @@ -814,7 +824,10 @@ def do_dc(self, line):
nodes_running_v49_or_lower = False

for version in builds.values():
node_xdr_build_major_version = int(version[0])
try:
node_xdr_build_major_version = int(version[0])
except:
continue

if node_xdr_build_major_version >= 5:
nodes_running_v5_or_higher = True
Expand Down

0 comments on commit 2541e53

Please sign in to comment.