mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib: remove the unused csv argument of Param
https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
@@ -375,7 +375,6 @@ class Param(ReadOnly):
|
||||
parameter is not `required`
|
||||
- sortorder: used to sort a list of parameters for Command. See
|
||||
`Command.finalize()` for further information
|
||||
- csv: this multivalue attribute used to be given in CSV format in CLI
|
||||
"""
|
||||
|
||||
# This is a dummy type so that most of the functionality of Param can be
|
||||
@@ -413,7 +412,6 @@ class Param(ReadOnly):
|
||||
('hint', (str, Gettext), None),
|
||||
('alwaysask', bool, False),
|
||||
('sortorder', int, 2), # see finalize()
|
||||
('csv', bool, False),
|
||||
('option_group', unicode, None),
|
||||
|
||||
# The 'default' kwarg gets appended in Param.__init__():
|
||||
@@ -535,10 +533,6 @@ class Param(ReadOnly):
|
||||
)
|
||||
)
|
||||
|
||||
# Check that if csv is set, multivalue is set too
|
||||
if self.csv and not self.multivalue:
|
||||
raise ValueError('%s: cannot have csv without multivalue' % self.nice)
|
||||
|
||||
# Check that all the rules are callable
|
||||
self.class_rules = tuple(class_rules)
|
||||
self.rules = rules
|
||||
|
||||
@@ -459,7 +459,6 @@ class aci(Object):
|
||||
label=_('Permissions'),
|
||||
doc=_('Permissions to grant' \
|
||||
'(read, write, add, delete, all)'),
|
||||
csv=True,
|
||||
normalizer=_normalize_permissions,
|
||||
flags=('virtual_attribute',),
|
||||
),
|
||||
@@ -467,7 +466,6 @@ class aci(Object):
|
||||
cli_name='attrs',
|
||||
label=_('Attributes to which the permission applies'),
|
||||
doc=_('Attributes'),
|
||||
csv=True,
|
||||
flags=('virtual_attribute',),
|
||||
),
|
||||
StrEnum('type?',
|
||||
|
||||
@@ -154,14 +154,12 @@ regex_attrs = (
|
||||
cli_name='inclusive_regex',
|
||||
label=_('Inclusive Regex'),
|
||||
doc=_('Inclusive Regex'),
|
||||
csv=True,
|
||||
alwaysask=True,
|
||||
),
|
||||
Str('automemberexclusiveregex*',
|
||||
cli_name='exclusive_regex',
|
||||
label=_('Exclusive Regex'),
|
||||
doc=_('Exclusive Regex'),
|
||||
csv=True,
|
||||
alwaysask=True,
|
||||
),
|
||||
Str('key',
|
||||
|
||||
@@ -1678,7 +1678,7 @@ class LDAPModMember(LDAPQuery):
|
||||
doc = self.member_param_doc % ldap_obj.object_name_plural
|
||||
label = self.member_param_label % ldap_obj.object_name
|
||||
yield Str('%s*' % name, cli_name='%ss' % name, doc=doc,
|
||||
label=label, csv=True, alwaysask=True)
|
||||
label=label, alwaysask=True)
|
||||
|
||||
def get_member_dns(self, **options):
|
||||
dns = {}
|
||||
@@ -1965,7 +1965,7 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
|
||||
name = '%s%s' % (relationship[1], to_cli(ldap_obj_name))
|
||||
yield Str(
|
||||
'%s*' % name, cli_name='%ss' % name, doc=doc,
|
||||
label=ldap_obj.object_name, csv=True
|
||||
label=ldap_obj.object_name
|
||||
)
|
||||
doc = self.member_param_excl_doc % dict(
|
||||
searched_object=self.obj.object_name_plural,
|
||||
@@ -1975,7 +1975,7 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
|
||||
name = '%s%s' % (relationship[2], to_cli(ldap_obj_name))
|
||||
yield Str(
|
||||
'%s*' % name, cli_name='%ss' % name, doc=doc,
|
||||
label=ldap_obj.object_name, csv=True
|
||||
label=ldap_obj.object_name
|
||||
)
|
||||
|
||||
def get_options(self):
|
||||
@@ -2156,8 +2156,7 @@ class LDAPModReverseMember(LDAPQuery):
|
||||
name = to_cli(ldap_obj_name)
|
||||
doc = self.reverse_param_doc % ldap_obj.object_name_plural
|
||||
yield Str('%s*' % name, cli_name='%ss' % name, doc=doc,
|
||||
label=ldap_obj.object_name, csv=True,
|
||||
alwaysask=True)
|
||||
label=ldap_obj.object_name, alwaysask=True)
|
||||
|
||||
|
||||
class LDAPAddReverseMember(LDAPModReverseMember):
|
||||
|
||||
@@ -350,7 +350,6 @@ class baseuser(LDAPObject):
|
||||
cli_name='sshpubkey',
|
||||
label=_('SSH public key'),
|
||||
normalizer=normalize_sshpubkey,
|
||||
csv=True,
|
||||
flags=['no_search'],
|
||||
),
|
||||
StrEnum('ipauserauthtype*',
|
||||
@@ -358,7 +357,6 @@ class baseuser(LDAPObject):
|
||||
label=_('User authentication types'),
|
||||
doc=_('Types of supported user authentication'),
|
||||
values=(u'password', u'radius', u'otp'),
|
||||
csv=True,
|
||||
),
|
||||
Str('userclass*',
|
||||
cli_name='class',
|
||||
|
||||
@@ -187,13 +187,11 @@ class config(LDAPObject):
|
||||
cli_name='groupobjectclasses',
|
||||
label=_('Default group objectclasses'),
|
||||
doc=_('Default group objectclasses (comma-separated list)'),
|
||||
csv=True,
|
||||
),
|
||||
Str('ipauserobjectclasses+',
|
||||
cli_name='userobjectclasses',
|
||||
label=_('Default user objectclasses'),
|
||||
doc=_('Default user objectclasses (comma-separated list)'),
|
||||
csv=True,
|
||||
),
|
||||
Int('ipapwdexpadvnotify',
|
||||
cli_name='pwdexpnotify',
|
||||
@@ -208,7 +206,6 @@ class config(LDAPObject):
|
||||
values=(u'AllowNThash',
|
||||
u'KDC:Disable Last Success', u'KDC:Disable Lockout',
|
||||
u'KDC:Disable Default Preauth for SPNs'),
|
||||
csv=True,
|
||||
),
|
||||
Str('ipaselinuxusermaporder',
|
||||
label=_('SELinux user map order'),
|
||||
@@ -223,14 +220,12 @@ class config(LDAPObject):
|
||||
label=_('Default PAC types'),
|
||||
doc=_('Default types of PAC supported for services'),
|
||||
values=(u'MS-PAC', u'PAD', u'nfs:NONE'),
|
||||
csv=True,
|
||||
),
|
||||
StrEnum('ipauserauthtype*',
|
||||
cli_name='user_auth_type',
|
||||
label=_('Default user authentication types'),
|
||||
doc=_('Default types of supported user authentication'),
|
||||
values=(u'password', u'radius', u'otp', u'disabled'),
|
||||
csv=True,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -85,13 +85,11 @@ class delegation(Object):
|
||||
cli_name='permissions',
|
||||
label=_('Permissions'),
|
||||
doc=_('Permissions to grant (read, write). Default is write.'),
|
||||
csv=True,
|
||||
),
|
||||
Str('attrs+',
|
||||
cli_name='attrs',
|
||||
label=_('Attributes'),
|
||||
doc=_('Attributes to which the delegation applies'),
|
||||
csv=True,
|
||||
normalizer=lambda value: value.lower(),
|
||||
),
|
||||
Str('memberof',
|
||||
|
||||
@@ -702,7 +702,6 @@ class DNSRecord(Str):
|
||||
kw.setdefault('label', self.label_format % self.rrtype)
|
||||
kw.setdefault('doc', self.doc_format % self.rrtype)
|
||||
kw.setdefault('option_group', self.option_group_format % self.rrtype)
|
||||
kw['csv'] = True
|
||||
|
||||
if not self.supported:
|
||||
kw['flags'] = ('no_option',)
|
||||
@@ -2036,7 +2035,6 @@ class DNSZoneBase(LDAPObject):
|
||||
label=_('Zone forwarders'),
|
||||
doc=_('Per-zone forwarders. A custom port can be specified '
|
||||
'for each forwarder using a standard format "IP_ADDRESS port PORT"'),
|
||||
csv=True,
|
||||
),
|
||||
StrEnum('idnsforwardpolicy?',
|
||||
cli_name='forward_policy',
|
||||
@@ -4294,7 +4292,6 @@ class dnsconfig(LDAPObject):
|
||||
label=_('Global forwarders'),
|
||||
doc=_('Global forwarders. A custom port can be specified for each '
|
||||
'forwarder using a standard format "IP_ADDRESS port PORT"'),
|
||||
csv=True,
|
||||
),
|
||||
StrEnum('idnsforwardpolicy?',
|
||||
cli_name='forward_policy',
|
||||
|
||||
@@ -278,7 +278,6 @@ ipaexternalmember_param = Str('ipaexternalmember*',
|
||||
cli_name='external',
|
||||
label=_('External member'),
|
||||
doc=_('Members of a trusted domain in DOM\\name or name@domain form'),
|
||||
csv=True,
|
||||
flags=['no_create', 'no_update', 'no_search'],
|
||||
)
|
||||
|
||||
|
||||
@@ -273,7 +273,6 @@ class hbactest(Command):
|
||||
Str('rules*',
|
||||
cli_name='rules',
|
||||
label=_('Rules to test. If not specified, --enabled is assumed'),
|
||||
csv=True,
|
||||
),
|
||||
Flag('nodetail?',
|
||||
cli_name='nodetail',
|
||||
|
||||
@@ -524,7 +524,6 @@ class host(LDAPObject):
|
||||
pattern='^([a-fA-F0-9]{2}[:|\-]?){5}[a-fA-F0-9]{2}$',
|
||||
pattern_errmsg=('Must be of the form HH:HH:HH:HH:HH:HH, where '
|
||||
'each H is a hexadecimal character.'),
|
||||
csv=True,
|
||||
label=_('MAC address'),
|
||||
doc=_('Hardware MAC address(es) on this host'),
|
||||
),
|
||||
@@ -532,7 +531,6 @@ class host(LDAPObject):
|
||||
cli_name='sshpubkey',
|
||||
label=_('SSH public key'),
|
||||
normalizer=normalize_sshpubkey,
|
||||
csv=True,
|
||||
flags=['no_search'],
|
||||
),
|
||||
Str('userclass*',
|
||||
|
||||
@@ -874,7 +874,6 @@ class idoverrideuser(baseidoverride):
|
||||
cli_name='sshpubkey',
|
||||
label=_('SSH public key'),
|
||||
normalizer=normalize_sshpubkey,
|
||||
csv=True,
|
||||
flags=['no_search'],
|
||||
),
|
||||
Bytes('usercertificate*', validate_certificate,
|
||||
|
||||
@@ -533,7 +533,6 @@ class migrate_ds(Command):
|
||||
cli_name='user_objectclass',
|
||||
label=_('User object class'),
|
||||
doc=_('Objectclasses used to search for user entries in DS'),
|
||||
csv=True,
|
||||
default=(u'person',),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -541,7 +540,6 @@ class migrate_ds(Command):
|
||||
cli_name='group_objectclass',
|
||||
label=_('Group object class'),
|
||||
doc=_('Objectclasses used to search for group entries in DS'),
|
||||
csv=True,
|
||||
default=(u'groupOfUniqueNames', u'groupOfNames'),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -549,7 +547,6 @@ class migrate_ds(Command):
|
||||
cli_name='user_ignore_objectclass',
|
||||
label=_('Ignore user object class'),
|
||||
doc=_('Objectclasses to be ignored for user entries in DS'),
|
||||
csv=True,
|
||||
default=tuple(),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -557,7 +554,6 @@ class migrate_ds(Command):
|
||||
cli_name='user_ignore_attribute',
|
||||
label=_('Ignore user attribute'),
|
||||
doc=_('Attributes to be ignored for user entries in DS'),
|
||||
csv=True,
|
||||
default=tuple(),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -565,7 +561,6 @@ class migrate_ds(Command):
|
||||
cli_name='group_ignore_objectclass',
|
||||
label=_('Ignore group object class'),
|
||||
doc=_('Objectclasses to be ignored for group entries in DS'),
|
||||
csv=True,
|
||||
default=tuple(),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -573,7 +568,6 @@ class migrate_ds(Command):
|
||||
cli_name='group_ignore_attribute',
|
||||
label=_('Ignore group attribute'),
|
||||
doc=_('Attributes to be ignored for group entries in DS'),
|
||||
csv=True,
|
||||
default=tuple(),
|
||||
autofill=True,
|
||||
),
|
||||
@@ -680,8 +674,8 @@ can use their Kerberos accounts.''')
|
||||
name = 'exclude_%ss' % to_cli(ldap_obj_name)
|
||||
doc = self.exclude_doc % ldap_obj.object_name_plural
|
||||
yield Str(
|
||||
'%s*' % name, cli_name=name, doc=doc, csv=True,
|
||||
default=tuple(), autofill=True
|
||||
'%s*' % name, cli_name=name, doc=doc, default=tuple(),
|
||||
autofill=True
|
||||
)
|
||||
|
||||
def normalize_options(self, options):
|
||||
@@ -691,14 +685,17 @@ can use their Kerberos accounts.''')
|
||||
Also, empty List parameters are converted to None, but the migration
|
||||
plugin doesn't like that - convert back to empty lists.
|
||||
"""
|
||||
for p in self.params():
|
||||
if p.csv:
|
||||
if options[p.name]:
|
||||
options[p.name] = tuple(
|
||||
v.lower() for v in options[p.name]
|
||||
)
|
||||
else:
|
||||
options[p.name] = tuple()
|
||||
names = ['userobjectclass', 'groupobjectclass',
|
||||
'userignoreobjectclass', 'userignoreattribute',
|
||||
'groupignoreobjectclass', 'groupignoreattribute']
|
||||
names.extend('exclude_%ss' % to_cli(n) for n in self.migrate_objects)
|
||||
for name in names:
|
||||
if options[name]:
|
||||
options[name] = tuple(
|
||||
v.lower() for v in options[name]
|
||||
)
|
||||
else:
|
||||
options[name] = tuple()
|
||||
|
||||
def _get_search_bases(self, options, ds_base_dn, migrate_order):
|
||||
search_bases = dict()
|
||||
|
||||
@@ -89,13 +89,11 @@ class selfservice(Object):
|
||||
cli_name='permissions',
|
||||
label=_('Permissions'),
|
||||
doc=_('Permissions to grant (read, write). Default is write.'),
|
||||
csv=True,
|
||||
),
|
||||
Str('attrs+',
|
||||
cli_name='attrs',
|
||||
label=_('Attributes'),
|
||||
doc=_('Attributes to which the permission applies.'),
|
||||
csv=True,
|
||||
normalizer=lambda value: value.lower(),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -504,7 +504,6 @@ class service(LDAPObject):
|
||||
" Use 'NONE' to disable PAC support for this service,"
|
||||
" e.g. this might be necessary for NFS services."),
|
||||
values=(u'MS-PAC', u'PAD', u'NONE'),
|
||||
csv=True,
|
||||
),
|
||||
) + ticket_flags_params
|
||||
|
||||
|
||||
@@ -527,12 +527,10 @@ class trust(LDAPObject):
|
||||
label=_('Domain Security Identifier'),
|
||||
flags=['no_create', 'no_update']),
|
||||
Str('ipantsidblacklistincoming*',
|
||||
csv=True,
|
||||
cli_name='sid_blacklist_incoming',
|
||||
label=_('SID blacklist incoming'),
|
||||
flags=['no_create']),
|
||||
Str('ipantsidblacklistoutgoing*',
|
||||
csv=True,
|
||||
cli_name='sid_blacklist_outgoing',
|
||||
label=_('SID blacklist outgoing'),
|
||||
flags=['no_create']),
|
||||
@@ -1294,7 +1292,6 @@ class trust_resolve(Command):
|
||||
takes_options = (
|
||||
Str('sids+',
|
||||
label = _('Security Identifiers (SIDs)'),
|
||||
csv = True,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -222,7 +222,6 @@ class test_Param(ClassChecker):
|
||||
assert o.exclude is None
|
||||
assert o.flags == frozenset()
|
||||
assert o.sortorder == 2
|
||||
assert o.csv is False
|
||||
|
||||
# Test that doc defaults from label:
|
||||
o = self.cls('my_param', doc=_('Hello world'))
|
||||
@@ -288,10 +287,6 @@ class test_Param(ClassChecker):
|
||||
'exclude', frozenset(['client', 'bar']),
|
||||
)
|
||||
|
||||
# Test that ValueError is raised if csv is set and multivalue is not set:
|
||||
e = raises(ValueError, self.cls, 'my_param', csv=True)
|
||||
assert str(e) == '%s: cannot have csv without multivalue' % "Param('my_param')"
|
||||
|
||||
# Test that default_from gets set:
|
||||
call = lambda first, last: first[0] + last
|
||||
o = self.cls('my_param', default_from=call)
|
||||
|
||||
1
makeapi
1
makeapi
@@ -46,7 +46,6 @@ API_DOC_ERROR = 8
|
||||
# attributes removed from Param.__kw dictionary
|
||||
PARAM_IGNORED_KW_ATTRIBUTES = (
|
||||
'attribute',
|
||||
'csv',
|
||||
'default_from',
|
||||
'doc',
|
||||
'exclude',
|
||||
|
||||
@@ -149,7 +149,6 @@ ipa_class_members = {
|
||||
'hint',
|
||||
'alwaysask',
|
||||
'sortorder',
|
||||
'csv',
|
||||
'option_group',
|
||||
],
|
||||
'ipalib.parameters.Bool': [
|
||||
|
||||
Reference in New Issue
Block a user