mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib: move File command arguments to ipaclient
File arguments are relevant only on the client, on the server they are the same as Str. Specify the arguments as Str in ipalib.plugins and override them with File in ipaclient.plugins. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
parent
875801d1d9
commit
2f7df393fd
@ -23,11 +23,21 @@ from ipaclient.frontend import CommandOverride
|
||||
from ipalib import errors
|
||||
from ipalib import x509
|
||||
from ipalib import util
|
||||
from ipalib.parameters import File
|
||||
from ipalib.plugable import Registry
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register(override=True)
|
||||
class cert_request(CommandOverride):
|
||||
def get_args(self):
|
||||
for arg in super(cert_request, self).get_args():
|
||||
if arg.name == 'csr':
|
||||
arg = arg.clone_retype(arg.name, File)
|
||||
yield arg
|
||||
|
||||
|
||||
@register(override=True)
|
||||
class cert_show(CommandOverride):
|
||||
def forward(self, *keys, **options):
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
from ipaclient.frontend import MethodOverride
|
||||
from ipalib import util
|
||||
from ipalib.parameters import File
|
||||
from ipalib.plugable import Registry
|
||||
from ipalib.text import _
|
||||
|
||||
@ -26,3 +27,21 @@ class certprofile_show(MethodOverride):
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@register(override=True)
|
||||
class certprofile_import(MethodOverride):
|
||||
def get_options(self):
|
||||
for option in super(certprofile_import, self).get_options():
|
||||
if option.name == 'file':
|
||||
option = option.clone_retype(option.name, File)
|
||||
yield option
|
||||
|
||||
|
||||
@register(override=True)
|
||||
class certprofile_mod(MethodOverride):
|
||||
def get_options(self):
|
||||
for option in super(certprofile_mod, self).get_options():
|
||||
if option.name == 'file':
|
||||
option = option.clone_retype(option.name, File)
|
||||
yield option
|
||||
|
@ -20,6 +20,7 @@
|
||||
import six
|
||||
|
||||
from ipaclient.frontend import CommandOverride
|
||||
from ipalib.parameters import File
|
||||
from ipalib.plugable import Registry
|
||||
from ipalib import _
|
||||
|
||||
@ -43,6 +44,12 @@ with clear text passwords. All migrated users need to
|
||||
login at https://your.domain/ipa/migration/ before they
|
||||
can use their Kerberos accounts.''')
|
||||
|
||||
def get_options(self):
|
||||
for option in super(migrate_ds, self).get_options():
|
||||
if option.name == 'cacertfile':
|
||||
option = option.clone_retype(option.name, File)
|
||||
yield option
|
||||
|
||||
def output_for_cli(self, textui, result, ldapuri, bindpw, **options):
|
||||
textui.print_name(self.name)
|
||||
if not result['enabled']:
|
||||
|
@ -23,7 +23,7 @@ import os
|
||||
import time
|
||||
import binascii
|
||||
|
||||
from ipalib import Command, Str, Int, Flag, File
|
||||
from ipalib import Command, Str, Int, Flag
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
from ipalib import pkcs10
|
||||
@ -246,10 +246,12 @@ class cert_request(VirtualCommand):
|
||||
__doc__ = _('Submit a certificate signing request.')
|
||||
|
||||
takes_args = (
|
||||
File('csr', validate_csr,
|
||||
Str(
|
||||
'csr', validate_csr,
|
||||
label=_('CSR'),
|
||||
cli_name='csr_file',
|
||||
normalizer=normalize_csr,
|
||||
noextrawhitespace=False,
|
||||
),
|
||||
)
|
||||
operation="request certificate"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from ipalib import api, Bool, File, Str
|
||||
from ipalib import api, Bool, Str
|
||||
from ipalib.plugable import Registry
|
||||
from .baseldap import (
|
||||
LDAPObject, LDAPSearch, LDAPCreate,
|
||||
@ -223,10 +223,12 @@ class certprofile_import(LDAPCreate):
|
||||
__doc__ = _("Import a Certificate Profile.")
|
||||
msg_summary = _('Imported profile "%(value)s"')
|
||||
takes_options = (
|
||||
File('file',
|
||||
Str(
|
||||
'file',
|
||||
label=_('Filename of a raw profile. The XML format is not supported.'),
|
||||
cli_name='file',
|
||||
flags=('virtual_attribute',),
|
||||
noextrawhitespace=False,
|
||||
),
|
||||
)
|
||||
|
||||
@ -294,10 +296,12 @@ class certprofile_mod(LDAPUpdate):
|
||||
msg_summary = _('Modified Certificate Profile "%(value)s"')
|
||||
|
||||
takes_options = LDAPUpdate.takes_options + (
|
||||
File('file?',
|
||||
Str(
|
||||
'file?',
|
||||
label=_('File containing profile configuration'),
|
||||
cli_name='file',
|
||||
flags=('virtual_attribute',),
|
||||
noextrawhitespace=False,
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -24,7 +24,7 @@ from ldap import SCOPE_BASE, SCOPE_ONELEVEL, SCOPE_SUBTREE
|
||||
import six
|
||||
|
||||
from ipalib import api, errors, output
|
||||
from ipalib import Command, Password, Str, Flag, StrEnum, DNParam, File, Bool
|
||||
from ipalib import Command, Password, Str, Flag, StrEnum, DNParam, Bool
|
||||
from ipalib.cli import to_cli
|
||||
from ipalib.plugable import Registry
|
||||
from .user import NO_UPG_MAGIC
|
||||
@ -601,11 +601,12 @@ class migrate_ds(Command):
|
||||
doc=_('Allows migration despite the usage of compat plugin'),
|
||||
default=False,
|
||||
),
|
||||
File('cacertfile?',
|
||||
Str('cacertfile?',
|
||||
cli_name='ca_cert_file',
|
||||
label=_('CA certificate'),
|
||||
doc=_('Load CA certificate of LDAP server from FILE'),
|
||||
default=None
|
||||
default=None,
|
||||
noextrawhitespace=False,
|
||||
),
|
||||
Bool('use_def_group?',
|
||||
cli_name='use_default_group',
|
||||
|
Loading…
Reference in New Issue
Block a user