mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Rename all EnvironmentError to OSError.
Change version number to 1.0a2-dev1. Check only on Python >= 3.3.
This commit is contained in:
1 parent
20597e29df
commit
f4dd096a8b
11 files changed
+40
-30
No files matched your search
@@ -208,7 +208,7 @@ class Dynamips(IModule):
|
||||
if not os.path.exists(self._working_dir):
|
||||
try:
|
||||
os.makedirs(self._working_dir)
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
raise DynamipsError("Could not create working directory {}".format(e))
|
||||
|
||||
# check if the working directory is writable
|
||||
@@ -410,14 +410,14 @@ class Dynamips(IModule):
|
||||
if not os.path.exists(config_dir):
|
||||
try:
|
||||
os.makedirs(config_dir)
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
raise DynamipsError("Could not create configs directory: {}".format(e))
|
||||
config_path = os.path.join(config_dir, config_filename)
|
||||
try:
|
||||
with open(config_path, "w") as f:
|
||||
log.info("saving startup-config to {}".format(config_path))
|
||||
f.write(config)
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
raise DynamipsError("Could not save the configuration {}: {}".format(config_path, e))
|
||||
return "configs" + os.sep + os.path.basename(config_path)
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ class VM(object):
|
||||
with open(config_path, "w") as f:
|
||||
log.info("saving startup-config to {}".format(router.startup_config))
|
||||
f.write(config)
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
raise DynamipsError("Could not save the startup configuration {}: {}".format(config_path, e))
|
||||
|
||||
if private_config_base64:
|
||||
@@ -478,7 +478,7 @@ class VM(object):
|
||||
with open(config_path, "w") as f:
|
||||
log.info("saving private-config to {}".format(router.private_config))
|
||||
f.write(config)
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
raise DynamipsError("Could not save the private configuration {}: {}".format(config_path, e))
|
||||
|
||||
except DynamipsError as e:
|
||||
|
||||
@@ -211,7 +211,7 @@ class Hypervisor(DynamipsHypervisor):
|
||||
cwd=self._working_dir)
|
||||
log.info("Dynamips started PID={}".format(self._process.pid))
|
||||
self._started = True
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
log.error("could not start Dynamips: {}".format(e))
|
||||
raise DynamipsError("could not start Dynamips: {}".format(e))
|
||||
|
||||
@@ -247,7 +247,7 @@ class Hypervisor(DynamipsHypervisor):
|
||||
try:
|
||||
with open(self._stdout_file) as file:
|
||||
output = file.read()
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
log.warn("could not read {}: {}".format(self._stdout_file, e))
|
||||
return output
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ class HypervisorManager(object):
|
||||
# if not os.path.exists(working_dir):
|
||||
# try:
|
||||
# os.makedirs(working_dir)
|
||||
# except EnvironmentError as e:
|
||||
# except OSError as e:
|
||||
# raise DynamipsError("{}".format(e))
|
||||
|
||||
hypervisor = Hypervisor(self._path,
|
||||
|
||||
Reference in new issue
Block a user