Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: recipe_modules/bot_update/api.py

Issue 2294413002: bot_update: add --auth-refresh-token-json passthrough for apply_issue (Closed)
Patch Set: More coverage Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | recipe_modules/bot_update/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/bot_update/api.py
diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py
index f1f31bd1c3458a65b4c62d3d0d11e8f20314cc03..512a89e414f7c783bd1d32466064054653d14a8d 100644
--- a/recipe_modules/bot_update/api.py
+++ b/recipe_modules/bot_update/api.py
@@ -66,7 +66,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
patch=True, update_presentation=True,
patch_root=None, no_shallow=False,
with_branch_heads=False, refs=None,
- patch_oauth2=False, use_site_config_creds=True,
+ patch_oauth2=False, oauth2_json=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,
@@ -91,6 +92,9 @@ class BotUpdateApi(recipe_api.RecipeApi):
assert cfg is not None, (
'missing gclient_config or forgot api.gclient.set_config(...) before?')
+ # Only one of these should exist.
+ assert not (oauth2_json and patch_oauth2)
+
# Construct our bot_update command. This basically be inclusive of
# everything required for bot_update to know:
root = patch_root
@@ -123,7 +127,13 @@ 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:
+ oauth2_json_file = email_file = key_file = None
+ if oauth2_json:
+ if self.m.platform.is_win:
+ oauth2_json_file = 'C:\\creds\\refresh_tokens\\rietveld.json'
+ else:
+ oauth2_json_file = '/creds/refresh_tokens/rietveld.json'
+ elif patch_oauth2:
# TODO(martiniss): remove this hack :(. crbug.com/624212
if use_site_config_creds:
email_file = self.m.path['build'].join(
@@ -134,8 +144,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
#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
# Allow patch_project's revision if necessary.
# This is important for projects which are checked out as DEPS of the
@@ -160,6 +168,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
['--gerrit_ref', gerrit_ref],
['--apply_issue_email_file', email_file],
['--apply_issue_key_file', key_file],
+ ['--apply_issue_oauth2_file', oauth2_json_file],
# Hookups to JSON output back into recipes.
['--output_json', self.m.json.output()],]
« no previous file with comments | « no previous file | recipe_modules/bot_update/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698