mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +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:
|
||||
cmd_line_option_list['syslog'] = ('localhost',514)
|
||||
|
||||
|
||||
get_gns3config(cmd_line_option_list)
|
||||
|
||||
for opt, val in opts:
|
||||
@ -225,8 +224,10 @@ def get_gns3config(cmd_line_option_list):
|
||||
except configparser.NoSectionError:
|
||||
pass
|
||||
|
||||
cloud_config_file = "%s/.config/GNS3/cloud.conf"
|
||||
if os.path.isfile(cloud_config_file)
|
||||
cloud_config_file = "%s/.config/GNS3/cloud.conf" % (
|
||||
os.path.expanduser("~/"))
|
||||
|
||||
if os.path.isfile(cloud_config_file):
|
||||
config.read(cloud_config_file)
|
||||
|
||||
try:
|
||||
|
@ -51,13 +51,11 @@ class DeadMan(IModule):
|
||||
self._heartbeat_file = "%s/heartbeat_file_for_gnsdms" % (
|
||||
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:
|
||||
self._heartbeat_file = kwargs['heartbeat_file']
|
||||
|
||||
self._deadman_process = None
|
||||
self.heartbeat()
|
||||
self.start()
|
||||
|
||||
def _start_deadman_process(self):
|
||||
@ -72,11 +70,12 @@ class DeadMan(IModule):
|
||||
|
||||
cmd = []
|
||||
cmd.append("gns3dms")
|
||||
cmd.append("--file %s" % (self._heartbeat_file))
|
||||
cmd.append("--file")
|
||||
cmd.append("%s" % (self._heartbeat_file))
|
||||
cmd.append("--background")
|
||||
log.debug("Deadman: Running %s"%(cmd))
|
||||
|
||||
process = subprocess.Popen(cmd, shell=False)
|
||||
process = subprocess.Popen(cmd, stderr=subprocess.STDOUT, shell=False)
|
||||
return process
|
||||
|
||||
def _stop_deadman_process(self):
|
||||
@ -143,7 +142,7 @@ class DeadMan(IModule):
|
||||
now = time.time()
|
||||
|
||||
with open(self._heartbeat_file, 'w') as heartbeat_file:
|
||||
heartbeat_file.write(now)
|
||||
heartbeat_file.write(str(now))
|
||||
heartbeat_file.close()
|
||||
|
||||
log.debug("Deadman: heartbeat_file updated: %s %s" % (
|
||||
@ -151,5 +150,4 @@ class DeadMan(IModule):
|
||||
now,
|
||||
))
|
||||
|
||||
|
||||
self.start()
|
Loading…
Reference in New Issue
Block a user