Skip to content

Commit

Permalink
Merge pull request #200 from shtripat/sds-detection-fix
Browse files Browse the repository at this point in the history
Corrected sds detection plugin logic
  • Loading branch information
r0h4n authored Feb 2, 2017
2 parents 6bfb841 + c8c366e commit 8c8ccf0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import os.path
import subprocess

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

if cfg_file != "":
if not os.path.exists(cfg_file):
LOG.info("config file: %s not found" % cfg_file)
return ret_val
with open(cfg_file) as f:
for line in f:
if line.startswith("CLUSTER="):
Expand Down
14 changes: 9 additions & 5 deletions tendrl/node_agent/manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ def load_and_execute_sds_discovery_plugins(self):
for plugin in sds_discovery_manager.get_available_plugins():
sds_details = plugin.discover_storage_system()
if sds_details:
tendrl_ns.node_agent.objects.DetectedCluster(
detected_cluster_id=sds_details['detected_cluster_id'],
sds_pkg_name=sds_details['pkg_name'],
sds_pkg_version=sds_details['pkg_version'],
).save()
try:
tendrl_ns.node_agent.objects.DetectedCluster(
detected_cluster_id=sds_details.get('detected_cluster_id'),
sds_pkg_name=sds_details.get('pkg_name'),
sds_pkg_version=sds_details.get('pkg_version'),
).save()
except etcd.EtcdException as ex:
LOG.error('Failed to update etcd . Error %s' % str(ex))
break


def main():
Expand Down

0 comments on commit 8c8ccf0

Please sign in to comment.