[Freeipa-devel] [PATCH 0021] Forbid overlapping rid ranges for the same id range

Tomas Babej tbabej at redhat.com
Thu Dec 13 10:52:00 UTC 2012


On 12/12/2012 04:32 PM, Martin Kosek wrote:
> On 10/26/2012 03:43 PM, Tomas Babej wrote:
>> Hi,
>>
>> creating an id range with overlapping primary and secondary
>> rid range using idrange-add or idrange-mod command now
>> raises ValidationError. Unit tests have been added to
>> test_range_plugin.py.
>>
>> https://fedorahosted.org/freeipa/ticket/3171
>>
>> Tomas
>>
> 1) Add command can cause crash:
>
> # ipa idrange-add range9 --base-id=1000 --rid-base=1000 --secondary-rid-base=
> --range-size 1000
> ipa: ERROR: an internal error has occurred
>
> 2) I don't like this construct very much:
>
> updated_values = dict(zip(rid_range_attributes,[None]*3))
>
> This would look better, IMO:
> updated_values = dict((attr, None) for attr in rid_range_attributes)
>
> Why do you need this dict pre-created anyway? You overwrite all keys here:
>
> +            for attr in rid_range_attributes:
> +                if attr in entry_attrs:
> +                    updated_values[attr] = entry_attrs[attr]
> +                else:
> +                    updated_values[attr] = int(old_attrs[attr][0])
>
>
> 3) [nitpick] We don't end ValidationError with '.':
>
> +                   raise errors.ValidationError(name='ID Range setup',
> +                       error=_("Primary rid range and secondary rid range"\
> +                               " cannot overlap."))
>
> There is also a duplication of the same error message...
>
> 4) The -mod operation will also crash:
>
> # ipa idrange-add range9 --base-id=1000 --rid-base=1000
> --secondary-rid-base=2000 --range-size 1000
> # ipa idrange-mod range9 --secondary-rid-base=
> ipa: ERROR: an internal error has occurred
>
> Martin

New patch version as well as diff between
patch versions (for your convenience) attached.

Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-tbabej-0021-2-Forbid-overlapping-rid-ranges-for-the-same-id-range.patch
Type: text/x-patch
Size: 11163 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20121213/337713f8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-tbabej-0021-1to2.diff
Type: text/x-patch
Size: 6273 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20121213/337713f8/attachment-0001.bin>


More information about the Freeipa-devel mailing list