Skip to content

Commit

Permalink
Merge "Checking for config file before starting app"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 23, 2016
2 parents 3de21ab + e47dffb commit da2e519
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/nodemgr/analytics_nodemgr/analytics_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from analytics.ttypes import \
NodeStatusUVE, NodeStatus
from pysandesh.connection_info import ConnectionState
from analytics.process_info.ttypes import \
ProcessStatus, ProcessState, ProcessInfo, DiskPartitionUsageStats
from analytics.process_info.constants import \
Expand All @@ -50,6 +51,10 @@ def __init__(self, rule_file, discovery_server,
node_type_name, self.instance_id, self.collector_addr,
self.module_id, 8104, ['analytics'], _disc)
sandesh_global.set_logging_params(enable_local_log=True)
ConnectionState.init(sandesh_global, socket.gethostname(), self.module_id,
self.instance_id,
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)
# end __init__

def process(self):
Expand Down
15 changes: 7 additions & 8 deletions src/nodemgr/common/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,16 @@ def send_nodemgr_process_status_base(self, ProcessStateNames,
fail_status_bits = self.fail_status_bits
state, description = self.get_process_state(fail_status_bits)
process_status = ProcessStatus(
module_id=self.module_id, instance_id=self.instance_id,
state=state, description=description)
module_id=self.module_id, instance_id=self.instance_id,
state=state, description=description)
process_status_list = []
process_status_list.append(process_status)
node_status = NodeStatus(
name=socket.gethostname(),
process_status=process_status_list)
node_status = NodeStatus(name=socket.gethostname(),
process_status=process_status_list)
node_status_uve = NodeStatusUVE(data=node_status)
msg = 'Sending UVE:' + str(node_status_uve)
self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
SandeshLevel.SYS_INFO), msg)
msg = 'Sending UVE:' + str(node_status_uve)
self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
SandeshLevel.SYS_INFO), msg)
node_status_uve.send()

def send_disk_usage_info_base(self, NodeStatusUVE, NodeStatus,
Expand Down
5 changes: 5 additions & 0 deletions src/nodemgr/config_nodemgr/config_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

from cfgm_common.uve.cfgm_cpuinfo.ttypes import \
NodeStatusUVE, NodeStatus
from pysandesh.connection_info import ConnectionState
from cfgm_common.uve.cfgm_cpuinfo.process_info.ttypes import \
ProcessStatus, ProcessState, ProcessInfo, DiskPartitionUsageStats
from cfgm_common.uve.cfgm_cpuinfo.process_info.constants import \
Expand All @@ -59,6 +60,10 @@ def __init__(self, rule_file, discovery_server,
node_type_name, self.instance_id, self.collector_addr,
self.module_id, 8100, ['cfgm_common.uve'], _disc)
sandesh_global.set_logging_params(enable_local_log=True)
ConnectionState.init(sandesh_global, socket.gethostname(),
self.module_id, self.instance_id,
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)
# end __init__

def process(self):
Expand Down
5 changes: 5 additions & 0 deletions src/nodemgr/control_nodemgr/control_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from subprocess import Popen, PIPE
from StringIO import StringIO

from pysandesh.connection_info import ConnectionState
from control_node.control_node.ttypes \
import NodeStatusUVE, NodeStatus
from control_node.control_node.process_info.ttypes \
Expand Down Expand Up @@ -59,6 +60,10 @@ def __init__(self, rule_file, discovery_server,
node_type_name, self.instance_id, self.collector_addr,
self.module_id, 8101, ['control_node.control_node'], _disc)
sandesh_global.set_logging_params(enable_local_log=True)
ConnectionState.init(sandesh_global, socket.gethostname(), self.module_id,
self.instance_id,
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)
# end __init__

def process(self):
Expand Down
5 changes: 5 additions & 0 deletions src/nodemgr/database_nodemgr/database_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from database.sandesh.database.ttypes import \
NodeStatusUVE, NodeStatus, DatabaseUsageStats,\
DatabaseUsageInfo, DatabaseUsage
from pysandesh.connection_info import ConnectionState
from database.sandesh.database.process_info.ttypes import \
ProcessStatus, ProcessState, ProcessInfo, DiskPartitionUsageStats
from database.sandesh.database.process_info.constants import \
Expand Down Expand Up @@ -78,6 +79,10 @@ def __init__(self, rule_file, discovery_server,
self.instance_id, self.collector_addr, self.module_id, 8103,
['database.sandesh'], _disc)
sandesh_global.set_logging_params(enable_local_log=True)
ConnectionState.init(sandesh_global, socket.gethostname(), self.module_id,
self.instance_id,
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)
# end __init__

def _get_cassandra_config_option(self, config):
Expand Down
4 changes: 4 additions & 0 deletions src/nodemgr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from gevent import monkey
monkey.patch_all()
import os
import os.path
import sys
import argparse
import socket
Expand Down Expand Up @@ -88,6 +89,9 @@ def main(args_str=' '.join(sys.argv[1:])):
else:
sys.stderr.write("Node type" + str(node_type) + "is incorrect" + "\n")
return
if (os.path.exists(config_file) == False):
sys.stderr.write("config file " + config_file + " is not present" + "\n")
return
config = ConfigParser.SafeConfigParser()
config.read([config_file])
if 'DEFAULT' in config.sections():
Expand Down
5 changes: 5 additions & 0 deletions src/nodemgr/vrouter_nodemgr/vrouter_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

from vrouter.vrouter.ttypes import \
NodeStatusUVE, NodeStatus
from pysandesh.connection_info import ConnectionState
from vrouter.vrouter.process_info.ttypes import \
ProcessStatus, ProcessState, ProcessInfo, DiskPartitionUsageStats
from vrouter.vrouter.process_info.constants import \
Expand Down Expand Up @@ -64,6 +65,10 @@ def __init__(self, rule_file, discovery_server,
sandesh_global.set_logging_params(enable_local_log=True)
self.supervisor_serverurl = "unix:///tmp/supervisord_vrouter.sock"
self.add_current_process()
ConnectionState.init(sandesh_global, socket.gethostname(), self.module_id,
self.instance_id,
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)

self.lb_stats = LoadbalancerStats()
# end __init__
Expand Down

0 comments on commit da2e519

Please sign in to comment.