Skip to content

Commit 8c8ccf0

Browse files
authored
Merge pull request #200 from shtripat/sds-detection-fix
Corrected sds detection plugin logic
2 parents 6bfb841 + c8c366e commit 8c8ccf0

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

tendrl/node_agent/discovery/sds/plugins/discover_ceph_sds_details.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import logging
3+
import os.path
34
import subprocess
45

56
from tendrl.node_agent.discovery.sds.discover_sds_plugin \
@@ -39,6 +40,9 @@ def discover_storage_system(self):
3940
#TODO(shtripat) handle the case of ubuntu
4041

4142
if cfg_file != "":
43+
if not os.path.exists(cfg_file):
44+
LOG.info("config file: %s not found" % cfg_file)
45+
return ret_val
4246
with open(cfg_file) as f:
4347
for line in f:
4448
if line.startswith("CLUSTER="):

tendrl/node_agent/manager/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ def load_and_execute_sds_discovery_plugins(self):
6666
for plugin in sds_discovery_manager.get_available_plugins():
6767
sds_details = plugin.discover_storage_system()
6868
if sds_details:
69-
tendrl_ns.node_agent.objects.DetectedCluster(
70-
detected_cluster_id=sds_details['detected_cluster_id'],
71-
sds_pkg_name=sds_details['pkg_name'],
72-
sds_pkg_version=sds_details['pkg_version'],
73-
).save()
69+
try:
70+
tendrl_ns.node_agent.objects.DetectedCluster(
71+
detected_cluster_id=sds_details.get('detected_cluster_id'),
72+
sds_pkg_name=sds_details.get('pkg_name'),
73+
sds_pkg_version=sds_details.get('pkg_version'),
74+
).save()
75+
except etcd.EtcdException as ex:
76+
LOG.error('Failed to update etcd . Error %s' % str(ex))
77+
break
7478

7579

7680
def main():

0 commit comments

Comments
 (0)