Thread: [cedar-backup-svn] SF.net SVN: cedar-backup: [803] cedar-backup2/trunk/CedarBackup2
Brought to you by:
pronovic
|
From: <pro...@us...> - 2007-12-15 17:59:15
|
Revision: 803
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=803&view=rev
Author: pronovic
Date: 2007-12-15 09:59:13 -0800 (Sat, 15 Dec 2007)
Log Message:
-----------
Fix typos
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/config.py
cedar-backup2/trunk/CedarBackup2/peer.py
Modified: cedar-backup2/trunk/CedarBackup2/config.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/config.py 2007-12-02 18:26:05 UTC (rev 802)
+++ cedar-backup2/trunk/CedarBackup2/config.py 2007-12-15 17:59:13 UTC (rev 803)
@@ -1837,7 +1837,7 @@
"""
if value is not None:
if len(value) < 1:
- raise ValueError("The remote user must be a non-empty string.")
+ raise ValueError("The rcp command must be a non-empty string.")
self._rcpCommand = value
def _getRcpCommand(self):
Modified: cedar-backup2/trunk/CedarBackup2/peer.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-02 18:26:05 UTC (rev 802)
+++ cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-15 17:59:13 UTC (rev 803)
@@ -437,10 +437,10 @@
Initializes a remote backup peer.
@note: If provided, the rcp command will eventually be parsed into a list
- of strings suitable for passing to C{popen2.Popen4} in order to avoid
- security holes related to shell interpolation. This parsing will be
- done by the L{util.splitCommandLine} function. See the documentation for
- that function for some important notes about its limitations.
+ of strings suitable for passing to C{util.executeCommand} in order to
+ avoid security holes related to shell interpolation. This parsing will
+ be done by the L{util.splitCommandLine} function. See the documentation
+ for that function for some important notes about its limitations.
@param name: Name of the backup peer
@type name: String, must be a valid DNS hostname
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pro...@us...> - 2007-12-19 04:00:39
|
Revision: 823
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=823&view=rev
Author: pronovic
Date: 2007-12-18 20:00:31 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
Changes from testing on daystrom
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/cli.py
cedar-backup2/trunk/CedarBackup2/peer.py
Modified: cedar-backup2/trunk/CedarBackup2/cli.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/cli.py 2007-12-19 03:35:49 UTC (rev 822)
+++ cedar-backup2/trunk/CedarBackup2/cli.py 2007-12-19 04:00:31 UTC (rev 823)
@@ -227,6 +227,7 @@
configPath = options.config
executeLocal = True
+ executeManaged = False
if options.managedOnly:
executeLocal = False
executeManaged = True
@@ -456,8 +457,8 @@
@raise Exception: If there is a problem executing the action.
"""
- for peer in remotePeer:
- log.debug("Executing managed action [%s] on peer [%s]." % (self.name, peer.name))
+ for peer in self.remotePeers:
+ logger.debug("Executing managed action [%s] on peer [%s]." % (self.name, peer.name))
peer.executeManagedAction(self.name, options.full)
@@ -823,7 +824,7 @@
@raise Exception: If there is a problem executing the actions.
"""
- log.debug("Executing local actions.")
+ logger.debug("Executing local actions.")
for actionItem in self.actionSet:
actionItem.executeAction(configPath, options, config)
Modified: cedar-backup2/trunk/CedarBackup2/peer.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-19 03:35:49 UTC (rev 822)
+++ cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-19 04:00:31 UTC (rev 823)
@@ -857,7 +857,6 @@
@raise IOError: If there is an error executing the action on the remote peer.
"""
- log.debug("Executing managed action [%s] on peer [%s]." % (action, self.name))
command = RemotePeer._buildCbackCommand(self.cbackCommand, action, fullBackup)
self.executeRemoteCommand(command)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pro...@us...> - 2008-03-16 23:34:31
|
Revision: 852
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=852&view=rev
Author: pronovic
Date: 2008-03-16 16:34:19 -0700 (Sun, 16 Mar 2008)
Log Message:
-----------
Fix stage action so it works for local users (closes: #1854634).
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/actions/stage.py
cedar-backup2/trunk/CedarBackup2/peer.py
Modified: cedar-backup2/trunk/CedarBackup2/actions/stage.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/actions/stage.py 2008-03-16 23:20:35 UTC (rev 851)
+++ cedar-backup2/trunk/CedarBackup2/actions/stage.py 2008-03-16 23:34:19 UTC (rev 852)
@@ -116,8 +116,14 @@
continue
logger.debug("Found collect indicator.")
targetDir = stagingDirs[peer.name]
- ownership = getUidGid(config.options.backupUser, config.options.backupGroup)
- logger.debug("Using target dir [%s], ownership [%d:%d]." % (targetDir, ownership[0], ownership[1]))
+ if os.getuid() == 0:
+ # Since we're running as root, we can change ownership
+ ownership = getUidGid(config.options.backupUser, config.options.backupGroup)
+ logger.debug("Using target dir [%s], ownership [%d:%d]." % (targetDir, ownership[0], ownership[1]))
+ else:
+ # Non-root cannot change ownership, so don't set it
+ ownership = None
+ logger.debug("Using target dir [%s], ownership [None]." % targetDir)
try:
count = peer.stagePeer(targetDir=targetDir, ownership=ownership) # note: utilize effective user's default umask
logger.info("Staged %d files for peer [%s]." % (count, peer.name))
Modified: cedar-backup2/trunk/CedarBackup2/peer.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/peer.py 2008-03-16 23:20:35 UTC (rev 851)
+++ cedar-backup2/trunk/CedarBackup2/peer.py 2008-03-16 23:34:19 UTC (rev 852)
@@ -981,14 +981,11 @@
differenceSet = afterSet.difference(beforeSet) # files we added as part of copy
if len(differenceSet) == 0:
raise IOError("Apparently did not copy any new files from remote peer.")
- if localUser is None:
- logger.debug("Not root, so not attempting to change owner on staged files.")
- else:
- for targetFile in differenceSet:
- if ownership is not None:
- os.chown(targetFile, ownership[0], ownership[1])
- if permissions is not None:
- os.chmod(targetFile, permissions)
+ for targetFile in differenceSet:
+ if ownership is not None:
+ os.chown(targetFile, ownership[0], ownership[1])
+ if permissions is not None:
+ os.chmod(targetFile, permissions)
return len(differenceSet)
_copyRemoteDir = staticmethod(_copyRemoteDir)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pro...@us...> - 2008-03-18 03:45:48
|
Revision: 861
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=861&view=rev
Author: pronovic
Date: 2008-03-17 20:45:42 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
Add a bytes attribute to ByteQuantity
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/config.py
cedar-backup2/trunk/CedarBackup2/extend/split.py
Modified: cedar-backup2/trunk/CedarBackup2/config.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/config.py 2008-03-18 02:55:08 UTC (rev 860)
+++ cedar-backup2/trunk/CedarBackup2/config.py 2008-03-18 03:45:42 UTC (rev 861)
@@ -246,7 +246,7 @@
from CedarBackup2.writers.util import validateScsiId, validateDriveSpeed
from CedarBackup2.util import UnorderedList, AbsolutePathList, ObjectTypeList
from CedarBackup2.util import RegexMatchList, RegexList, encodePath
-from CedarBackup2.util import UNIT_BYTES, UNIT_KBYTES, UNIT_MBYTES, UNIT_GBYTES
+from CedarBackup2.util import convertSize, UNIT_BYTES, UNIT_KBYTES, UNIT_MBYTES, UNIT_GBYTES
from CedarBackup2.xmlutil import isElement, readChildren, readFirstChild
from CedarBackup2.xmlutil import readStringList, readString, readInteger, readBoolean
from CedarBackup2.xmlutil import addContainerNode, addStringNode, addIntegerNode, addBooleanNode
@@ -391,8 +391,15 @@
"""
return self._units
+ def _getBytes(self):
+ """
+ Property target used to return the byte quantity as a floating point number.
+ """
+ return float(convertSize(self.quantity, self.units, UNIT_BYTES))
+
quantity = property(_getQuantity, _setQuantity, None, doc="Byte quantity, as a string")
units = property(_getUnits, _setUnits, None, doc="Units for byte quantity, for instance UNIT_BYTES")
+ bytes = property(_getBytes, None, None, doc="Byte quantity, as a floating point number.")
########################################################################
Modified: cedar-backup2/trunk/CedarBackup2/extend/split.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/extend/split.py 2008-03-18 02:55:08 UTC (rev 860)
+++ cedar-backup2/trunk/CedarBackup2/extend/split.py 2008-03-18 03:45:42 UTC (rev 861)
@@ -65,7 +65,7 @@
# Cedar Backup modules
from CedarBackup2.filesystem import FilesystemList
-from CedarBackup2.util import resolveCommand, executeCommand, convertSize
+from CedarBackup2.util import resolveCommand, executeCommand
from CedarBackup2.util import changeOwnership, buildNormalizedPath
from CedarBackup2.util import UNIT_BYTES, UNIT_KBYTES, UNIT_MBYTES, UNIT_GBYTES
from CedarBackup2.xmlutil import createInputDom, addContainerNode, addStringNode
@@ -444,10 +444,9 @@
"""
logger.debug("Begin splitting contents of [%s]." % dailyDir)
fileList = getBackupFiles(dailyDir) # ignores indicator files
- limitBytes = float(convertSize(sizeLimit.quantity, sizeLimit.units, UNIT_BYTES))
for path in fileList:
size = float(os.stat(path).st_size)
- if size > limitBytes:
+ if size > sizeLimit.bytes:
_splitFile(path, splitSize, backupUser, backupGroup, removeSource=True)
logger.debug("Completed splitting contents of [%s]." % dailyDir)
@@ -479,7 +478,7 @@
dirname = os.path.dirname(sourcePath)
filename = os.path.basename(sourcePath)
prefix = "%s_" % filename
- bytes = int(convertSize(splitSize.quantity, splitSize.units, UNIT_BYTES))
+ bytes = int(splitSize.bytes)
os.chdir(dirname) # need to operate from directory that we want files written to
command = resolveCommand(SPLIT_COMMAND)
args = [ "--verbose", "--numeric-suffixes", "--suffix-length=5", "--bytes=%d" % bytes, filename, prefix, ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pro...@us...> - 2008-03-19 01:27:35
|
Revision: 871
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=871&view=rev
Author: pronovic
Date: 2008-03-18 18:27:24 -0700 (Tue, 18 Mar 2008)
Log Message:
-----------
Final tweaks from testing capacity functionality
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/extend/capacity.py
cedar-backup2/trunk/CedarBackup2/writers/cdwriter.py
cedar-backup2/trunk/CedarBackup2/writers/dvdwriter.py
Modified: cedar-backup2/trunk/CedarBackup2/extend/capacity.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/extend/capacity.py 2008-03-19 01:17:38 UTC (rev 870)
+++ cedar-backup2/trunk/CedarBackup2/extend/capacity.py 2008-03-19 01:27:24 UTC (rev 871)
@@ -523,9 +523,11 @@
logger.debug("Media capacity: %s" % capacity)
if local.capacity.maxPercentage is not None:
if capacity.utilized > local.capacity.maxPercentage.percentage:
- logger.error("Media has reached capacity limit: media is %.2f%% utilized." % capacity.utilized)
+ logger.error("Media has reached capacity limit of %s%%: %.2f%% utilized" %
+ (local.capacity.maxPercentage.quantity, capacity.utilized))
else: # if local.capacity.bytes is not None
if capacity.bytesAvailable < local.capacity.minBytes.bytes:
- logger.error("Media has reached capacity limit: only %s remain." % displayBytes(capacity.bytesAvailable))
+ logger.error("Media has reached capacity limit of %s: only %s available" %
+ (displayBytes(local.capacity.minBytes.bytes), displayBytes(capacity.bytesAvailable)))
logger.info("Executed the capacity extended action successfully.")
Modified: cedar-backup2/trunk/CedarBackup2/writers/cdwriter.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/writers/cdwriter.py 2008-03-19 01:17:38 UTC (rev 870)
+++ cedar-backup2/trunk/CedarBackup2/writers/cdwriter.py 2008-03-19 01:27:24 UTC (rev 871)
@@ -219,7 +219,7 @@
"""
Informal string representation for class instance.
"""
- return "%s of %s (%.2f%%)" % (displayBytes(self.bytesUsed), displayBytes(self.totalCapacity), self.utilized)
+ return "utilized %s of %s (%.2f%%)" % (displayBytes(self.bytesUsed), displayBytes(self.totalCapacity), self.utilized)
def _getBytesUsed(self):
"""
Modified: cedar-backup2/trunk/CedarBackup2/writers/dvdwriter.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/writers/dvdwriter.py 2008-03-19 01:17:38 UTC (rev 870)
+++ cedar-backup2/trunk/CedarBackup2/writers/dvdwriter.py 2008-03-19 01:27:24 UTC (rev 871)
@@ -181,7 +181,7 @@
"""
Informal string representation for class instance.
"""
- return "%s of %s (%.2f%%)" % (displayBytes(self.bytesUsed), displayBytes(self.totalCapacity), self.utilized)
+ return "utilized %s of %s (%.2f%%)" % (displayBytes(self.bytesUsed), displayBytes(self.totalCapacity), self.utilized)
def _getBytesUsed(self):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pro...@us...> - 2008-03-20 17:16:48
|
Revision: 891
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=891&view=rev
Author: pronovic
Date: 2008-03-20 10:16:46 -0700 (Thu, 20 Mar 2008)
Log Message:
-----------
Clean up pychecker warnings
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/cli.py
cedar-backup2/trunk/CedarBackup2/util.py
Modified: cedar-backup2/trunk/CedarBackup2/cli.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/cli.py 2008-03-20 17:12:59 UTC (rev 890)
+++ cedar-backup2/trunk/CedarBackup2/cli.py 2008-03-20 17:16:46 UTC (rev 891)
@@ -89,7 +89,7 @@
from CedarBackup2.release import AUTHOR, EMAIL, VERSION, DATE, COPYRIGHT
from CedarBackup2.util import RestrictedContentList, DirectedGraph, PathResolverSingleton
from CedarBackup2.util import sortDict, splitCommandLine, executeCommand, getFunctionReference
-from CedarBackup2.util import getUidGid, encodePath
+from CedarBackup2.util import getUidGid, encodePath, Diagnostics
from CedarBackup2.config import Config
from CedarBackup2.peer import RemotePeer
from CedarBackup2.actions.collect import executeCollect
Modified: cedar-backup2/trunk/CedarBackup2/util.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/util.py 2008-03-20 17:12:59 UTC (rev 890)
+++ cedar-backup2/trunk/CedarBackup2/util.py 2008-03-20 17:16:46 UTC (rev 891)
@@ -1019,11 +1019,11 @@
values = self.getValues()
keys = values.keys()
keys.sort()
- max = Diagnostics._getMaxLength(keys) + 3 # three extra dots in output
+ tmax = Diagnostics._getMaxLength(keys) + 3 # three extra dots in output
lines = []
for key in keys:
title = key.title()
- title += (max - len(title)) * '.'
+ title += (tmax - len(title)) * '.'
value = values[key]
line = "%s%s: %s" % (prefix, title, value)
lines.append(line)
@@ -1033,11 +1033,11 @@
"""
Get the maximum length from among a list of strings.
"""
- max = 0
+ tmax = 0
for value in values:
- if len(value) > max:
- max = len(value)
- return max
+ if len(value) > tmax:
+ tmax = len(value)
+ return tmax
_getMaxLength = staticmethod(_getMaxLength)
def _getVersion(self):
@@ -1063,20 +1063,22 @@
"""
Property target to get the operating system platform.
"""
- platform = sys.platform
- if platform.startswith("win"):
- WINDOWS_PLATFORMS = [ "Windows 3.1", "Windows 95/98/ME", "Windows NT/2000/XP", "Windows CE", ]
- wininfo = sys.getwindowsversion()
- winversion = "%d.%d.%d" % (wininfo[0], wininfo[1], wininfo[2])
- winplatform = WINDOWS_PLATFORMS[wininfo[3]]
- wintext = wininfo[4] # i.e. "Service Pack 2"
- return "%s (%s %s %s)" % (platform, winplatform, winversion, wintext)
- else:
- uname = os.uname()
- sysname = uname[0] # i.e. Linux
- release = uname[2] # i.e. 2.16.18-2
- machine = uname[4] # i.e. i686
- return "%s (%s %s %s)" % (platform, sysname, release, machine)
+ try:
+ if sys.platform.startswith("win"):
+ WINDOWS_PLATFORMS = [ "Windows 3.1", "Windows 95/98/ME", "Windows NT/2000/XP", "Windows CE", ]
+ wininfo = sys.getwindowsversion()
+ winversion = "%d.%d.%d" % (wininfo[0], wininfo[1], wininfo[2])
+ winplatform = WINDOWS_PLATFORMS[wininfo[3]]
+ wintext = wininfo[4] # i.e. "Service Pack 2"
+ return "%s (%s %s %s)" % (sys.platform, winplatform, winversion, wintext)
+ else:
+ uname = os.uname()
+ sysname = uname[0] # i.e. Linux
+ release = uname[2] # i.e. 2.16.18-2
+ machine = uname[4] # i.e. i686
+ return "%s (%s %s %s)" % (sys.platform, sysname, release, machine)
+ except AttributeError:
+ return sys.platform
def _getLocale(self):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|