[cedar-backup-svn] SF.net SVN: cedar-backup: [813] cedar-backup2/trunk
Brought to you by:
pronovic
|
From: <pro...@us...> - 2007-12-16 16:55:29
|
Revision: 813
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=813&view=rev
Author: pronovic
Date: 2007-12-16 08:55:27 -0800 (Sun, 16 Dec 2007)
Log Message:
-----------
Require cback command and managed action list for managed peers
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/config.py
cedar-backup2/trunk/test/configtests.py
Modified: cedar-backup2/trunk/CedarBackup2/config.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/config.py 2007-12-16 16:12:43 UTC (rev 812)
+++ cedar-backup2/trunk/CedarBackup2/config.py 2007-12-16 16:55:27 UTC (rev 813)
@@ -5664,13 +5664,18 @@
names.append(remotePeer.name)
if remotePeer.collectDir is None:
raise ValueError("Remote peers must set a collect directory.")
- if (self.options is None or self.options.backupUser is None) and remotePeer.remoteUser is None: # redundant
+ if (self.options is None or self.options.backupUser is None) and remotePeer.remoteUser is None:
raise ValueError("Remote user must either be set in options section or individual remote peer.")
- if (self.options is None or self.options.rcpCommand is None) and remotePeer.rcpCommand is None: # redundant
+ if (self.options is None or self.options.rcpCommand is None) and remotePeer.rcpCommand is None:
raise ValueError("Remote copy command must either be set in options section or individual remote peer.")
if remotePeer.managed:
- if (self.options is None or self.options.rshCommand is None) and remotePeer.rshCommand is None: # redundant
+ if (self.options is None or self.options.rshCommand is None) and remotePeer.rshCommand is None:
raise ValueError("Remote shell command must either be set in options section or individual remote peer.")
+ if (self.options is None or self.options.cbackCommand is None) and remotePeer.cbackCommand is None:
+ raise ValueError("Remote cback command must either be set in options section or individual remote peer.")
+ if ((self.options is None or self.options.managedActions is None or len(self.options.managedActions) < 1)
+ and (remotePeer.managedActions is None or len(remotePeer.managedActions) < 1)):
+ raise ValueError("Managed actions list must be set in options section or individual remote peer.")
Config._checkUnique("Duplicate peer names exist:", names)
Modified: cedar-backup2/trunk/test/configtests.py
===================================================================
--- cedar-backup2/trunk/test/configtests.py 2007-12-16 16:12:43 UTC (rev 812)
+++ cedar-backup2/trunk/test/configtests.py 2007-12-16 16:55:27 UTC (rev 813)
@@ -10263,7 +10263,104 @@
config._validatePeers()
self.failUnlessRaises(ValueError, config._validateStage)
+ def testValidate_073(self):
+ """
+ Confirm that remote peer is required to have backup user if not set in options.
+ """
+ config = Config()
+ config.options = OptionsConfig(backupUser="ken", rcpCommand="rcp", rshCommand="rsh", cbackCommand="cback", managedActions=["collect"], )
+ config.peers = PeersConfig()
+ config.peers.localPeers = []
+ config.peers.remotePeers = [ RemotePeer(name="remote", collectDir="/path"), ]
+ config._validatePeers()
+ config.options.backupUser = None
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.peers.remotePeers[0].remoteUser = "ken"
+ config._validatePeers()
+
+ def testValidate_074(self):
+ """
+ Confirm that remote peer is required to have rcp command if not set in options.
+ """
+ config = Config()
+ config.options = OptionsConfig(backupUser="ken", rcpCommand="rcp", rshCommand="rsh", cbackCommand="cback", managedActions=["collect"], )
+ config.peers = PeersConfig()
+ config.peers.localPeers = []
+ config.peers.remotePeers = [ RemotePeer(name="remote", collectDir="/path"), ]
+ config._validatePeers()
+
+ config.options.rcpCommand = None
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.peers.remotePeers[0].rcpCommand = "rcp"
+ config._validatePeers()
+
+ def testValidate_075(self):
+ """
+ Confirm that remote managed peer is required to have rsh command if not set in options.
+ """
+ config = Config()
+ config.options = OptionsConfig(backupUser="ken", rcpCommand="rcp", rshCommand="rsh", cbackCommand="cback", managedActions=["collect"], )
+ config.peers = PeersConfig()
+ config.peers.localPeers = []
+ config.peers.remotePeers = [ RemotePeer(name="remote", collectDir="/path"), ]
+ config._validatePeers()
+
+ config.options.rshCommand = None
+ config._validatePeers()
+
+ config.peers.remotePeers[0].managed = True
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.peers.remotePeers[0].rshCommand = "rsh"
+ config._validatePeers()
+
+ def testValidate_076(self):
+ """
+ Confirm that remote managed peer is required to have cback command if not set in options.
+ """
+ config = Config()
+ config.options = OptionsConfig(backupUser="ken", rcpCommand="rcp", rshCommand="rsh", cbackCommand="cback", managedActions=["collect"], )
+ config.peers = PeersConfig()
+ config.peers.localPeers = []
+ config.peers.remotePeers = [ RemotePeer(name="remote", collectDir="/path"), ]
+ config._validatePeers()
+
+ config.options.cbackCommand = None
+ config._validatePeers()
+
+ config.peers.remotePeers[0].managed = True
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.peers.remotePeers[0].cbackCommand = "cback"
+ config._validatePeers()
+
+ def testValidate_077(self):
+ """
+ Confirm that remote managed peer is required to have managed actions list if not set in options.
+ """
+ config = Config()
+ config.options = OptionsConfig(backupUser="ken", rcpCommand="rcp", rshCommand="rsh", cbackCommand="cback", managedActions=["collect"], )
+ config.peers = PeersConfig()
+ config.peers.localPeers = []
+ config.peers.remotePeers = [ RemotePeer(name="remote", collectDir="/path"), ]
+ config._validatePeers()
+
+ config.options.managedActions = None
+ config._validatePeers()
+
+ config.peers.remotePeers[0].managed = True
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.options.managedActions = []
+ self.failUnlessRaises(ValueError, config._validatePeers)
+
+ config.peers.remotePeers[0].managedActions = ["collect", ]
+ config._validatePeers()
+
+
############################
# Test parsing of documents
############################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|