mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-23 14:42:28 +00:00
GNS3 server will now create the heardbeat file durining initialization
This commit is contained in:
parent
ef492d4690
commit
f876a862c4
@ -145,7 +145,6 @@ def parse_cmd_line(argv):
|
|||||||
else:
|
else:
|
||||||
cmd_line_option_list['syslog'] = ('localhost',514)
|
cmd_line_option_list['syslog'] = ('localhost',514)
|
||||||
|
|
||||||
|
|
||||||
get_gns3config(cmd_line_option_list)
|
get_gns3config(cmd_line_option_list)
|
||||||
|
|
||||||
for opt, val in opts:
|
for opt, val in opts:
|
||||||
@ -225,8 +224,10 @@ def get_gns3config(cmd_line_option_list):
|
|||||||
except configparser.NoSectionError:
|
except configparser.NoSectionError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
cloud_config_file = "%s/.config/GNS3/cloud.conf"
|
cloud_config_file = "%s/.config/GNS3/cloud.conf" % (
|
||||||
if os.path.isfile(cloud_config_file)
|
os.path.expanduser("~/"))
|
||||||
|
|
||||||
|
if os.path.isfile(cloud_config_file):
|
||||||
config.read(cloud_config_file)
|
config.read(cloud_config_file)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -51,13 +51,11 @@ class DeadMan(IModule):
|
|||||||
self._heartbeat_file = "%s/heartbeat_file_for_gnsdms" % (
|
self._heartbeat_file = "%s/heartbeat_file_for_gnsdms" % (
|
||||||
self._tempdir)
|
self._tempdir)
|
||||||
|
|
||||||
self.cloud_config = Config.instance().get_section_config("CLOUD_SERVER")
|
|
||||||
self._heartbeat_file = self.cloud_config["heartbeat_file"]
|
|
||||||
|
|
||||||
if 'heartbeat_file' in kwargs:
|
if 'heartbeat_file' in kwargs:
|
||||||
self._heartbeat_file = kwargs['heartbeat_file']
|
self._heartbeat_file = kwargs['heartbeat_file']
|
||||||
|
|
||||||
self._deadman_process = None
|
self._deadman_process = None
|
||||||
|
self.heartbeat()
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def _start_deadman_process(self):
|
def _start_deadman_process(self):
|
||||||
@ -72,11 +70,12 @@ class DeadMan(IModule):
|
|||||||
|
|
||||||
cmd = []
|
cmd = []
|
||||||
cmd.append("gns3dms")
|
cmd.append("gns3dms")
|
||||||
cmd.append("--file %s" % (self._heartbeat_file))
|
cmd.append("--file")
|
||||||
|
cmd.append("%s" % (self._heartbeat_file))
|
||||||
cmd.append("--background")
|
cmd.append("--background")
|
||||||
log.debug("Deadman: Running %s"%(cmd))
|
log.debug("Deadman: Running %s"%(cmd))
|
||||||
|
|
||||||
process = subprocess.Popen(cmd, shell=False)
|
process = subprocess.Popen(cmd, stderr=subprocess.STDOUT, shell=False)
|
||||||
return process
|
return process
|
||||||
|
|
||||||
def _stop_deadman_process(self):
|
def _stop_deadman_process(self):
|
||||||
@ -143,7 +142,7 @@ class DeadMan(IModule):
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
||||||
with open(self._heartbeat_file, 'w') as heartbeat_file:
|
with open(self._heartbeat_file, 'w') as heartbeat_file:
|
||||||
heartbeat_file.write(now)
|
heartbeat_file.write(str(now))
|
||||||
heartbeat_file.close()
|
heartbeat_file.close()
|
||||||
|
|
||||||
log.debug("Deadman: heartbeat_file updated: %s %s" % (
|
log.debug("Deadman: heartbeat_file updated: %s %s" % (
|
||||||
@ -151,5 +150,4 @@ class DeadMan(IModule):
|
|||||||
now,
|
now,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
self.start()
|
self.start()
|
Loading…
Reference in New Issue
Block a user