diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-08-29 17:04:11 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-08-29 17:04:11 -0400 |
commit | bf8574399c9f21ac5279230b1875fd843768f7cf (patch) | |
tree | 74dd938334918f594454da5e21ab51215cc97490 | |
parent | 2d2c86e713fb523e7a17c3d343a7c8bf68cf4a53 (diff) | |
download | b4-bf8574399c9f21ac5279230b1875fd843768f7cf.tar.gz |
Improve sendemail identity handling
The sendemail sections are supposed to be fall-throughs where a named
section overrides the values provided by the global section. This
implements the required logic to be compliant with git.
Suggested-by: Rob Herring <robh@kernel.org>
Link: https://msgid.link/20220825182506.1449442-1-robh@kernel.org
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 8203a90..fcb31ed 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2755,11 +2755,14 @@ def read_template(tptfile): def get_smtp(identity: Optional[str] = None, dryrun: bool = False) -> Tuple[Union[smtplib.SMTP, smtplib.SMTP_SSL, None], str]: + # Get the default settings first + _basecfg = get_config_from_git(r'sendemail\.[^.]+$') if identity: - sconfig = get_config_from_git(rf'sendemail\.{identity}\..*') + # Use this identity to override what we got from the default one + sconfig = get_config_from_git(rf'sendemail\.{identity}\..*', defaults=_basecfg) sectname = f'sendemail.{identity}' else: - sconfig = get_config_from_git(rf'sendemail\..*') + sconfig = _basecfg sectname = 'sendemail' if not len(sconfig): raise smtplib.SMTPException('Unable to find %s settings in any applicable git config' % sectname) |