mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
winsync-migrate: Move the api initalization and LDAP connection to the main method
https://fedorahosted.org/freeipa/ticket/4524 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
parent
e7d7f01d5f
commit
cf61e2ad94
@ -134,8 +134,12 @@ class MigrateWinsync(admintool.AdminTool):
|
||||
|
||||
return entries
|
||||
|
||||
def run(self):
|
||||
super(MigrateWinsync, self).run()
|
||||
@classmethod
|
||||
def main(cls, argv):
|
||||
"""
|
||||
Sets up API and LDAP connection for the tool, then runs the rest of
|
||||
the plumbing.
|
||||
"""
|
||||
|
||||
# Finalize API
|
||||
api.bootstrap(in_server=True, context='server')
|
||||
@ -146,7 +150,7 @@ class MigrateWinsync(admintool.AdminTool):
|
||||
ctx = krbV.default_context()
|
||||
ccache = ctx.default_ccache()
|
||||
api.Backend.ldap2.connect(ccache)
|
||||
self.ldap = api.Backend.ldap2
|
||||
cls.ldap = api.Backend.ldap2
|
||||
except krbV.Krb5Error, e:
|
||||
sys.exit("Must have Kerberos credentials to migrate Winsync users.")
|
||||
except errors.ACIError, e:
|
||||
@ -154,6 +158,11 @@ class MigrateWinsync(admintool.AdminTool):
|
||||
except errors.DatabaseError, e:
|
||||
sys.exit("Cannot connect to the LDAP database. Please check if IPA is running.")
|
||||
|
||||
super(MigrateWinsync, cls).main(argv)
|
||||
|
||||
def run(self):
|
||||
super(MigrateWinsync, self).run()
|
||||
|
||||
# Create ID overrides replacing the user winsync entries
|
||||
entries = self.find_winsync_users()
|
||||
for entry in entries:
|
||||
|
Loading…
Reference in New Issue
Block a user