Skip to content

Instantly share code, notes, and snippets.

@rail
Created December 1, 2011 15:59
Show Gist options
  • Save rail/1417786 to your computer and use it in GitHub Desktop.
Save rail/1417786 to your computer and use it in GitHub Desktop.
process/factory.py | 8 ++------
steps/signing.py | 4 ++--
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/process/factory.py b/process/factory.py
index 18131a5..61e5ac3 100644
--- a/process/factory.py
+++ b/process/factory.py
@@ -1125,31 +1125,27 @@ class MercurialBuildFactory(MozillaBuildFactory):
name='cat_mozconfig',
command=['cat', '.mozconfig'],
))
def addGetTokenSteps(self):
server_cert = os.path.join(
os.path.dirname(build.paths.__file__),
'../../../release/signing/host.cert')
- token = WithProperties('%(basedir)s/build/token')
- nonce = WithProperties('%(basedir)s/build/nonce')
- if self.platform.startswith('win'):
- token = "build/token"
- nonce = "build/nonce"
+ token = "build/token"
+ nonce = "build/nonce"
self.addStep(ShellCommand(
command=['rm', '-f', nonce],
workdir='.',
name='rm_nonce',
description=['remove', 'old', 'nonce'],
))
self.addStep(SigningServerAuthenication(
servers=self.signingServers,
server_cert=server_cert,
- s="",
slavedest=token,
workdir='.',
name='download_token',
))
def addDoBuildSteps(self):
workdir=WithProperties('%(basedir)s/build')
if self.platform.startswith('win'):
diff --git a/steps/signing.py b/steps/signing.py
index 29c7415..00b8cc3 100644
--- a/steps/signing.py
+++ b/steps/signing.py
@@ -42,17 +42,17 @@ class SigningServerAuthenication(StringDownload):
uri = None
username = None
password = None
d = None
interrupted = False
def __init__(self, servers, server_cert, duration=6*3600, attempts=5,
sleeptime=60, **kwargs):
- StringDownload.__init__(self, **kwargs)
+ StringDownload.__init__(self, s='', **kwargs)
self.addFactoryArguments(servers=servers, server_cert=server_cert,
duration=duration)
self.servers = list(servers)
self.server_cert = server_cert
self.duration = duration
self.attempts = attempts
self.sleeptime = sleeptime
@@ -63,17 +63,16 @@ class SigningServerAuthenication(StringDownload):
base64string = '%s:%s' % (credentials[0], credentials[1])
base64string = base64string.encode("base64").strip()
headers['Authorization'] = 'Basic %s' % base64string
return headers
def start(self):
if self.interrupted:
self.failed(Failure(Exception('Interrupted')))
- StringDownload.interrupt(self, 'Interrupted')
return
self.current_attempt += 1
if self.current_attempt > self.attempts:
if len(self.servers) < 1:
self.failed(Failure(Exception(
'No more signing servers to try.')))
@@ -113,8 +112,9 @@ class SigningServerAuthenication(StringDownload):
def downloadSignature(self, res):
self.s = res
StringDownload.start(self)
def interrupt(self, reason='Interrupted'):
if not self.interrupted:
self.interrupted = True
+ StringDownload.interrupt(self, 'Interrupted')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment