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

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to