Thanks! I'm glad I have been able to help out.

Maxim Burgerhout
ma...@wzzrd.com
----------------
GPG Fingerprint
1CC2 A9B2 FE2E 799D 01DB 8A89 0AE8 B60A ACA3 4452



On Sun, Apr 12, 2009 at 01:14, Pradeep Kilambi <pkila...@redhat.com> wrote:
> Maxim Burgerhout wrote:
>>
>> Hi,
>>
>> Below is a patch to rhncfgcli_verify.py to make it handle orphaned
>> GID's the same way as orphaned UID's are handled. I recently found out
>> the current implementation raises a KeyError exception if an orphaned
>> GID is encountered. This happens when rhncfg_client verify is run on a
>> system on which one of the deployed configuration files is owned by a
>> group that doesn't exist (anymore).
>>
>> Patch is basically an adaptation of the code that handles UID's in the
>> same file, about ten lines up.
>>
>> I usually spend my time being an sysadmin, so I hope I'm doing this
>> 'sending patch' stuff the right way ;-)
>>
>> Hope this helps.
>>
>> Maxim Burgerhout
>> ma...@wzzrd.com
>> ----------------
>> GPG Fingerprint
>> 1CC2 A9B2 FE2E 799D 01DB 8A89 0AE8 B60A ACA3 4452
>>
>> diff --git a/client/tools/rhncfg/config_client/rhncfgcli_verify.py
>> b/client/tools/rhncfg/config_client/rhncfgcli_verify.py
>> index 8240d2b..03d2716 100644
>> --- a/client/tools/rhncfg/config_client/rhncfgcli_verify.py
>> +++ b/client/tools/rhncfg/config_client/rhncfgcli_verify.py
>> @@ -152,7 +152,11 @@ class Handler(handler_base.HandlerBase):
>>         if not stat_err:
>>             #check for group differences
>>             dst_gid = dst_stat[stat.ST_GID]
>> -            dst_group = grp.getgrgid(dst_gid)[0]
>> +            try:
>> +                dst_group = grp.getgrgid(dst_gid)[0]
>> +            except KeyError:
>> +                # Orphan GID with no name,return unknown
>> +                dst_group = "unknown(GID %d)" % (dst_gid,)
>>         else:
>>             dst_group = "missing"
>>
>
> Patch tested and applied!
>
> commit b9d85020ef88ee507e51f0f182074c96f63ccc95
> Author: Maxim Burgerhout <ma...@wzzrd.com>
> Date:   Tue Apr 7 14:10:07 2009 +0200
>
> Thanks for your contribution.
>
> ~ Prad
>
>
>> _______________________________________________
>> Spacewalk-devel mailing list
>> Spacewalk-devel@redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-devel
>>
>
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel
>

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to