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 errors
|
||||||
from ipalib import x509
|
from ipalib import x509
|
||||||
from ipalib import util
|
from ipalib import util
|
||||||
|
from ipalib.parameters import File
|
||||||
from ipalib.plugable import Registry
|
from ipalib.plugable import Registry
|
||||||
|
|
||||||
register = 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)
|
@register(override=True)
|
||||||
class cert_show(CommandOverride):
|
class cert_show(CommandOverride):
|
||||||
def forward(self, *keys, **options):
|
def forward(self, *keys, **options):
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
from ipaclient.frontend import MethodOverride
|
from ipaclient.frontend import MethodOverride
|
||||||
from ipalib import util
|
from ipalib import util
|
||||||
|
from ipalib.parameters import File
|
||||||
from ipalib.plugable import Registry
|
from ipalib.plugable import Registry
|
||||||
from ipalib.text import _
|
from ipalib.text import _
|
||||||
|
|
||||||
@ -26,3 +27,21 @@ class certprofile_show(MethodOverride):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return result
|
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
|
import six
|
||||||
|
|
||||||
from ipaclient.frontend import CommandOverride
|
from ipaclient.frontend import CommandOverride
|
||||||
|
from ipalib.parameters import File
|
||||||
from ipalib.plugable import Registry
|
from ipalib.plugable import Registry
|
||||||
from ipalib import _
|
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
|
login at https://your.domain/ipa/migration/ before they
|
||||||
can use their Kerberos accounts.''')
|
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):
|
def output_for_cli(self, textui, result, ldapuri, bindpw, **options):
|
||||||
textui.print_name(self.name)
|
textui.print_name(self.name)
|
||||||
if not result['enabled']:
|
if not result['enabled']:
|
||||||
|
@ -23,7 +23,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
from ipalib import Command, Str, Int, Flag, File
|
from ipalib import Command, Str, Int, Flag
|
||||||
from ipalib import api
|
from ipalib import api
|
||||||
from ipalib import errors
|
from ipalib import errors
|
||||||
from ipalib import pkcs10
|
from ipalib import pkcs10
|
||||||
@ -246,10 +246,12 @@ class cert_request(VirtualCommand):
|
|||||||
__doc__ = _('Submit a certificate signing request.')
|
__doc__ = _('Submit a certificate signing request.')
|
||||||
|
|
||||||
takes_args = (
|
takes_args = (
|
||||||
File('csr', validate_csr,
|
Str(
|
||||||
|
'csr', validate_csr,
|
||||||
label=_('CSR'),
|
label=_('CSR'),
|
||||||
cli_name='csr_file',
|
cli_name='csr_file',
|
||||||
normalizer=normalize_csr,
|
normalizer=normalize_csr,
|
||||||
|
noextrawhitespace=False,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
operation="request certificate"
|
operation="request certificate"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ipalib import api, Bool, File, Str
|
from ipalib import api, Bool, Str
|
||||||
from ipalib.plugable import Registry
|
from ipalib.plugable import Registry
|
||||||
from .baseldap import (
|
from .baseldap import (
|
||||||
LDAPObject, LDAPSearch, LDAPCreate,
|
LDAPObject, LDAPSearch, LDAPCreate,
|
||||||
@ -223,10 +223,12 @@ class certprofile_import(LDAPCreate):
|
|||||||
__doc__ = _("Import a Certificate Profile.")
|
__doc__ = _("Import a Certificate Profile.")
|
||||||
msg_summary = _('Imported profile "%(value)s"')
|
msg_summary = _('Imported profile "%(value)s"')
|
||||||
takes_options = (
|
takes_options = (
|
||||||
File('file',
|
Str(
|
||||||
|
'file',
|
||||||
label=_('Filename of a raw profile. The XML format is not supported.'),
|
label=_('Filename of a raw profile. The XML format is not supported.'),
|
||||||
cli_name='file',
|
cli_name='file',
|
||||||
flags=('virtual_attribute',),
|
flags=('virtual_attribute',),
|
||||||
|
noextrawhitespace=False,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -294,10 +296,12 @@ class certprofile_mod(LDAPUpdate):
|
|||||||
msg_summary = _('Modified Certificate Profile "%(value)s"')
|
msg_summary = _('Modified Certificate Profile "%(value)s"')
|
||||||
|
|
||||||
takes_options = LDAPUpdate.takes_options + (
|
takes_options = LDAPUpdate.takes_options + (
|
||||||
File('file?',
|
Str(
|
||||||
|
'file?',
|
||||||
label=_('File containing profile configuration'),
|
label=_('File containing profile configuration'),
|
||||||
cli_name='file',
|
cli_name='file',
|
||||||
flags=('virtual_attribute',),
|
flags=('virtual_attribute',),
|
||||||
|
noextrawhitespace=False,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from ldap import SCOPE_BASE, SCOPE_ONELEVEL, SCOPE_SUBTREE
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from ipalib import api, errors, output
|
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.cli import to_cli
|
||||||
from ipalib.plugable import Registry
|
from ipalib.plugable import Registry
|
||||||
from .user import NO_UPG_MAGIC
|
from .user import NO_UPG_MAGIC
|
||||||
@ -601,11 +601,12 @@ class migrate_ds(Command):
|
|||||||
doc=_('Allows migration despite the usage of compat plugin'),
|
doc=_('Allows migration despite the usage of compat plugin'),
|
||||||
default=False,
|
default=False,
|
||||||
),
|
),
|
||||||
File('cacertfile?',
|
Str('cacertfile?',
|
||||||
cli_name='ca_cert_file',
|
cli_name='ca_cert_file',
|
||||||
label=_('CA certificate'),
|
label=_('CA certificate'),
|
||||||
doc=_('Load CA certificate of LDAP server from FILE'),
|
doc=_('Load CA certificate of LDAP server from FILE'),
|
||||||
default=None
|
default=None,
|
||||||
|
noextrawhitespace=False,
|
||||||
),
|
),
|
||||||
Bool('use_def_group?',
|
Bool('use_def_group?',
|
||||||
cli_name='use_default_group',
|
cli_name='use_default_group',
|
||||||
|
Loading…
Reference in New Issue
Block a user