[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Func-list] Func warning



Hello, could you consider applying the attached patch (for func 0.27) ?

I make to few contributions to suggest it through git.

Let me know, thanks.

Louis


2010/10/8 Louis Coilliot <louis coilliot think fr>:
> Hello, it is not :)
>
> I checked further.
> In folder
> /usr/lib/python2.4/site-packages/func/overlord/modules
>
> There is a file:
> __init__.py
>
> And the function load_modules() of
> /usr/lib/python2.4/site-packages/func/module_loader.py is somewhere
> called with a path=func/overlord/modules/
>
> In the loop:
> for fn in filenames:
>
> when it gets to fn='__init__.py'
> it reaches the condition:
> if basename[:8] == "__init__":
>    modname = dirname
>
> The result is modname = '' (empty string)
>
> Then there is
> pathname = modname
> (...)
> mod_imp_name = pathname.replace("/", ".")
>
> This is the cause of the exception a few lines below in:
> blip =  __import__("%s%s" % ( mod_dir,mod_imp_name), globals(),
> locals(), [mod_imp_name])
>
> Because mod_imp_name is blank
> -> ValueError: Empty module name
>
> For minion-side modules the __init__.py files are in a subfolder named
> with the module name.
>
> This is not the case for
> /usr/lib/python2.4/site-packages/func/overlord/modules/__init__.py
>
> There is a bug here.
>
> What is the best option ?
> - handle this case in the code ?
> - catch the exception ?
> - delete the __init__.py in overlord modules ? (I don't know if it is required)
>
> Let me know.
>
> Louis
>
>
> 2010/10/7 seth vidal <skvidal fedoraproject org>:
>> On Wed, 2010-10-06 at 11:57 +0200, Louis Coilliot wrote:
>>> Hello,
>>>
>>> using the python logging module, I see messages appearing in the logs
>>> that I didn't have on the console.
>>>
>>>
>>> ['Traceback (most recent call last):\n', '  File
>>> "/usr/lib/python2.4/site-packages/func/module_loader.py", line 97, in
>>> load_modules\n    blip =  __import__("%s%s" % ( mod_dir,mod_imp_name),
>>> globals(), locals(), [mod_imp_name])\n', 'ValueError: Empty module
>>> name\n']
>>>
>>>
>>> This is harmless and I think I could get rid of it with an exception
>>> on ValueError, but I'm curious about what it is.
>>>
>>> Do you also see this, or is it caused by one of my custom func modules ?
>>
>> custom func module.
>>
>>
>>
>> Take them out one by one and you'll find out which one it is.
>>
>> -sv
>>
>>
>> _______________________________________________
>> Func-list mailing list
>> Func-list redhat com
>> https://www.redhat.com/mailman/listinfo/func-list
>>
>
--- module_loader.py	2010-05-10 20:25:14.000000000 +0200
+++ module_loader-new.py	2010-10-11 11:43:11.000000000 +0200
@@ -88,6 +88,9 @@
             # If we've already imported mod_imp_name, don't import it again
             continue
 
+        # there was no modname for __init__ 
+        if modname == "": continue
+
         # ignore modules that we've already determined aren't valid modules
         if bad_mods.has_key(mod_imp_name):
             continue

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]