File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
22import logging
3+ import os .path
34import subprocess
45
56from 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=" ):
Original file line number Diff line number Diff 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
7680def main ():
You can’t perform that action at this time.
0 commit comments