From 45360b0b1a7766afe978c03749c9567f4559f893 Mon Sep 17 00:00:00 2001 From: Ryan Tucker Date: Fri, 10 Jun 2011 20:26:58 -0400 Subject: [PATCH] fixing hardcoded path (wow...) --- BackupPC_archiveHost_s3 | 26 ++++++++++++++------------ secrets.py.orig | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/BackupPC_archiveHost_s3 b/BackupPC_archiveHost_s3 index 16feeb1..fb58604 100755 --- a/BackupPC_archiveHost_s3 +++ b/BackupPC_archiveHost_s3 @@ -11,6 +11,7 @@ # accesskey = 'amazon aws access key' # sharedkey = 'amazon aws shared key' # gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it' +# speedfile = '/path/to/a/speed-limit-file' import base64 import glob @@ -141,18 +142,19 @@ class SlowFile: logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len)) - try: - newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline()) - newspeed = int((newkbits/float(8))*1024) - if newspeed != self.speed: - self.delayfactor = 1 - self.speed = newspeed - logger.debug('Setting new speed! %i bytes/second' % newspeed) - self.lastblocktargettime = 0 - except IOError: - logger.debug('No Semaphore file for new speed') - except ValueError: - logger.debug('Semaphore file invalid') + if hasattr(secrets, 'speedfile'): + try: + newkbits = int(open(secrets.speedfile, 'r').readline()) + newspeed = int((newkbits/float(8))*1024) + if newspeed != self.speed: + self.delayfactor = 1 + self.speed = newspeed + logger.debug('Setting new speed! %i bytes/second' % newspeed) + self.lastblocktargettime = 0 + except IOError: + logger.debug('IO Error opening semaphore file') + except ValueError: + logger.debug('Semaphore file invalid') self.lastdebug = time.time() diff --git a/secrets.py.orig b/secrets.py.orig index 620d97d..bbcea5b 100644 --- a/secrets.py.orig +++ b/secrets.py.orig @@ -2,4 +2,4 @@ # accesskey = 'amazon aws access key' # sharedkey = 'amazon aws shared key' # gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it' - +# speedfile = 'path to a file that has a max upload speed in kbits/sec'