Bug 1311199 - Don't assume `stage_server` config properties exist when creating the mach build environment; r?catlee draft
authorManish Goregaokar <manishearth@gmail.com>
Fri, 04 Nov 2016 10:16:41 -0700
changeset 434003 f4098d0180a5e84c0a83d6525daefd04bf47683c
parent 433311 3b80868f7a8fe0361918a814fbbbfb9308ae0c0a
child 536008 3ee9546d0c92efc94b54d829ad60292d4c0f7b03
push id34707
push userbmo:manishearth@gmail.com
push dateFri, 04 Nov 2016 18:48:37 +0000
reviewerscatlee
bugs1311199
milestone52.0a1
Bug 1311199 - Don't assume `stage_server` config properties exist when creating the mach build environment; r?catlee MozReview-Commit-ID: LtmvWpFBDje
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -903,25 +903,25 @@ or run without that action (ie: --no-{ac
 
     def query_mach_build_env(self, multiLocale=None):
         c = self.config
         if multiLocale is None and self.query_is_nightly():
             multiLocale = c.get('multi_locale', False)
         mach_env = {}
         if c.get('upload_env'):
             mach_env.update(c['upload_env'])
-            if 'UPLOAD_HOST' in mach_env:
+            if 'UPLOAD_HOST' in mach_env and 'stage_server' in c:
                 mach_env['UPLOAD_HOST'] = mach_env['UPLOAD_HOST'] % {
                     'stage_server': c['stage_server']
                 }
-            if 'UPLOAD_USER' in mach_env:
+            if 'UPLOAD_USER' in mach_env and 'stage_username' in c:
                 mach_env['UPLOAD_USER'] = mach_env['UPLOAD_USER'] % {
                     'stage_username': c['stage_username']
                 }
-            if 'UPLOAD_SSH_KEY' in mach_env:
+            if 'UPLOAD_SSH_KEY' in mach_env and 'stage_ssh_key' in c:
                 mach_env['UPLOAD_SSH_KEY'] = mach_env['UPLOAD_SSH_KEY'] % {
                     'stage_ssh_key': c['stage_ssh_key']
                 }
 
         if self.query_is_nightly():
             mach_env['LATEST_MAR_DIR'] = c['latest_mar_dir'] % {
                 'branch': self.branch
             }