summaryrefslogtreecommitdiffstats
path: root/pykolab/cli/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 13:48:36 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 13:48:36 +0000
commit18da9a49afe99a432c377b7e9b238adf33a5b3cc (patch)
tree093a5743c961cacc12d4829b3461d2f56f22e6c5 /pykolab/cli/__init__.py
parent1df25181222459bd92ad64296b6bec05b842b981 (diff)
downloadpykolab-18da9a49afe99a432c377b7e9b238adf33a5b3cc.tar.gz
Implement a simple command, and start with just sync (nice for cronjobs!)
Diffstat (limited to 'pykolab/cli/__init__.py')
-rw-r--r--pykolab/cli/__init__.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index defa462..e69e873 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -29,7 +29,9 @@ import pykolab
import pykolab.plugins
from pykolab import utils
+from pykolab.auth import Auth
from pykolab.conf import Conf
+from pykolab.imap import IMAP
from pykolab.constants import *
from pykolab.translate import _
@@ -55,7 +57,9 @@ class Cli(object):
action_function = action.replace('-','_')
action_components = action.split('-')
- if hasattr(self, "action_%s" %(action_function)):
+ if hasattr(self, "action_%s" %(action)):
+ exec("self.action_%s()" %(action))
+ elif hasattr(self, "action_%s" %(action_function)):
self.conf.log.info(_("TODO: self.check_%s()") %(action_function))
exec("self.action_%s()" %(action_function))
else:
@@ -74,6 +78,12 @@ class Cli(object):
print >> sys.stderr, _("No command given, see --help for details")
sys.exit(1)
+ def action_sync(self):
+ auth = Auth(self.conf)
+ users = auth.users()
+ imap = IMAP(self.conf)
+ imap.synchronize(users)
+
def action_list_domains(self):
ldap_con = ldap.initialize(self.conf.get('ldap', 'uri'))
ldap_con.bind_s(self.conf.get('ldap', 'bind_dn'), self.conf.get('ldap', 'bind_pw'))