6 commits - pykolab/Makefile.am pykolab/setup pykolab/xml wallace/module_resources.py
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Sat Aug 4 12:51:57 CEST 2012
pykolab/Makefile.am | 1
pykolab/setup/components.py | 39 +++++++++++---------
pykolab/setup/setup_ldap.py | 10 +++++
pykolab/setup/setup_php.py | 83 ++++++++++++++++++++++++++++++++++++++++++++
pykolab/xml/event.py | 3 -
wallace/module_resources.py | 10 ++---
6 files changed, 121 insertions(+), 25 deletions(-)
New commits:
commit 65555cf5b42ae94385c42710f9587b9a13a23a78
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 11:51:14 2012 +0100
Omit warnings being printed to stderr
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index b92339a..18eea3e 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -583,9 +583,6 @@ class Event(object):
elif attr == "uid":
self.set_ical_uid(value)
- else:
- print "WARNING, no function for", attr
-
def set_ical_attendee(self, _attendee):
if isinstance(_attendee, basestring):
_attendee = [_attendee]
commit 3c5f7ed1e7639133568237705c7d45edb568537a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 11:48:15 2012 +0100
Add a notice on the setup now being executed (#919)
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index fd17d53..7241756 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -230,6 +230,14 @@ ServerAdminPwd = %(admin_pass)s
'--file=%s' % (filename)
]
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ Setup is now going to set up the 389 Directory Server. This
+ may take a little while (during which period there is no
+ output and no progress indication).
+ """)
+ )
+
log.info(_("Setting up 389 Directory Server"))
setup_389 = subprocess.Popen(
@@ -240,6 +248,8 @@ ServerAdminPwd = %(admin_pass)s
(stdoutdata, stderrdata) = setup_389.communicate()
+ # TODO: Get the return code and display output if not successful.
+
log.debug(_("Setup DS stdout:"), level=8)
log.debug(stdoutdata, level=8)
commit 1c03b3c0d35a358f6d7c4faf275eb37040cd4eeb
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 11:44:43 2012 +0100
Ensure all components get their chance to insert their own command-line switches
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index 4633160..f69db05 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -32,7 +32,7 @@ components = {}
component_groups = {}
executed_components = []
-executed_components = []
+finalize_conf_ok = None
def __init__():
# We only want the base path
@@ -116,8 +116,26 @@ def _list_components(*args, **kw):
return _components
+def cli_options_from_component(component_name, *args, **kw):
+ if components[component_name].has_key('group'):
+ group = components[component_name]['group']
+ component_name = components[component_name]['component_name']
+ try:
+ exec("from %s.setup_%s import cli_options as %s_%s_cli_options" % (group,component_name,group,component_name))
+ exec("%s_%s_cli_options()" % (group,component_name))
+ except ImportError, e:
+ pass
+
+ else:
+ try:
+ exec("from setup_%s import cli_options as %s_cli_options" % (component_name,component_name))
+ exec("%s_cli_options()" % (component_name))
+ except ImportError, e:
+ pass
+
def execute(component_name, *args, **kw):
if component_name == '':
+
log.debug(
_("No component selected, continuing for all components"),
level=8
@@ -152,6 +170,9 @@ def execute(component_name, *args, **kw):
break
return
+ else:
+ for component in _list_components():
+ cli_options_from_component(component)
if not components.has_key(component_name):
log.error(_("No such component."))
@@ -162,22 +183,6 @@ def execute(component_name, *args, **kw):
log.error(_("No such component."))
sys.exit(1)
- if components[component_name].has_key('group'):
- group = components[component_name]['group']
- component_name = components[component_name]['component_name']
- try:
- exec("from %s.setup_%s import cli_options as %s_%s_cli_options" % (group,component_name,group,component_name))
- exec("%s_%s_cli_options()" % (group,component_name))
- except ImportError, e:
- pass
-
- else:
- try:
- exec("from setup_%s import cli_options as %s_cli_options" % (component_name,component_name))
- exec("%s_cli_options()" % (component_name))
- except ImportError, e:
- pass
-
conf.finalize_conf()
if len(conf.cli_args) >= 1:
commit 48ee9b642503a635c787a916a21c3705d7985bb7
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 11:07:37 2012 +0100
Ask for the timezone if it hasn't been specified over the command-line options
diff --git a/pykolab/setup/setup_php.py b/pykolab/setup/setup_php.py
index c9db0f5..36e3b4d 100644
--- a/pykolab/setup/setup_php.py
+++ b/pykolab/setup/setup_php.py
@@ -45,7 +45,7 @@ def cli_options():
"--timezone",
dest = "timezone",
action = "store",
- default = "UTC",
+ default = None,
help = _("Specify the timezone for PHP.")
)
@@ -53,6 +53,17 @@ def description():
return _("Setup PHP.")
def execute(*args, **kw):
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ Please supply the timezone PHP should be using.
+ """)
+ )
+
+ conf.timezone = utils.ask_question(
+ _("Timezone ID"),
+ default="UTC"
+ )
+
myaugeas = Augeas()
setting_base = '/files/etc/php.ini/'
commit 33e63f426dfccc7bea4af7989f178cf5f72761d5
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 11:04:57 2012 +0100
Add setup_php for the PHP timezone
diff --git a/pykolab/Makefile.am b/pykolab/Makefile.am
index 73cf939..6353f86 100644
--- a/pykolab/Makefile.am
+++ b/pykolab/Makefile.am
@@ -57,6 +57,7 @@ pykolab_setup_PYTHON = \
setup/setup_ldap.py \
setup/setup_mta.py \
setup/setup_mysql.py \
+ setup/setup_php.py \
setup/setup_roundcube.py \
setup/setup_zpush.py \
setup/__init__.py
diff --git a/pykolab/setup/setup_php.py b/pykolab/setup/setup_php.py
new file mode 100644
index 0000000..c9db0f5
--- /dev/null
+++ b/pykolab/setup/setup_php.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+from augeas import Augeas
+import os
+import shutil
+import subprocess
+import tempfile
+
+import components
+
+import pykolab
+
+from pykolab import utils
+from pykolab.auth import Auth
+from pykolab.constants import *
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.setup')
+conf = pykolab.getConf()
+
+def __init__():
+ components.register('php', execute, description=description())
+
+def cli_options():
+ php_group = conf.add_cli_parser_option_group(_("PHP Options"))
+
+ php_group.add_option(
+ "--timezone",
+ dest = "timezone",
+ action = "store",
+ default = "UTC",
+ help = _("Specify the timezone for PHP.")
+ )
+
+def description():
+ return _("Setup PHP.")
+
+def execute(*args, **kw):
+ myaugeas = Augeas()
+
+ setting_base = '/files/etc/php.ini/'
+
+ setting = os.path.join(setting_base, 'Date', 'date.timezone')
+ current_value = myaugeas.get(setting)
+
+ if current_value == None:
+ insert_paths = myaugeas.match('/files/etc/php.ini/Date/*')
+ insert_path = insert_paths[(len(insert_paths)-1)]
+ myaugeas.insert(insert_path, setting_key, False)
+
+ log.debug(_("Setting key %r to %r") % ('Date/date.timezone', conf.timezone), level=8)
+ myaugeas.set(setting, conf.timezone)
+
+ myaugeas.save()
+
commit 230efabc11e9933ea5b7e445942c28145ffc8904
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Aug 4 00:08:22 2012 +0100
Fix #916 (iTip messages w/o resources getting stuck)
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index a4873f4..8bd3e1f 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -128,6 +128,7 @@ def execute(*args, **kw):
any_itips = False
any_resources = False
+ possibly_any_resources = True
# An iTip message may contain multiple events. Later on, test if the message
# is an iTip message by checking the length of this list.
@@ -152,12 +153,11 @@ def execute(*args, **kw):
# See if any iTip actually allocates a resource.
if len([x['resources'] for x in itip_events if x.has_key('resources')]) == 0:
if len([x['attendees'] for x in itip_events if x.has_key('attendees')]) == 0:
- any_resources = False
- else:
- any_resources = True
+ possibly_any_resources = False
else:
- any_resources = False
- else:
+ possibly_any_resources = False
+
+ if possibly_any_resources:
recipients = {
"To": getaddresses(message.get_all('To', [])),
"Cc": getaddresses(message.get_all('Cc', []))
More information about the commits
mailing list