summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/idrange.py
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-09-05 13:21:04 +0200
committerMartin Kosek <mkosek@redhat.com>2012-09-07 16:50:35 +0200
commit67b47a65f2d07b350c970a6e2b4e55ae9adf50cd (patch)
tree8b538da5012b07fabd1648260b54801993fdf3af /ipalib/plugins/idrange.py
parent377e1267b75e75fe0f5c7c557e1a9cce6b9fa160 (diff)
downloadfreeipa-67b47a65f2d07b350c970a6e2b4e55ae9adf50cd.tar.gz
freeipa-67b47a65f2d07b350c970a6e2b4e55ae9adf50cd.tar.xz
freeipa-67b47a65f2d07b350c970a6e2b4e55ae9adf50cd.zip
IDRange CLI: allow to work without arguments
Fixes https://fedorahosted.org/freeipa/ticket/2999
Diffstat (limited to 'ipalib/plugins/idrange.py')
-rw-r--r--ipalib/plugins/idrange.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/ipalib/plugins/idrange.py b/ipalib/plugins/idrange.py
index 23c8e0c34..3231156bd 100644
--- a/ipalib/plugins/idrange.py
+++ b/ipalib/plugins/idrange.py
@@ -63,7 +63,7 @@ class idrange(LDAPObject):
cli_name='range_size',
label=_("Number of IDs in the range"),
),
- Int('ipabaserid',
+ Int('ipabaserid?',
cli_name='rid_base',
label=_('First RID of the corresponding RID range'),
),
@@ -150,15 +150,25 @@ class idrange_add(LDAPCreate):
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
assert isinstance(dn, DN)
- if ('ipanttrusteddomainsid' not in options and
- 'ipasecondarybaserid' not in options):
- raise errors.ValidationError(name=_('Range setup'),
- error=_('Ranges for local domain ' \
- 'must have a secondary RID base'))
if 'ipanttrusteddomainsid' in options:
+ if 'ipasecondarybaserid' in options:
+ raise errors.ValidationError(name=_('ID Range setup'),
+ error=_('Options dom_sid and secondary_rid_base cannot ' \
+ 'be used together'))
+
+ if 'ipabaserid' not in options:
+ raise errors.ValidationError(name=_('ID Range setup'),
+ error=_('Options dom_sid and rid_base must ' \
+ 'be used together'))
+
entry_attrs['objectclass'].append('ipatrustedaddomainrange')
else:
+ if (('ipasecondarybaserid' in options) != ('ipabaserid' in options)):
+ raise errors.ValidationError(name=_('ID Range setup'),
+ error=_('Options secondary_rid_base and rid_base must ' \
+ 'be used together'))
+
entry_attrs['objectclass'].append('ipadomainidrange')
return dn