aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-01-19 12:16:41 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-01-19 12:16:41 -0500
commitf12400ed4d4fa84484a07489446c9aebaad5bdb5 (patch)
tree71b349283cc26f2a5884f3a146654b144d05a45a
parente4b190ae7ad09184cfddd517f9f92855f2d09628 (diff)
downloadb4-f12400ed4d4fa84484a07489446c9aebaad5bdb5.tar.gz
ez: when we find an smtp configuration, always use that
This allows us to define a patch submission endpoint as a default setting, but use sendemail configs when they are defined. Suggested-by: Rob Herring <robh@kernel.org> Link: https://msgid.link/CAL_JsqLU8qb-aNGDZ45mq8_e=Oin6QY+8vBdfyUSPBFDVCFJEA@mail.gmail.com Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/b4/ez.py b/b4/ez.py
index 2b6c0d6..bdb8a86 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1390,15 +1390,20 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
pathlib.Path(cmdargs.output_dir).mkdir(parents=True, exist_ok=True)
sconfig = b4.get_sendemail_config()
- endpoint = config.get('send-endpoint-web', '')
- if not re.search(r'^https?://', endpoint):
- endpoint = None
- if not endpoint and not sconfig.get('smtpserver'):
- # Use the default endpoint if we are in the kernel repo
- topdir = b4.git_get_toplevel()
- if os.path.exists(os.path.join(topdir, 'Kconfig')):
- logger.debug('No sendemail configs found, will use the default web endpoint')
- endpoint = DEFAULT_ENDPOINT
+ # If we have an smtp server defined, always use that instead of the endpoint
+ # we may make this configurable in the future, but this almost always makes sense
+ endpoint = None
+ if not sconfig.get('smtpserver'):
+ endpoint = config.get('send-endpoint-web', '')
+ if not re.search(r'^https?://', endpoint):
+ logger.debug('Endpoint does not start with https, ignoring: %s', endpoint)
+ endpoint = None
+ if not endpoint:
+ # Use the default endpoint if we are in the kernel repo
+ topdir = b4.git_get_toplevel()
+ if os.path.exists(os.path.join(topdir, 'Kconfig')):
+ logger.debug('No sendemail configs found, will use the default web endpoint')
+ endpoint = DEFAULT_ENDPOINT
# Give the user the last opportunity to bail out
if not cmdargs.dryrun: