2016-05-24 10:58 GMT+02:00 Jan Tluka <jtluka(a)redhat.com>:
Mon, May 23, 2016 at 02:17:13PM CEST, jprochaz(a)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.fedora...
>>
>>Signed-off-by: Jiri Prochazka <jprochaz(a)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(a)lists.fedorahosted.org
>>https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahosted.org