3 commits - pykolab/setup share/Makefile.am share/templates
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Tue Apr 30 17:48:16 CEST 2013
pykolab/setup/setup_freebusy.py | 99 +++-----------
pykolab/setup/setup_zpush.py | 109 ----------------
share/Makefile.am | 22 ---
share/templates/freebusy/config.php.tpl | 212 --------------------------------
share/templates/zpush/config.php.tpl | 106 ----------------
5 files changed, 27 insertions(+), 521 deletions(-)
New commits:
commit 42b4c46cbdff95c91b2db0410a20a630676467de
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Apr 30 16:42:44 2013 +0100
These files can go too
diff --git a/share/templates/freebusy/config.php.tpl b/share/templates/freebusy/config.php.tpl
deleted file mode 100644
index f41195a..0000000
--- a/share/templates/freebusy/config.php.tpl
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php
-/**
- * This file provides configuration settings for both the freebusy.php
- * and the pfb.php scripts.
- *
- * \$Horde: framework/Kolab_FreeBusy/www/Horde/Kolab/FreeBusy/config.php,v 1.4.2.2 2010/07/22 13:55:30 wrobel Exp \$
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * @author Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
- * @author Gunnar Wrobel <p at rdus.de>
- * @author Thomas Arendsen Hein <thomas at intevation.de>
- * @package Kolab_FreeBusy
- */
-
-\$conf = array();
-
-/* Horde::Log configuration */
-\$conf['log']['enabled'] = true;
-\$conf['log']['priority'] = PEAR_LOG_DEBUG;
-\$conf['log']['type'] = 'file';
-\$conf['log']['name'] = '/var/log/kolab/freebusy/freebusy.log';
-\$conf['log']['ident'] = 'Kolab Free/Busy';
-\$conf['log']['params']['append'] = true;
-
-/* PHP error logging */
-ini_set('error_log', '/var/log/kolab/freebusy/php.log');
-
-/* Horde::Kolab::LDAP configuration */
-\$conf['kolab']['ldap']['server'] = 'localhost';
-\$conf['kolab']['ldap']['basedn'] = '$ldap_base_dn';
-\$conf['kolab']['ldap']['phpdn'] = '$ldap_service_bind_dn';
-\$conf['kolab']['ldap']['phppw'] = '$ldap_service_bind_pw';
-
-/* Horde::Kolab::IMAP configuration */
-\$conf['kolab']['imap']['server'] = 'localhost';
-\$conf['kolab']['imap']['port'] = 143;
-\$conf['kolab']['imap']['protocol'] = 'imap/tls/novalidate-cert/readonly';
-\$conf['kolab']['imap']['namespaces'] = array(
- array('type' => 'personal', 'name' => '', 'delimiter' => '/'),
- array('type' => 'other', 'name' => 'Other Users', 'delimiter' => '/'),
- array('type' => 'shared', 'name' => 'Shared Folders', 'delimiter' => '/'),
-);
-
-/* Horde::Auth configuration */
-\$conf['auth']['params']['login_block'] = 0;
-\$conf['auth']['checkbrowser'] = false;
-\$conf['auth']['checkip'] = false;
-\$conf['umask'] = false;
-
-\$conf['auth']['driver'] = 'imap';
-\$conf['auth']['params']['hostspec'] = 'localhost';
-\$conf['auth']['params']['protocol'] = 'imap/tls/novalidate-cert';
-
-/* Allow special users to log into the system */
-\$conf['kolab']['imap']['allow_special_users'] = true;
-
-/* Do not record login attempts */
-\$conf['auth']['params']['login_block'] = false;
-
-/* Kolab::Freebusy configuration */
-
-/* Should we redirect using a Location header, if the user is not local? If this
- * is false we silently download the file ourselves and output it so that it
- * looks as though the free/busy information is coming from us.
- */
-\$conf['fb']['redirect'] = false;
-
-/* What is the address of the current server where the calendar data is stored?
- * This is also used as the LDAP server address where user objects reside.
- */
-\$conf['kolab']['freebusy']['server'] = 'http://' . \$_SERVER["HTTP_HOST"] . '/freebusy';
-
-/* What is our default mail domain? This is used if any users do not have
- * '@domain' specified after their username as part of their email address.
- */
-\$conf['fb']['email_domain'] = '$primary_domain';
-
-/* Location of the cache files */
-\$conf['fb']['cache_dir'] = '/tmp';
-\$conf['fb']['cache']['driver'] = 'sql';
-\$conf['fb']['cache']['params']['phptype'] = 'mysql';
-\$conf['fb']['cache']['params']['username'] = 'roundcube';
-\$conf['fb']['cache']['params']['password'] = '$mysql_roundcube_password';
-\$conf['fb']['cache']['params']['hostspec'] = 'localhost';
-\$conf['fb']['cache']['params']['database'] = 'roundcube';
-\$conf['fb']['cache']['params']['charset'] = 'utf-8';
-
-/* What db type to use for the freebusy caches */
-\$conf['fb']['dbformat'] = 'db4';
-
-/* Should we send a Content-Type header, indicating what the mime type of the
- * resulting VFB file is?
- */
-\$conf['fb']['send_content_type'] = false;
-
-/* Should we send a Content-Length header, indicating how large the resulting
- * VFB file is?
- */
-\$conf['fb']['send_content_length'] = false;
-
-/* Should we send a Content-Disposition header, indicating what the name of the
- * resulting VFB file should be?
- */
-\$conf['fb']['send_content_disposition'] = false;
-
-/* Should we use ACLs or does everybody get full rights? DO NOT set
- * this to false if you don't know what you are doing. Your free/busy
- * service should not be visible to any outside networks when
- * disabling the use of ACL settings.
- */
-\$conf['fb']['use_acls'] = true;
-
-/* How many days in advance should the free/busy information be calculated? This
- * is the default value that can be overwritten by the kolabFreeBusyFuture
- * attribute of the users LDAP account.
- */
-\$conf['fb']['future_days'] = 180;
-
-/* The resulting vCalendar file is being cached. The following setting
- * determines how many seconds it will be delivered without checking if
- * the contents of the file might have changed. A negative setting disables
- * caching (which is currently required for the resource management to work).
- */
-\$conf['fb']['vcal_cache']['min_age'] = -1;
-
-/* The resulting vCalendar file is being cached. The following setting
- * determines after how many seconds it will be considered too old for
- * delivery and a refresh of its contents will be enforced.
- */
-\$conf['fb']['vcal_cache']['max_age'] = 259200;
-
-/* The IMAP namespaces on the server. @TODO: Should obviously be
- * auto-detected.
- */
-\$conf['fb']['namespace']['personal'] = '';
-\$conf['fb']['namespace']['other'] = 'Other Users';
-
-/* In most cases you can rely on the standard event status to free/busy status
- * mapping. For the default kolab server this will mean that only the event
- * status "free" will be mapped to the free/busy status "FREE". All other event
- * status ("tentative", "busy", "outofoffice") will be mapped to "BUSY".
- *
- * If this mapping should be modified you can define it like this:
- *
- * \$conf['fb']['status_map'] = array(
- * Horde_Kolab_FreeBusy_Object_Event::STATUS_TENTATIVE =>
- * Horde_Kolab_FreeBusy_Helper_Freebusy_StatusMap::STATUS_BUSY_TENTATIVE,
- * Horde_Kolab_FreeBusy_Object_Event::STATUS_OUTOFOFFICE =>
- * 'X-OUT-OF-OFFICE',
- * );
- */
-require_once 'Horde/Kolab/FreeBusy/Object/Event.php';
-require_once 'Horde/Kolab/FreeBusy/Helper/Freebusy/StatusMap.php';
-\$conf['fb']['status_map'] = array(
- Horde_Kolab_FreeBusy_Object_Event::STATUS_TENTATIVE =>
- Horde_Kolab_FreeBusy_Helper_Freebusy_StatusMap::STATUS_BUSY_TENTATIVE,
- Horde_Kolab_FreeBusy_Object_Event::STATUS_OUTOFOFFICE =>
- 'X-OUT-OF-OFFICE',
-);
-
-/* Are there remote servers on which users have additional (shared)
- * folders? In that case free/busy information should also be fetched
- * from these servers.
- *
- * Add them like this:
- *
- * array('remote1.example.com', 'remote2.example.com')
- */
-\$conf['fb']['remote_servers'] = array();
-
-/* Is there an exchange server that you want to relay through this free/busy
- * application?
- *
- * Configure it like this:
- *
- * \$conf['fb']['exchange_server'] = array(
- * 'url' => 'https://example.com',
- * 'interval' => 30,
- * );
- */
-#\$conf['fb']['exchange_server'] = array(
-# 'url' => 'http://test90-9.test90.kolabsys.com',
-# 'interval' => 30,
-# 'username' => 'kolabservice',
-# 'password' => 'SomePass',
-#);
-
-/**
- * Ensure we use the Kolab group driver when handling groups.
- */
-\$conf['group']['driver'] = 'kolab';
-\$conf['group']['cache'] = false;
-
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-//
-// If you modify this file, please do not forget to also modify the
-// template in kolabd!
-//
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-// DEBUGGING
-// =========
-//
-// Activate this to see the log messages on the screen
-// \$conf['log']['type'] = 'display';
-//
-// Activate this to see the php messages on the screen
-// ini_set('display_errors', 1);
-//
-// Both settings will disrupt header delivery (which should not cause a
-// problem).
diff --git a/share/templates/zpush/config.php.tpl b/share/templates/zpush/config.php.tpl
deleted file mode 100644
index 9480ae4..0000000
--- a/share/templates/zpush/config.php.tpl
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
- /***********************************************
- * File : config.php
- * Project : Z-Push
- * Descr : Main configuration file
- *
- */
-
- define('KOLAB_SERVER', "$ldap_ldap_uri");
- define('KOLAB_LDAP_BASE',"$ldap_base_dn");
- define('KOLAB_BIND_DN',"$ldap_service_bind_dn");
- define('KOLAB_BIND_PW',"$ldap_service_bind_pw");
- define("KOLAB_LDAP_ACL","");
- define('KOLAB_IMAP_SERVER', "$imap_server");
-
- // Defines the default time zone
- if (function_exists("date_default_timezone_set")){
- date_default_timezone_set(date_default_timezone_get());
- }
-
- // Defines the base path on the server, terminated by a slash
- define('BASE_PATH', dirname(\$_SERVER['SCRIPT_FILENAME']) . "/");
-
- // Define the include paths
- ini_set(
- 'include_path',
- BASE_PATH . "include/" . PATH_SEPARATOR .
- BASE_PATH . PATH_SEPARATOR .
- ini_get('include_path') . PATH_SEPARATOR .
- "/usr/share/php/" . PATH_SEPARATOR .
- "/usr/share/php5/" . PATH_SEPARATOR .
- "/usr/share/pear/"
- );
-
- define('STATE_DIR', 'state');
-
- // Try to set unlimited timeout
- define('SCRIPT_TIMEOUT', 0);
-
- //Max size of attachments to display inline. Default is 1MB
- define('MAX_EMBEDDED_SIZE', 1048576);
-
- // Device Provisioning
- define('PROVISIONING', true);
-
- // This option allows the 'loose enforcement' of the provisioning policies for older
- // devices which don't support provisioning (like WM 5 and HTC Android Mail) - dw2412 contribution
- // false (default) - Enforce provisioning for all devices
- // true - allow older devices, but enforce policies on devices which support it
- define('LOOSE_PROVISIONING', false);
- // Default conflict preference
- // Some devices allow to set if the server or PIM (mobile)
- // should win in case of a synchronization conflict
- // SYNC_CONFLICT_OVERWRITE_SERVER - Server is overwritten, PIM wins
- // SYNC_CONFLICT_OVERWRITE_PIM - PIM is overwritten, Server wins (default)
- define('SYNC_CONFLICT_DEFAULT', SYNC_CONFLICT_OVERWRITE_PIM);
-
- // The data providers that we are using (see configuration below
- \$BACKEND_PROVIDER = "BackendKolab";
-
- define("KOLAB_LDAP_ACL","");
- define('KOLAB_IMAP_NAMESPACES', Array(
- 'personal' => "",
- 'shared' => "Shared Folders",
- 'users' => "Other Users"
- )
- );
-
- define('KOLAB_IMAP_PORT', 143);
- define('KOLAB_IMAP_OPTIONS', "/tls/novalidate-cert");
-
- define('KOLAB_INDEX',"/var/cache/kolab/z-push/kolabindex");
-
- //KolabMode
- // 0 = FlatMode
- // 1 = FolderMode
- // 2 = try to determine the mode
- define("KOLAB_MODE",2);
- // define which mobile support foldermode
- // this list is checked if KOLAB_MODE is set to 2
- define("KOLAB_MOBILES_FOLDERMODE","iphone:ipod:ipad");
- // folders by default if annotation is not found
- // possiblename1:possiblename2: ......
- // if no folders found the last found will be the default
- define('KOLAB_DEFAULTFOLDER_DIARY',"calendar:kalender:calendrier:agenda");
- define('KOLAB_DEFAULTFOLDER_CONTACT',"contacts:kontact");
- define('KOLAB_DEFAULTFOLDER_TASK',"task:taske");
- // If 1: shared folders will be read-only, even if the user have rights on it
- define('KOLAB_SHAREDFOLDERS_RO',"1");
-
- // Logfile
- define('KOLAB_LOGFILE',"/var/log/z-push/access.log");
- //For Gal
- define('SYNC_GAL_DISPLAYNAME','cn');
- define('SYNC_GAL_PHONE','telephonenumber');
- define('SYNC_GAL_OFFICE', '');
- define('SYNC_GAL_TITLE','title');
- define('SYNC_GAL_COMPANY','o');
- define('SYNC_GAL_ALIAS','uid');
- define('SYNC_GAL_FIRSTNAME','givenname');
- define('SYNC_GAL_LASTNAME','sn');
- define('SYNC_GAL_HOMEPHONE','homephone');
- define('SYNC_GAL_MOBILEPHONE','mobile');
- define('SYNC_GAL_EMAILADDRESS','mail');
-
-?>
commit 07aff2640602afa9c958b7d4fd8c697be0581ef6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Apr 30 16:42:22 2013 +0100
Remove zpush and horde configuration
diff --git a/pykolab/setup/setup_zpush.py b/pykolab/setup/setup_zpush.py
deleted file mode 100644
index 4d1ce70..0000000
--- a/pykolab/setup/setup_zpush.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright 2010-2013 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 Cheetah.Template import Template
-import os
-import subprocess
-import sys
-import time
-
-import components
-
-import pykolab
-
-from pykolab import utils
-from pykolab.constants import *
-from pykolab.translate import _
-
-log = pykolab.getLogger('pykolab.setup')
-conf = pykolab.getConf()
-
-def __init__():
- components.register('zpush', execute, description=description(), after=['mysql','ldap'])
-
-def description():
- return _("Setup zpush.")
-
-def execute(*args, **kw):
- if not os.path.isfile('/etc/z-push/config.php'):
- log.error(_("Z-Push is not installed on this system"))
- return
-
- zpush_settings = {
- 'ldap_base_dn': conf.get('ldap', 'base_dn'),
- 'ldap_ldap_uri': conf.get('ldap', 'ldap_uri'),
- 'ldap_service_bind_dn': conf.get('ldap', 'service_bind_dn'),
- 'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'),
- 'imap_server': "localhost"
- }
-
-
- want_files = [
- 'config.php',
- ]
-
- for want_file in want_files:
- template_file = None
- if os.path.isfile('/etc/kolab/templates/zpush/%s.tpl' % (want_file)):
- template_file = '/etc/kolab/templates/zpush/%s.tpl' % (want_file)
- elif os.path.isfile('/usr/share/kolab/templates/zpush/%s.tpl' % (want_file)):
- template_file = '/usr/share/kolab/templates/zpush/%s.tpl' % (want_file)
- elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'zpush', '%s.tpl' % (want_file)))):
- template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'zpush', '%s.tpl' % (want_file)))
-
- if not template_file == None:
- log.debug(_("Using template file %r") % (template_file), level=8)
- fp = open(template_file, 'r')
- template_definition = fp.read()
- fp.close()
-
- t = Template(template_definition, searchList=[zpush_settings])
- log.debug(
- _("Successfully compiled template %r, writing out to %r") % (
- template_file,
- '/etc/z-push/%s' % (want_file)
- ),
- level=8
- )
-
- fp = open('/etc/z-push/%s' % (want_file), 'w')
- fp.write(t.__str__())
- fp.close()
-
- time.sleep(2)
-
- if os.path.isfile('/bin/systemctl'):
- subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
- elif os.path.isfile('/sbin/service'):
- subprocess.call(['/sbin/service', 'httpd', 'restart'])
- elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','apache2','restart'])
- else:
- log.error(_("Could not start the webserver server service."))
-
- if os.path.isfile('/bin/systemctl'):
- subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
- elif os.path.isfile('/sbin/chkconfig'):
- subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
- elif os.path.isfile('/usr/sbin/update-rc.d'):
- subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
- else:
- log.error(_("Could not configure to start on boot, the " + \
- "webserver server service."))
-
diff --git a/share/Makefile.am b/share/Makefile.am
index 4bfff10..b3174e1 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -2,34 +2,16 @@ templatedir = $(datadir)/kolab/templates
template_DATA = \
$(wildcard templates/*.tpl)
-fbtemplatedir = $(datadir)/kolab/templates/freebusy
-fbtemplate_DATA = \
- $(wildcard templates/freebusy/*.tpl)
-
-hordetemplatedir = $(datadir)/kolab/templates/horde/conf.d/
-hordetemplate_DATA = \
- $(wildcard templates/horde/conf.d/*.tpl)
-
rctemplatedir = $(datadir)/kolab/templates/roundcubemail
rctemplate_DATA = \
$(wildcard templates/roundcubemail/*.tpl)
-zpushtemplatedir = $(datadir)/kolab/templates/zpush
-zpushtemplate_DATA = \
- $(wildcard templates/zpush/*.tpl)
-
EXTRA_DIST = \
$(template_DATA) \
- $(fbtemplate_DATA) \
- $(hordetemplate_DATA) \
- $(rctemplate_DATA) \
- $(zpushtemplate_DATA)
+ $(rctemplate_DATA)
install-exec-local:
mkdir -p \
$(DESTDIR)/$(sysconfdir)/kolab/templates \
- $(DESTDIR)/$(sysconfdir)/kolab/templates/freebusy \
- $(DESTDIR)/$(sysconfdir)/kolab/templates/horde/conf.d \
- $(DESTDIR)/$(sysconfdir)/kolab/templates/roundcubemail \
- $(DESTDIR)/$(sysconfdir)/kolab/templates/zpush
+ $(DESTDIR)/$(sysconfdir)/kolab/templates/roundcubemail
commit 5a18758c0db77dac4164e0c0eb26f62d2690e978
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Apr 30 16:41:35 2013 +0100
Supply setup-kolab routines for the new kolab-freebusy service
diff --git a/pykolab/setup/setup_freebusy.py b/pykolab/setup/setup_freebusy.py
index df0133f..7c0df1d 100644
--- a/pykolab/setup/setup_freebusy.py
+++ b/pykolab/setup/setup_freebusy.py
@@ -17,9 +17,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-from Cheetah.Template import Template
+from ConfigParser import RawConfigParser
import os
-import subprocess
import sys
import time
@@ -39,92 +38,44 @@ def __init__():
'freebusy',
execute,
description=description(),
- after=['mysql','ldap', 'roundcube']
+ after=['ldap']
)
def description():
return _("Setup Free/Busy.")
def execute(*args, **kw):
- if not os.path.isfile('/etc/kolab/freebusy/config.php'):
+ if not os.path.isfile('/etc/kolab-freebusy/config.ini') and not os.path.isfile('/etc/kolab-freebusy/config.ini.sample'):
log.error(_("Free/Busy is not installed on this system"))
return
- if not hasattr(conf, 'mysql_roundcube_password'):
- print >> sys.sdterr, utils.multiline_message(
- _("""
- Please supply the MySQL password for the 'roundcube'
- user. You have supplied this password earlier, and it is
- available from the database URI setting in
- /etc/roundcubemail/db.inc.php.
- """)
- )
-
- conf.mysql_roundcube_password = utils.ask_question(
- _("MySQL roundcube password"),
- password=True,
- confirm=True
- )
+ if not os.path.isfile('/etc/kolab-freebusy/config.ini'):
+ os.rename('/etc/kolab-freebusy/config.ini.sample', '/etc/kolab-freebusy/config.ini')
freebusy_settings = {
- 'ldap_base_dn': conf.get('ldap', 'base_dn'),
- 'ldap_ldap_uri': conf.get('ldap', 'ldap_uri'),
- 'ldap_service_bind_dn': conf.get('ldap', 'service_bind_dn'),
- 'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'),
- 'primary_domain': conf.get('kolab', 'primary_domain'),
- 'mysql_roundcube_password': conf.mysql_roundcube_password
+ 'directory "kolab-ldap"': {
+ 'host': conf.get('ldap', 'ldap_uri'),
+ 'base_dn': conf.get('ldap', 'base_dn'),
+ 'bind_dn': conf.get('ldap', 'service_bind_dn'),
+ 'bind_pw': conf.get('ldap', 'service_bind_pw'),
+ 'fbsource': 'file:/var/lib/kolab-freebusy/%mail.ifb',
+ },
+ 'httpauth': {
+ }
}
- want_files = [
- 'config.php',
- ]
-
- for want_file in want_files:
- template_file = None
- if os.path.isfile('/etc/kolab/templates/freebusy/%s.tpl' % (want_file)):
- template_file = '/etc/kolab/templates/freebusy/%s.tpl' % (want_file)
- elif os.path.isfile('/usr/share/kolab/templates/freebusy/%s.tpl' % (want_file)):
- template_file = '/usr/share/kolab/templates/freebusy/%s.tpl' % (want_file)
- elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'freebusy', '%s.tpl' % (want_file)))):
- template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'freebusy', '%s.tpl' % (want_file)))
-
- if not template_file == None:
- log.debug(_("Using template file %r") % (template_file), level=8)
- fp = open(template_file, 'r')
- template_definition = fp.read()
- fp.close()
-
- t = Template(template_definition, searchList=[freebusy_settings])
- log.debug(
- _("Successfully compiled template %r, writing out to %r") % (
- template_file,
- '/etc/kolab/freebusy/%s' % (want_file)
- ),
- level=8
- )
-
- fp = open('/etc/kolab/freebusy/%s' % (want_file), 'w')
- fp.write(t.__str__())
- fp.close()
+ cfg_parser = RawConfigParser()
+ cfg_parser.read('/etc/kolab-freebusy/config.ini')
- time.sleep(2)
+ for section in freebusy_settings.keys():
+ if len(freebusy_settings[section].keys()) < 1:
+ cfg_parser.remove_section(section)
+ continue
- if os.path.isfile('/bin/systemctl'):
- subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
- elif os.path.isfile('/sbin/service'):
- subprocess.call(['/sbin/service', 'httpd', 'restart'])
- elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','apache2','restart'])
- else:
- log.error(_("Could not start the webserver server service."))
+ for key in freebusy_settings[section].keys():
+ cfg_parser.set(section, key, freebusy_settings[section][key])
- if os.path.isfile('/bin/systemctl'):
- subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
- elif os.path.isfile('/sbin/chkconfig'):
- subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
- elif os.path.isfile('/usr/sbin/update-rc.d'):
- subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
- else:
- log.error(_("Could not configure to start on boot, the " + \
- "webserver server service."))
+ fp = open('/etc/kolab-freebusy/config.ini', "w+")
+ cfg_parser.write(fp)
+ fp.close()
More information about the commits
mailing list