Skip to content

Commit

Permalink
tolerate get build version exception during collect info
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-spike committed May 13, 2020
1 parent 2541e53 commit 6b97929
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions lib/basiccontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,9 @@ def _dump_collectinfo_pretty_print(self, timestamp, as_logfile_prefix, config_pa
except Exception:
as_version = None

if isinstance(as_version, Exception):
as_version = None

# find all namespaces
try:
namespaces = self._parse_namespace(self.cluster.info("namespaces"))
Expand All @@ -1388,11 +1391,14 @@ def _dump_collectinfo_pretty_print(self, timestamp, as_logfile_prefix, config_pa
hist_list = ['ttl', 'object-size', 'object-size-linear']
hist_dump_info_str = "histogram:namespace=%s;type=%s"

if LooseVersion(as_version) < LooseVersion("4.2.0"):
# histogram command introduced in 4.2.0
# use hist-dump command for older versions
hist_list = ['ttl', 'objsz']
hist_dump_info_str = "hist-dump:ns=%s;hist=%s"
try:
if LooseVersion(as_version) < LooseVersion("4.2.0"):
# histogram command introduced in 4.2.0
# use hist-dump command for older versions
hist_list = ['ttl', 'objsz']
hist_dump_info_str = "hist-dump:ns=%s;hist=%s"
except: # probably failed to get build version, node may be down
pass

for ns in namespaces:
for hist in hist_list:
Expand Down Expand Up @@ -1496,9 +1502,12 @@ def _dump_collectinfo_pretty_print(self, timestamp, as_logfile_prefix, config_pa

# Comparing with this version because prior to this it was
# citrusleaf.conf
if LooseVersion(as_version) <= LooseVersion("3.0.0"):
conf_path = "/etc/citrusleaf/citrusleaf.conf"
self.aslogfile = as_logfile_prefix + 'citrusleaf.conf'
try:
if LooseVersion(as_version) <= LooseVersion("3.0.0"):
conf_path = "/etc/citrusleaf/citrusleaf.conf"
self.aslogfile = as_logfile_prefix + 'citrusleaf.conf'
except: # probably failed to get build version, node may be down
pass

try:
self._collect_local_file(conf_path, self.aslogfile)
Expand Down

0 comments on commit 6b97929

Please sign in to comment.