Rename all EnvironmentError to OSError.

Change version number to 1.0a2-dev1.
Check only on Python >= 3.3.
This commit is contained in:
grossmj committed 2014-04-02 16:10:59 -06:00
1 parent 20597e29df
commit f4dd096a8b
11 files changed
+40 -30

No files matched your search

+7 -7
View File
@@ -87,8 +87,8 @@ class IOU(IModule):
self._iourc = ""
# check every 5 seconds
self._iou_callback = self.add_periodic_callback(self._check_iou_is_alive, 5000)
self._iou_callback.start()
#self._iou_callback = self.add_periodic_callback(self._check_iou_is_alive, 5000)
#self._iou_callback.start()
def stop(self):
"""
@@ -154,7 +154,7 @@ class IOU(IModule):
try:
log.info("deleting iourc file {}".format(self._iourc))
os.remove(self._iourc)
except EnvironmentError as e:
except OSError as e:
log.warn("could not delete iourc file {}: {}".format(self._iourc, e))
log.info("IOU module has been reset")
@@ -189,7 +189,7 @@ class IOU(IModule):
log.info("saving iourc file content to {}".format(f.name))
f.write(base64iourc)
self._iourc = f.name
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not save iourc file to {}: {}".format(f.name, e))
if "iouyap" in request and request["iouyap"]:
@@ -244,7 +244,7 @@ class IOU(IModule):
if not os.path.exists(self._working_dir):
try:
os.makedirs(self._working_dir)
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not create working directory {}".format(e))
iou_instance = IOUDevice(iou_path, self._working_dir, host=self._default_host, name=name)
@@ -333,7 +333,7 @@ class IOU(IModule):
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 IOUError("Could not save the configuration {}: {}".format(config_path, e))
request["startup_config"] = os.path.basename(config_path)
if "startup_config" in request:
@@ -544,7 +544,7 @@ class IOU(IModule):
IFF_NO_PI = 0x1000
try:
tun = os.open("/dev/net/tun", os.O_RDWR)
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not open /dev/net/tun: {}".format(e))
ifr = struct.pack("16sH", tap_device.encode("utf-8"), IFF_TAP | IFF_NO_PI)
try:
+7 -7
View File
@@ -249,7 +249,7 @@ class IOUDevice(object):
if not os.path.exists(working_dir):
try:
os.makedirs(working_dir)
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not create working directory {}: {}".format(working_dir, e))
self._working_dir = working_dir
@@ -348,7 +348,7 @@ class IOUDevice(object):
config.write(config_file)
log.info("IOU {name} [id={id}]: iouyap.ini updated".format(name=self._name,
id=self._id))
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not create {}: {}".format(iouyap_ini, e))
def _create_netmap_config(self):
@@ -367,7 +367,7 @@ class IOUDevice(object):
iou_id=self._id))
log.info("IOU {name} [id={id}]: NETMAP file created".format(name=self._name,
id=self._id))
except EnvironmentError as e:
except OSError as e:
raise IOUError("Could not create {}: {}".format(netmap_path, e))
def _start_ioucon(self):
@@ -401,7 +401,7 @@ class IOUDevice(object):
cwd=self._working_dir)
log.info("iouyap started PID={}".format(self._iouyap_process.pid))
except EnvironmentError as e:
except OSError as e:
log.error("could not start iouyap: {}".format(e))
raise IOUError("Could not start iouyap: {}".format(e))
@@ -434,7 +434,7 @@ class IOUDevice(object):
env=env)
log.info("IOU instance {} started PID={}".format(self._id, self._process.pid))
self._started = True
except EnvironmentError as e:
except OSError as e:
log.error("could not start IOU: {}".format(e))
raise IOUError("could not start IOU: {}".format(e))
@@ -493,7 +493,7 @@ class IOUDevice(object):
try:
with open(self._iou_stdout_file) as file:
output = file.read()
except EnvironmentError as e:
except OSError as e:
log.warn("could not read {}: {}".format(self._iou_stdout_file, e))
return output
@@ -508,7 +508,7 @@ class IOUDevice(object):
try:
with open(self._iouyap_stdout_file) as file:
output = file.read()
except EnvironmentError as e:
except OSError as e:
log.warn("could not read {}: {}".format(self._iouyap_stdout_file, e))
return output