Re: Patch: nagios-check module

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

 



you are correct. I just forgot to fix it. I think your suggestion of
matching the name to the base module is better than func's naming.

On 2011-09-29, Erinn Looney-Triggs <erinn.looneytriggs@xxxxxxxxx> wrote:
> On Thu, Sep 29, 2011 at 8:58 AM, Greg Swift <gregswift@xxxxxxxxx> wrote:
>
>>
>> On Thu, Sep 29, 2011 at 08:28, Tim Bielawa <tbielawa@xxxxxxxxxx> wrote:
>>
>>> On Wed, 28 Sep 2011 15:00:03 -0800, Erinn Looney-Triggs <
>>> erinn.looneytriggs@xxxxxxxxx> wrote:
>>> > Whilst trying to learn how to write func modules I stumbled across
>>> > nagios-check.py, which looks like it could use a little love. The
>>> > attached patch gets it to work, cleans up some formatting, changes the
>>> > name to nagios_check.py so you can import it easily to test, and allows
>>> > for the use of configuration files to modify the nagios plugins path. I
>>> > also changed the class name, there is already a newer Nagios class in
>>> > the nagios.py module, and though this may not matter, I believe it can
>>> > for the conf files that are created. Perhaps I don't understand the
>>> > whole structure of things, but it looks to me like this could lead to a
>>> > collision.
>>> >
>>> > -Erinn
>>>
>>> Good catch on the class names. I didn't even consider that when I wrote
>>> the class in nagios.py. I guess I always just assumed it was named
>>> NagiosCheck or something.
>>>
>>
>> I hadn't commented yet cause I've never used it, so good to hear Tim weigh
>> in.  I think it looks pretty good with 1 exception.  Instead of just using
>> the func subprocess, i'd do a try block like this:
>>
>> try:
>>   import sub_process
>> except ImportError:
>>
>>   from func.minion import sub_process
>>
>> cause the func one was mainly there for RHEL4 boxes, and I believe was
>> just
>> a "backport" of the py2.4 subprocess module.  So we don't necessarily want
>> to move to it, we'd rather move away from it.
>>
>> -greg
>>
>
> That sounds fine, again I may be missing something here, but subprocess and
> sub_process are two different things. I looked at sub_process and  figured
> it was just a back port of subprocess to cover older python versions, as you
> said. To make this work though wouldn't you want something like this:
>
> try:
>   import subprocess as sub_process
> except ImportError:
>   from func.minion import sub_process
>
> Or perhaps even better:
>
> try:
>   import subprocess
> except ImportError:
>   from func.minion import sub_process as subprocess
>
> and then change the call to subprocess. The second one having the advantage
> that in the future you can just remove the try when RHEL 4 finally passes
> away.
>
> -Erinn
>

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux