[CalendarServer-changes] [5028] CalendarServer/branches/users/glyph/contacts-server-merge/contrib/ SBS

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 2 22:30:53 PST 2010


Revision: 5028
          http://trac.macosforge.org/projects/calendarserver/changeset/5028
Author:   glyph at apple.com
Date:     2010-02-02 22:30:50 -0800 (Tue, 02 Feb 2010)
Log Message:
-----------
Remove redundant restore utility, adjust config to match

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/conf/90-addressBookServer.plist

Removed Paths:
-------------
    CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/bin/addressBookServer_restore

Deleted: CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/bin/addressBookServer_restore
===================================================================
--- CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/bin/addressBookServer_restore	2010-02-03 06:00:48 UTC (rev 5027)
+++ CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/bin/addressBookServer_restore	2010-02-03 06:30:50 UTC (rev 5028)
@@ -1,179 +0,0 @@
-#!/usr/bin/env python
-##
-# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-
-"""
-Utility code for backup and restore
-"""
-
-import os
-import shutil
-import fnmatch
-import commands
-
-from twext.python.plistlib import readPlist
-
-VERBOSE = os.environ.get('VERBOSE', False)
-FUNCLOG = os.environ.get('FUNCLOG', False)
-
-SERVERADMIN = "/usr/sbin/serveradmin"
-
-SBSCONF = "/private/etc/server_backup"
-
-class Options(dict):
-    def parseOpts(self, argv):
-        for x in xrange(0, len(argv)):
-            opt = argv[x]
-            if opt.startswith('-'):
-                self[opt.strip('-')] = argv[x+1]
-
-
-def debug(string):
-    if VERBOSE:
-        print "DEBUG:", string
-
-
-def funclog(string):
-    if FUNCLOG:
-        print "FUNCLOG:", string
-
-
-def logFuncCall(func):
-    def printArgs(args):
-        a = []
-        for arg in args:
-            a.append(repr(arg))
-            a.append(', ')
-
-        return ''.join(a).strip(', ')
-
-    def printKwargs(kwargs):
-        a = []
-        for kwarg, value in kwargs:
-            a.append('%s=%r, ' % (kwarg, value))
-
-        return ''.join(a).strip(', ')
-
-    def _(*args, **kwargs):
-        funclog("%s(%s)" % (func.func_name, 
-                            ', '.join((printArgs(args),
-                                       printKwargs(kwargs))).strip(', ')))
-
-        retval = func(*args, **kwargs)
-
-        funclog("%s - > %s" % (func.func_name, retval))
-
-        return retval
-    
-    return _
-
-
- at logFuncCall
-def readConfig(configFile):
-    config = readPlist(configFile + '.default')
-
-    if os.path.exists(configFile):
-        config.update(readPlist(configFile))
-
-    return config
-        
-
- at logFuncCall
-def mkroot(path):
-    root = '/'.join(path.rstrip('/').split('/')[:-1])
-    os.makedirs(root)
-
-
- at logFuncCall
-def serveradmin(action, service):
-    cmd = ' '.join((
-            SERVERADMIN,
-            action,
-            service))
-
-    status, output = commands.getstatusoutput(cmd)
-
-    for line in output.split('\n'):
-        debug("C: %s" % (line,))
-
-    return status
-
-
- at logFuncCall
-def isRunning(service):
-    cmd = ' '.join((
-            SERVERADMIN,
-            'status',
-            service))
-
-    debug(cmd)
-
-    output = commands.getoutput(cmd)
-
-    for line in output.split('\n'):
-        debug("C: %s" % (line,))
-
-    status = output.split('=')[-1].strip(' "\n')
-
-    if status == "RUNNING":
-        return True
-    else:
-        return False
-
-
- at logFuncCall
-def copy(src, dst):
-    shutil.copytree(src, dst)
-
-
- at logFuncCall
-def move(src, dst):
-    os.rename(src, dst)
-
-
- at logFuncCall
-def remove(dst):
-    shutil.rmtree(dst)
-
-
- at logFuncCall
-def purge(root, patterns):
-    removed = []
-
-    for root, dirs, files in os.walk(root):
-        debug("purging in %s" % (root,))
-
-        for file in files:
-            for pat in patterns:
-                if fnmatch.fnmatch(file, pat):
-                    full = os.path.join(root, file)
-                    debug("removing %s because of %s" % (full, pat))
-
-                    os.remove(full)
-
-                    removed.append(full)
-
-        for dir in dirs:
-            for pat in patterns:
-                if fnmatch.fnmatch(dir, pat):
-                    full = os.path.join(root, dir)
-                    debug("removing %s because of %s" % (full, pat))
-
-                    os.remove(full)
-
-                    removed.append(full)
-                    
-    return removed

Modified: CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/conf/90-addressBookServer.plist
===================================================================
--- CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/conf/90-addressBookServer.plist	2010-02-03 06:00:48 UTC (rev 5027)
+++ CalendarServer/branches/users/glyph/contacts-server-merge/contrib/SBS/conf/90-addressBookServer.plist	2010-02-03 06:30:50 UTC (rev 5028)
@@ -6,7 +6,7 @@
     <string>addressBookServer</string>
     
     <key>RestoreBinaryPath</key>
-    <string>/usr/libexec/server_backup/addressBookServer_restore</string>
+    <string>/usr/libexec/server_backup/calendarServer_restore</string>
     <key>RestoreLog</key>
     <string>/private/var/log/server_backup/addressBookServer_restore.log</string>
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100202/16b84497/attachment.html>


More information about the calendarserver-changes mailing list