fixing hardcoded path (wow...)

This commit is contained in:
Ryan Tucker 2011-06-10 20:26:58 -04:00
parent 6360655bf8
commit 45360b0b1a
2 changed files with 15 additions and 13 deletions

View file

@ -11,6 +11,7 @@
# accesskey = 'amazon aws access key' # accesskey = 'amazon aws access key'
# sharedkey = 'amazon aws shared key' # sharedkey = 'amazon aws shared key'
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it' # gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
# speedfile = '/path/to/a/speed-limit-file'
import base64 import base64
import glob 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)) logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len))
try: if hasattr(secrets, 'speedfile'):
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline()) try:
newspeed = int((newkbits/float(8))*1024) newkbits = int(open(secrets.speedfile, 'r').readline())
if newspeed != self.speed: newspeed = int((newkbits/float(8))*1024)
self.delayfactor = 1 if newspeed != self.speed:
self.speed = newspeed self.delayfactor = 1
logger.debug('Setting new speed! %i bytes/second' % newspeed) self.speed = newspeed
self.lastblocktargettime = 0 logger.debug('Setting new speed! %i bytes/second' % newspeed)
except IOError: self.lastblocktargettime = 0
logger.debug('No Semaphore file for new speed') except IOError:
except ValueError: logger.debug('IO Error opening semaphore file')
logger.debug('Semaphore file invalid') except ValueError:
logger.debug('Semaphore file invalid')
self.lastdebug = time.time() self.lastdebug = time.time()

View file

@ -2,4 +2,4 @@
# accesskey = 'amazon aws access key' # accesskey = 'amazon aws access key'
# sharedkey = 'amazon aws shared key' # sharedkey = 'amazon aws shared key'
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it' # 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'