Cleanup unbreakable space

This commit is contained in:
Julien Duponchelle committed 2016-05-18 11:23:45 +02:00
1 parent 8cb5cedb5d
commit 871fea33e0
22 files changed
+56 -56

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ import logging
log = logging.getLogger(__name__)
# Dev build
# Dev build
if __version_info__[3] != 0:
import faulthandler
+6 -6
View File
@@ -236,7 +236,7 @@ class ProjectHandler:
:returns: hash
"""
stats = {}
# Non blocking call in order to get cpu usage. First call will return 0
# Non blocking call in order to get cpu usage. First call will return 0
stats["cpu_usage_percent"] = psutil.cpu_percent(interval=None)
stats["memory_usage_percent"] = psutil.virtual_memory().percent
return {"action": "ping", "event": stats}
@@ -280,7 +280,7 @@ class ProjectHandler:
path = request.match_info["path"]
path = os.path.normpath(path)
# Raise error if user try to escape
# Raise error if user try to escape
if path[0] == ".":
raise aiohttp.web.HTTPForbidden
path = os.path.join(project.path, path)
@@ -325,7 +325,7 @@ class ProjectHandler:
path = request.match_info["path"]
path = os.path.normpath(path)
# Raise error if user try to escape
# Raise error if user try to escape
if path[0] == ".":
raise aiohttp.web.HTTPForbidden
path = os.path.join(project.path, path)
@@ -394,10 +394,10 @@ class ProjectHandler:
project = pm.create_project(project_id=project_id)
# We write the content to a temporary location
# and after extract all. It could be more optimal to stream
# and after extract all. It could be more optimal to stream
# this but it's not implemented in Python.
# 
# Spooled mean the file is temporary keep in ram until max_size
#
# Spooled mean the file is temporary keep in ram until max_size
try:
with tempfile.SpooledTemporaryFile(max_size=10000) as temp:
while True:
+1 -1
View File
@@ -423,7 +423,7 @@ class BaseManager:
return force_unix_path(path)
else:
# For non local server we disallow using absolute path outside image directory
# For non local server we disallow using absolute path outside image directory
if Config.instance().get_section_config("Server").get("local", False) is False:
img_directory = self.config.get_section_config("Server").get("images_path", os.path.expanduser("~/GNS3/images"))
img_directory = force_unix_path(img_directory)
+1 -1
View File
@@ -71,7 +71,7 @@ class BaseVM:
else:
self._console = self._manager.port_manager.reserve_tcp_port(self._console, self._project)
# We need to allocate aux before giving a random console port
# We need to allocate aux before giving a random console port
if self._aux is not None:
self._aux = self._manager.port_manager.reserve_tcp_port(self._aux, self._project)
+3 -3
View File
@@ -117,11 +117,11 @@ class Docker(BaseManager):
pass
log.debug("Query Docker %s %s params=%s data=%s Response: %s", method, path, params, data, body)
if response.status == 304:
raise DockerHttp304Error("Docker has returned an error: {} {}".format(response.status, body))
raise DockerHttp304Error("Docker has returned an error: {} {}".format(response.status, body))
elif response.status == 404:
raise DockerHttp404Error("Docker has returned an error: {} {}".format(response.status, body))
raise DockerHttp404Error("Docker has returned an error: {} {}".format(response.status, body))
else:
raise DockerError("Docker has returned an error: {} {}".format(response.status, body))
raise DockerError("Docker has returned an error: {} {}".format(response.status, body))
return response
@asyncio.coroutine
+1 -1
View File
@@ -367,7 +367,7 @@ class DockerVM(BaseVM):
"""
# We can not use the API because docker doesn't expose a websocket api for exec
# https://github.com/GNS3/gns3-gui/issues/1039
# https://github.com/GNS3/gns3-gui/issues/1039
process = yield from asyncio.subprocess.create_subprocess_exec(
"docker", "exec", "-i", self._cid, "/gns3/bin/busybox", "script", "-qfc", "/gns3/bin/busybox sh", "/dev/null",
stdout=asyncio.subprocess.PIPE,
+1 -1
View File
@@ -17,7 +17,7 @@
#
# This script is injected into the container and launch before
# the start command of the container
# the start command of the container
#
OLD_PATH="$PATH"
PATH=/gns3/bin:/tmp/gns3/bin
+1 -1
View File
@@ -219,7 +219,7 @@ class Dynamips(BaseManager):
continue
# Release the dynamips ids if we want to reload the same project
# later
# later
if project.id in self._dynamips_ids:
del self._dynamips_ids[project.id]
+1 -1
View File
@@ -131,7 +131,7 @@ class IOUVM(BaseVM):
self._path = self.manager.get_abs_image_path(path)
# In 1.2 users uploaded images to the images roots
# after the migration their images are inside images/IOU
# after the migration their images are inside images/IOU
# but old topologies use old path
if "IOU" not in self._path:
location, filename = os.path.split(self._path)
+1 -1
View File
@@ -533,7 +533,7 @@ class Project:
if os.path.split(root)[-1:][0] == "project-files":
dirs[:] = [d for d in dirs if d not in ("snapshots", "captures")]
# Ignore log files and OS noise
# Ignore log files and OS noise
files = [f for f in files if not f.endswith('_log.txt') and not f.endswith('.log') and f != '.DS_Store']
for file in files:
+2 -2
View File
@@ -82,8 +82,8 @@ class QemuVM(BaseVM):
try:
self.qemu_path = qemu_path
except QemuError as e:
# If the binary is not found for topologies 1.4 and later
# search via the platform otherwise use the binary name
# If the binary is not found for topologies 1.4 and later
# search via the platform otherwise use the binary name
if platform:
self.platform = platform
else:
+2 -2
View File
@@ -83,8 +83,8 @@ class VirtualBox(BaseManager):
@asyncio.coroutine
def execute(self, subcommand, args, timeout=60):
# We use a lock prevent parallel execution due to strange errors
# reported by a user and reproduced by us.
# We use a lock prevent parallel execution due to strange errors
# reported by a user and reproduced by us.
# https://github.com/GNS3/gns3-gui/issues/261
with (yield from self._execute_lock):
vboxmanage_path = self.vboxmanage_path
+1 -1
View File
@@ -73,7 +73,7 @@ def parse_version(version):
version.append("00000")
if len(version) == 2:
version.append("000000")
# We want rc to be at lower level than dev version
# We want rc to be at lower level than dev version
if info == 'rc':
info = 'c'
version.append(info)
+1 -1
View File
@@ -54,7 +54,7 @@ def subprocess_check_output(*args, cwd=None, env=None):
if output is None:
return ""
# If we received garbage we ignore invalid characters
# it should happend only when user try to use another binary
# it should happend only when user try to use another binary
# and the code of VPCS, dynamips... Will detect it's not the correct binary
return output.decode("utf-8", errors="ignore")
+1 -1
View File
@@ -69,7 +69,7 @@ class AsyncioTelnetServer:
self._binary = binary
# If echo is true when the client send data
# the data is echo on his terminal by telnet otherwise
# the data is echo on his terminal by telnet otherwise
# it's our job (or the wrapped app) to send back the data
self._echo = echo
+1 -1
View File
@@ -74,7 +74,7 @@ class ColouredStreamHandler(logging.StreamHandler):
stream.write(msg)
stream.write(self.terminator)
self.flush()
# On OSX when frozen flush raise a BrokenPipeError
# On OSX when frozen flush raise a BrokenPipeError
except BrokenPipeError:
pass
except Exception: