summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2015-04-29 08:15:58 +0200
committerTomas Babej <tbabej@redhat.com>2015-07-02 13:23:21 +0200
commitcf61e2ad94f0e2f822f203291e5adc5882f55e77 (patch)
treee09dc17958c537b4951384ae163c414213e65bed
parente7d7f01d5ffbb8d3c5d5e882ca19b7b9fe96aa7c (diff)
downloadfreeipa-cf61e2ad94f0e2f822f203291e5adc5882f55e77.zip
freeipa-cf61e2ad94f0e2f822f203291e5adc5882f55e77.tar.gz
freeipa-cf61e2ad94f0e2f822f203291e5adc5882f55e77.tar.xz
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>
-rw-r--r--ipaserver/winsync_migrate/base.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/ipaserver/winsync_migrate/base.py b/ipaserver/winsync_migrate/base.py
index 60b75b5..60c2cad 100644
--- a/ipaserver/winsync_migrate/base.py
+++ b/ipaserver/winsync_migrate/base.py
@@ -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: