mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib, ipaserver: migrate all plugins to Registry-based registration
Do not use the deprecated API.register method. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
parent
0d62968b6f
commit
bed546ee82
@ -897,6 +897,8 @@ if version_info[3] == 'final':
|
||||
else:
|
||||
__version__ = '%d.%d.%d.%s.%d' % version_info
|
||||
|
||||
Registry = plugable.Registry
|
||||
|
||||
|
||||
class API(plugable.API):
|
||||
bases = (Command, Object, Method, Backend, Updater)
|
||||
|
@ -410,7 +410,7 @@ class hbacrule_disable(LDAPQuery):
|
||||
)
|
||||
|
||||
|
||||
|
||||
# @register()
|
||||
class hbacrule_add_accesstime(LDAPQuery):
|
||||
"""
|
||||
Add an access time to an HBAC rule.
|
||||
@ -449,9 +449,8 @@ class hbacrule_add_accesstime(LDAPQuery):
|
||||
)
|
||||
)
|
||||
|
||||
#api.register(hbacrule_add_accesstime)
|
||||
|
||||
|
||||
# @register()
|
||||
class hbacrule_remove_accesstime(LDAPQuery):
|
||||
"""
|
||||
Remove access time to HBAC rule.
|
||||
@ -489,8 +488,6 @@ class hbacrule_remove_accesstime(LDAPQuery):
|
||||
)
|
||||
)
|
||||
|
||||
#api.register(hbacrule_remove_accesstime)
|
||||
|
||||
|
||||
@register()
|
||||
class hbacrule_add_user(LDAPAddMember):
|
||||
|
@ -23,12 +23,15 @@
|
||||
RPC client plugins.
|
||||
"""
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import Registry, api
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
if 'in_server' in api.env and api.env.in_server is False:
|
||||
from ipalib.rpc import xmlclient, jsonclient
|
||||
api.register(xmlclient)
|
||||
api.register(jsonclient)
|
||||
register()(xmlclient)
|
||||
register()(jsonclient)
|
||||
|
||||
# FIXME: api.register only looks at the class name, so we need to create
|
||||
# trivial subclasses with the desired name.
|
||||
@ -37,14 +40,14 @@ if 'in_server' in api.env and api.env.in_server is False:
|
||||
class rpcclient(xmlclient):
|
||||
"""xmlclient renamed to 'rpcclient'"""
|
||||
pass
|
||||
api.register(rpcclient)
|
||||
register()(rpcclient)
|
||||
|
||||
elif api.env.rpc_protocol == 'jsonrpc':
|
||||
|
||||
class rpcclient(jsonclient):
|
||||
"""jsonclient renamed to 'rpcclient'"""
|
||||
pass
|
||||
api.register(rpcclient)
|
||||
register()(rpcclient)
|
||||
|
||||
else:
|
||||
raise ValueError('unknown rpc_protocol: %s' % api.env.rpc_protocol)
|
||||
|
@ -17,15 +17,18 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
from ipaserver.install import sysupgrade
|
||||
|
||||
register = Registry()
|
||||
|
||||
DEFAULT_ID_RANGE_SIZE = 200000
|
||||
|
||||
|
||||
@register()
|
||||
class update_default_range(Updater):
|
||||
"""
|
||||
Create default ID range for upgraded servers.
|
||||
@ -119,6 +122,7 @@ class update_default_range(Updater):
|
||||
return False, [update]
|
||||
|
||||
|
||||
@register()
|
||||
class update_default_trust_view(Updater):
|
||||
"""
|
||||
Create Default Trust View for upgraded servers.
|
||||
@ -164,6 +168,7 @@ class update_default_trust_view(Updater):
|
||||
return False, [update]
|
||||
|
||||
|
||||
@register()
|
||||
class update_sigden_extdom_broken_config(Updater):
|
||||
"""Fix configuration of sidgen and extdom plugins
|
||||
|
||||
@ -230,6 +235,7 @@ class update_sigden_extdom_broken_config(Updater):
|
||||
return restart, ()
|
||||
|
||||
|
||||
@register()
|
||||
class update_sids(Updater):
|
||||
"""SIDs may be not created properly if bug with wrong configuration for
|
||||
sidgen and extdom plugins is effective
|
||||
@ -310,9 +316,3 @@ class update_sids(Updater):
|
||||
|
||||
sysupgrade.set_upgrade_state('sidgen', 'update_sids', False)
|
||||
return False, ()
|
||||
|
||||
|
||||
api.register(update_default_range)
|
||||
api.register(update_default_trust_view)
|
||||
api.register(update_sids)
|
||||
api.register(update_sigden_extdom_broken_config)
|
||||
|
@ -23,13 +23,16 @@ import time
|
||||
|
||||
from ldif import LDIFWriter
|
||||
|
||||
from ipalib import api, errors, util
|
||||
from ipalib import Registry, errors, util
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipalib.plugins.dns import dns_container_exists
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_dnszones(Updater):
|
||||
"""
|
||||
Update all zones to meet requirements in the new FreeIPA versions
|
||||
@ -89,9 +92,8 @@ class update_dnszones(Updater):
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_dnszones)
|
||||
|
||||
|
||||
@register()
|
||||
class update_dns_limits(Updater):
|
||||
"""
|
||||
bind-dyndb-ldap persistent search queries LDAP for all DNS records.
|
||||
@ -137,9 +139,8 @@ class update_dns_limits(Updater):
|
||||
|
||||
return False, [dnsupdate]
|
||||
|
||||
api.register(update_dns_limits)
|
||||
|
||||
|
||||
@register()
|
||||
class update_master_to_dnsforwardzones(Updater):
|
||||
"""
|
||||
Update all zones to meet requirements in the new FreeIPA versions
|
||||
@ -351,5 +352,3 @@ class update_master_to_dnsforwardzones(Updater):
|
||||
zone['idnsname'][0])
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_master_to_dnsforwardzones)
|
||||
|
@ -18,12 +18,15 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipaserver.install import replication
|
||||
from ipalib import api
|
||||
from ipalib import Registry
|
||||
from ipalib import Updater
|
||||
|
||||
register = Registry()
|
||||
|
||||
EXCLUDE_TEMPLATE = '(objectclass=*) $ EXCLUDE %s'
|
||||
|
||||
|
||||
@register()
|
||||
class update_replica_attribute_lists(Updater):
|
||||
"""
|
||||
Run through all replication agreements and ensure that EXCLUDE list
|
||||
@ -109,5 +112,3 @@ class update_replica_attribute_lists(Updater):
|
||||
attribute, str(e))
|
||||
else:
|
||||
self.log.debug("%s: No update necessary" % attribute)
|
||||
|
||||
api.register(update_replica_attribute_lists)
|
||||
|
@ -19,11 +19,13 @@
|
||||
|
||||
import six
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython import ipautil
|
||||
from ipapython.dn import DN
|
||||
|
||||
register = Registry()
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
@ -151,6 +153,8 @@ class GenerateUpdateMixin(object):
|
||||
|
||||
return (restart, update_list)
|
||||
|
||||
|
||||
@register()
|
||||
class update_managed_post_first(Updater, GenerateUpdateMixin):
|
||||
"""
|
||||
Update managed entries
|
||||
@ -162,8 +166,8 @@ class update_managed_post_first(Updater, GenerateUpdateMixin):
|
||||
|
||||
return False, update_list
|
||||
|
||||
api.register(update_managed_post_first)
|
||||
|
||||
@register()
|
||||
class update_managed_post(Updater, GenerateUpdateMixin):
|
||||
"""
|
||||
Update managed entries
|
||||
@ -173,5 +177,3 @@ class update_managed_post(Updater, GenerateUpdateMixin):
|
||||
(restart, update_list) = self.generate_update(True)
|
||||
|
||||
return restart, update_list
|
||||
|
||||
api.register(update_managed_post)
|
||||
|
@ -2,13 +2,16 @@
|
||||
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import Registry
|
||||
from ipalib import Updater
|
||||
from ipaserver.install import certs, cainstance
|
||||
from ipaserver.install import ldapupdate
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_ca_topology(Updater):
|
||||
"""
|
||||
Updates CA topology configuration entries
|
||||
@ -29,5 +32,3 @@ class update_ca_topology(Updater):
|
||||
ld.update([paths.CA_TOPOLOGY_ULDIF])
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_ca_topology)
|
||||
|
@ -17,12 +17,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_idrange_type(Updater):
|
||||
"""
|
||||
Update all ID ranges that do not have ipaRangeType attribute filled.
|
||||
@ -109,6 +112,7 @@ class update_idrange_type(Updater):
|
||||
return False, []
|
||||
|
||||
|
||||
@register()
|
||||
class update_idrange_baserid(Updater):
|
||||
"""
|
||||
Update ipa-ad-trust-posix ranges' base RID to 0. This applies to AD trust
|
||||
@ -171,6 +175,3 @@ class update_idrange_baserid(Updater):
|
||||
"idranges updated")
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_idrange_type)
|
||||
api.register(update_idrange_baserid)
|
||||
|
@ -17,11 +17,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_pacs(Updater):
|
||||
"""
|
||||
Includes default nfs:None only if no nfs: PAC present in ipakrbauthzdata.
|
||||
@ -50,5 +53,3 @@ class update_pacs(Updater):
|
||||
self.log.debug('PAC for nfs is already set, not adding nfs:NONE.')
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_pacs)
|
||||
|
@ -2,12 +2,16 @@
|
||||
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
from ipaserver.install import sysupgrade
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_passync_privilege_check(Updater):
|
||||
|
||||
def execute(self, **options):
|
||||
@ -34,8 +38,8 @@ class update_passync_privilege_check(Updater):
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_passync_privilege_check)
|
||||
|
||||
@register()
|
||||
class update_passync_privilege_update(Updater):
|
||||
"""
|
||||
Add PassSync user as a member of PassSync privilege, if it exists
|
||||
@ -72,5 +76,3 @@ class update_passync_privilege_update(Updater):
|
||||
|
||||
sysupgrade.set_upgrade_state('winsync', 'passsync_privilege_updated', True)
|
||||
return False, [update]
|
||||
|
||||
api.register(update_passync_privilege_update)
|
||||
|
@ -2,11 +2,15 @@
|
||||
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_referint(Updater):
|
||||
"""
|
||||
Update referential integrity configuration to new style
|
||||
@ -83,5 +87,3 @@ class update_referint(Updater):
|
||||
return False, []
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_referint)
|
||||
|
@ -17,12 +17,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_service_principalalias(Updater):
|
||||
"""
|
||||
Update all services which do not have ipakrbprincipalalias attribute
|
||||
@ -88,5 +91,3 @@ class update_service_principalalias(Updater):
|
||||
" services updated")
|
||||
return False, []
|
||||
return False, []
|
||||
|
||||
api.register(update_service_principalalias)
|
||||
|
@ -17,12 +17,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib import Registry, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_uniqueness_plugins_to_new_syntax(Updater):
|
||||
"""
|
||||
Migrate uniqueness plugins to new style syntax
|
||||
@ -218,5 +221,3 @@ class update_uniqueness_plugins_to_new_syntax(Updater):
|
||||
update_list.append(update)
|
||||
|
||||
return False, update_list
|
||||
|
||||
api.register(update_uniqueness_plugins_to_new_syntax)
|
||||
|
@ -18,11 +18,15 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipaserver.install import certs
|
||||
from ipalib import api, errors, certstore
|
||||
from ipalib import Registry, errors, certstore
|
||||
from ipalib import Updater
|
||||
from ipapython import certdb
|
||||
from ipapython.dn import DN
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class update_upload_cacrt(Updater):
|
||||
"""
|
||||
Upload public CA certificate to LDAP
|
||||
@ -92,5 +96,3 @@ class update_upload_cacrt(Updater):
|
||||
ldap.update_entry(entry)
|
||||
|
||||
return False, []
|
||||
|
||||
api.register(update_upload_cacrt)
|
||||
|
@ -1269,7 +1269,7 @@ def select_any_master(ldap2, service='CA'):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
from ipalib import api, errors, SkipPluginModule
|
||||
from ipalib import Registry, api, errors, SkipPluginModule
|
||||
if api.env.ra_plugin != 'dogtag':
|
||||
# In this case, abort loading this plugin module...
|
||||
raise SkipPluginModule(reason='dogtag not selected as RA plugin')
|
||||
@ -1281,7 +1281,10 @@ from ipalib.util import cachedproperty
|
||||
from ipalib import _
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class ra(rabase.rabase):
|
||||
"""
|
||||
Request Authority backend plugin.
|
||||
@ -1895,10 +1898,8 @@ class ra(rabase.rabase):
|
||||
return results
|
||||
|
||||
|
||||
api.register(ra)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@register()
|
||||
class kra(Backend):
|
||||
"""
|
||||
KRA backend plugin (for Vault)
|
||||
@ -1957,8 +1958,6 @@ class kra(Backend):
|
||||
|
||||
return KRAClient(connection, crypto)
|
||||
|
||||
api.register(kra)
|
||||
|
||||
|
||||
class RestClient(Backend):
|
||||
"""Simple Dogtag REST client to be subclassed by other backends.
|
||||
@ -2091,6 +2090,7 @@ class RestClient(Backend):
|
||||
return (status, resp_headers, resp_body)
|
||||
|
||||
|
||||
@register()
|
||||
class ra_certprofile(RestClient):
|
||||
"""
|
||||
Profile management backend plugin.
|
||||
@ -2146,5 +2146,3 @@ class ra_certprofile(RestClient):
|
||||
Delete the profile from Dogtag
|
||||
"""
|
||||
self._ssldo('DELETE', profile_id, headers={'Accept': 'application/json'})
|
||||
|
||||
api.register(ra_certprofile)
|
||||
|
@ -23,7 +23,7 @@ Joining an IPA domain
|
||||
|
||||
import six
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import Registry, api
|
||||
from ipalib import Command, Str
|
||||
from ipalib import errors
|
||||
from ipalib import _
|
||||
@ -32,6 +32,8 @@ from ipaserver.install import installutils
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
def validate_host(ugettext, cn):
|
||||
"""
|
||||
@ -43,6 +45,7 @@ def validate_host(ugettext, cn):
|
||||
return None
|
||||
|
||||
|
||||
@register()
|
||||
class join(Command):
|
||||
"""Join an IPA domain"""
|
||||
|
||||
@ -127,5 +130,3 @@ class join(Command):
|
||||
config['ipacertificatesubjectbase']
|
||||
|
||||
return (dn, attrs_list)
|
||||
|
||||
api.register(join)
|
||||
|
@ -52,11 +52,14 @@ except ImportError:
|
||||
def __init__(self, criticality, authzId=None):
|
||||
LDAPControl.__init__(self, '1.3.6.1.4.1.42.2.27.9.5.2', criticality, authzId)
|
||||
|
||||
from ipalib import api, errors, _
|
||||
from ipalib import Registry, errors, _
|
||||
from ipalib.crud import CrudBackend
|
||||
from ipalib.request import context
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class ldap2(CrudBackend, LDAPClient):
|
||||
"""
|
||||
LDAP Backend Take 2.
|
||||
@ -578,5 +581,3 @@ class ldap2(CrudBackend, LDAPClient):
|
||||
if truncated:
|
||||
return (-1, output)
|
||||
return (len(output), output)
|
||||
|
||||
api.register(ldap2)
|
||||
|
@ -22,16 +22,19 @@
|
||||
Loads WSGI server plugins.
|
||||
"""
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import Registry, api
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
if 'in_server' in api.env and api.env.in_server is True:
|
||||
from ipaserver.rpcserver import wsgi_dispatch, xmlserver, jsonserver_kerb, jsonserver_session, login_kerberos, login_password, change_password, sync_token, xmlserver_session
|
||||
api.register(wsgi_dispatch)
|
||||
api.register(xmlserver)
|
||||
api.register(jsonserver_kerb)
|
||||
api.register(jsonserver_session)
|
||||
api.register(login_kerberos)
|
||||
api.register(login_password)
|
||||
api.register(change_password)
|
||||
api.register(sync_token)
|
||||
api.register(xmlserver_session)
|
||||
register()(wsgi_dispatch)
|
||||
register()(xmlserver)
|
||||
register()(jsonserver_kerb)
|
||||
register()(jsonserver_session)
|
||||
register()(login_kerberos)
|
||||
register()(login_password)
|
||||
register()(change_password)
|
||||
register()(sync_token)
|
||||
register()(xmlserver_session)
|
||||
|
Loading…
Reference in New Issue
Block a user