From 575e6766f2eeab4d3f8b2f0d57fa0fda519f4369 Mon Sep 17 00:00:00 2001 From: martiniss Date: Tue, 28 Jun 2016 21:46:57 -0700 Subject: [PATCH] bot_update: Allow patch_oauth2 to work in kitchen site config is not present on builders which use kitchen, so we need to use credentials provided by puppet in the /creds directory. BUG=624212 TBR=hinoka Review-Url: https://codereview.chromium.org/2108073002 --- recipe_modules/bot_update/api.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py index 8b3a35b0b..2a40dfe9f 100644 --- a/recipe_modules/bot_update/api.py +++ b/recipe_modules/bot_update/api.py @@ -57,12 +57,14 @@ class BotUpdateApi(recipe_api.RecipeApi): patch=True, update_presentation=True, force=False, patch_root=None, no_shallow=False, with_branch_heads=False, refs=None, - patch_oauth2=False, + patch_oauth2=False, use_site_config_creds=True, output_manifest=True, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, **kwargs): """ Args: + use_site_config_creds: If the oauth2 credentials are in the buildbot + site_config. See crbug.com/624212 for more information. gclient_config: The gclient configuration to use when running bot_update. If omitted, the current gclient configuration is used. rietveld: The rietveld server to use. If omitted, will infer from @@ -119,10 +121,16 @@ class BotUpdateApi(recipe_api.RecipeApi): # Point to the oauth2 auth files if specified. # These paths are where the bots put their credential files. if patch_oauth2: - email_file = self.m.path['build'].join( - 'site_config', '.rietveld_client_email') - key_file = self.m.path['build'].join( - 'site_config', '.rietveld_secret_key') + # TODO(martiniss): remove this hack :(. crbug.com/624212 + if use_site_config_creds: + email_file = self.m.path['build'].join( + 'site_config', '.rietveld_client_email') + key_file = self.m.path['build'].join( + 'site_config', '.rietveld_secret_key') + else: #pragma: no cover + #TODO(martiniss): make this use path.join, so it works on windows + email_file = '/creds/rietveld/client_email' + key_file = '/creds/rietveld/secret_key' else: email_file = key_file = None