1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Delete IOS ghost files. Bump version to alpha3.

This commit is contained in:
grossmj 2014-05-02 15:38:52 -06:00
parent f9b0f11221
commit f185c4d489
6 changed files with 20 additions and 6 deletions

View File

@ -24,6 +24,7 @@ import os
import base64 import base64
import tempfile import tempfile
import shutil import shutil
import glob
from gns3server.modules import IModule from gns3server.modules import IModule
import gns3server.jsonrpc as jsonrpc import gns3server.jsonrpc as jsonrpc
@ -207,6 +208,16 @@ class Dynamips(IModule):
self._frame_relay_switches.clear() self._frame_relay_switches.clear()
self._atm_switches.clear() self._atm_switches.clear()
# delete ghost files
ghost_files = glob.glob(os.path.join(self._working_dir, "dynamips", "*.ghost"))
for ghost_file in ghost_files:
try:
log.debug("deleting ghost file {}".format(ghost_file))
os.remove(ghost_file)
except OSError as e:
log.warn("could not delete ghost file {}: {}".format(ghost_file, e))
continue
self._hypervisor_manager = None self._hypervisor_manager = None
log.info("dynamips module has been reset") log.info("dynamips module has been reset")
@ -270,14 +281,14 @@ class Dynamips(IModule):
self._working_dir = request.pop("working_dir") self._working_dir = request.pop("working_dir")
log.info("this server is local") log.info("this server is local")
else: else:
self._working_dir = os.path.join(self._projects_dir, request["project_name"]) self._working_dir = os.path.join(self._projects_dir, request["project_name"] + ".gns3")
log.info("this server is remote with working directory path to {}".format(self._working_dir)) log.info("this server is remote with working directory path to {}".format(self._working_dir))
self._hypervisor_manager_settings = request self._hypervisor_manager_settings = request
else: else:
if "project_name" in request: if "project_name" in request:
new_working_dir = os.path.join(self._projects_dir, request["project_name"]) new_working_dir = os.path.join(self._projects_dir, request["project_name"] + ".gns3")
if self._projects_dir != self._working_dir != new_working_dir: if self._projects_dir != self._working_dir != new_working_dir:
# trick to avoid file locks by Dynamips on Windows # trick to avoid file locks by Dynamips on Windows

View File

@ -93,6 +93,9 @@ class DynamipsHypervisor(object):
self._uuid = self.send("hypervisor uuid") self._uuid = self.send("hypervisor uuid")
# this forces to send the working dir to Dynamips
self.working_dir = self._working_dir
@property @property
def version(self): def version(self):
""" """

View File

@ -558,7 +558,7 @@ class HypervisorManager(object):
self._host, self._host,
port) port)
log.info("creating new hypervisor {}:{}".format(hypervisor.host, hypervisor.port)) log.info("creating new hypervisor {}:{} with working directory {}".format(hypervisor.host, hypervisor.port, self._working_dir))
hypervisor.start() hypervisor.start()
self.wait_for_hypervisor(self._host, port) self.wait_for_hypervisor(self._host, port)

View File

@ -234,7 +234,7 @@ class IOU(IModule):
new_working_dir = request["working_dir"] new_working_dir = request["working_dir"]
log.info("this server is local with working directory path to {}".format(new_working_dir)) log.info("this server is local with working directory path to {}".format(new_working_dir))
else: else:
new_working_dir = os.path.join(self._projects_dir, request["project_name"]) new_working_dir = os.path.join(self._projects_dir, request["project_name"] + ".gns3")
log.info("this server is remote with working directory path to {}".format(new_working_dir)) log.info("this server is remote with working directory path to {}".format(new_working_dir))
if self._projects_dir != self._working_dir != new_working_dir: if self._projects_dir != self._working_dir != new_working_dir:
if not os.path.isdir(new_working_dir): if not os.path.isdir(new_working_dir):

View File

@ -390,7 +390,7 @@ class IOUDevice(object):
try: try:
self._update_iouyap_config() self._update_iouyap_config()
command = [self._iouyap, str(self._id + 512)] # iouyap has always IOU ID + 512 command = [self._iouyap, "-q", str(self._id + 512)] # iouyap has always IOU ID + 512
log.info("starting iouyap: {}".format(command)) log.info("starting iouyap: {}".format(command))
self._iouyap_stdout_file = os.path.join(self._working_dir, "iouyap.log") self._iouyap_stdout_file = os.path.join(self._working_dir, "iouyap.log")
log.info("logging to {}".format(self._iouyap_stdout_file)) log.info("logging to {}".format(self._iouyap_stdout_file))

View File

@ -23,5 +23,5 @@
# or negative for a release candidate or beta (after the base version # or negative for a release candidate or beta (after the base version
# number has been incremented) # number has been incremented)
__version__ = "1.0a3.dev3" __version__ = "1.0-alpha3"
__version_info__ = (1, 0, 0, -99) __version_info__ = (1, 0, 0, -99)