When pool is defined in config but the directory entered there does not exist, lnst-ctl ends in OSError exception. This patch prevents that with warning user that on entered path no directory exists and skips processing it.
Fixes #173
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/SlavePool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 02715ed..ddd4168 100644 --- a/lnst/Controller/SlavePool.py +++ b/lnst/Controller/SlavePool.py @@ -65,7 +65,14 @@ class SlavePool: dir_path)) pool = self._pools[pool_name]
- dentries = os.listdir(dir_path) + try: + dentries = os.listdir(dir_path) + except OSError: + logging.warn("Directory '%s' does not exist for pool '%s'" % + (dir_path, + pool_name)) + return + for dirent in dentries: m_id, m = self.add_file(pool_name, dir_path, dirent) if m_id != None and m != None:
Mon, May 23, 2016 at 02:17:13PM CEST, jprochaz@redhat.com wrote:
When pool is defined in config but the directory entered there does not exist, lnst-ctl ends in OSError exception. This patch prevents that with warning user that on entered path no directory exists and skips processing it.
Fixes #173
This is different issue. Issue #173 is for processing existing empty directory.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
lnst/Controller/SlavePool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 02715ed..ddd4168 100644 --- a/lnst/Controller/SlavePool.py +++ b/lnst/Controller/SlavePool.py @@ -65,7 +65,14 @@ class SlavePool: dir_path)) pool = self._pools[pool_name]
dentries = os.listdir(dir_path)
try:
dentries = os.listdir(dir_path)
except OSError:
logging.warn("Directory '%s' does not exist for pool '%s'" %
(dir_path,
pool_name))
return
for dirent in dentries: m_id, m = self.add_file(pool_name, dir_path, dirent) if m_id != None and m != None:
-- 2.4.11 _______________________________________________ LNST-developers mailing list lnst-developers@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
2016-05-24 10:58 GMT+02:00 Jan Tluka jtluka@redhat.com:
Mon, May 23, 2016 at 02:17:13PM CEST, jprochaz@redhat.com wrote:
When pool is defined in config but the directory entered there does not exist, lnst-ctl ends in OSError exception. This patch prevents that with warning user that on entered path no directory exists and skips processing it.
Fixes #173
This is different issue. Issue #173 is for processing existing empty directory.
Sorry, my bad. Patch for issue #173 is present in list_pools patchset [1].
[1] https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
lnst/Controller/SlavePool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 02715ed..ddd4168 100644 --- a/lnst/Controller/SlavePool.py +++ b/lnst/Controller/SlavePool.py @@ -65,7 +65,14 @@ class SlavePool: dir_path)) pool = self._pools[pool_name]
dentries = os.listdir(dir_path)
try:
dentries = os.listdir(dir_path)
except OSError:
logging.warn("Directory '%s' does not exist for pool '%s'" %
(dir_path,
pool_name))
return
for dirent in dentries: m_id, m = self.add_file(pool_name, dir_path, dirent) if m_id != None and m != None:
-- 2.4.11 _______________________________________________ LNST-developers mailing list lnst-developers@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
On Mon, May 23, 2016 at 02:17:13PM +0200, Jiri Prochazka wrote:
When pool is defined in config but the directory entered there does not exist, lnst-ctl ends in OSError exception. This patch prevents that with warning user that on entered path no directory exists and skips processing it.
Fixes #173
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
will apply without the Fixes #173 line... Acked-by: Ondrej Lichtner olichtne@redhat.com
lnst-developers@lists.fedorahosted.org