Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
* [PATCH b4] ez: Add a --web arg to force web endpoint
@ 2023-08-01 15:03 Joel Granados via B4 Relay
  2023-08-01 16:14 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Granados via B4 Relay @ 2023-08-01 15:03 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev, Joel Granados

From: Joel Granados <j.granados@samsung.com>

Make it easier to prefer going through the web endpoint by adding an
argument that will force this path. This is for users that want to use
B4 for preparing and sharing patchsets over mail and need an argument to
activate the web endpoint whenever needed, but want to default to smtp
server for the rest.

Signed-off-by: Joel Granados <j.granados@samsung.com>
---
 b4/command.py             |  2 ++
 b4/ez.py                  |  4 +---
 docs/contributor/send.rst | 10 ++++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/b4/command.py b/b4/command.py
index 1ae73d2..15ca370 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -330,6 +330,8 @@ def setup_parser() -> argparse.ArgumentParser:
                           help='Initiate a new web authentication request')
     ag_sendh.add_argument('--web-auth-verify', dest='auth_verify', metavar='VERIFY_TOKEN',
                           help='Submit the token received via verification email')
+    ag_sendh.add_argument('--web', dest='send_web', action='store_true', default=False,
+                          help="Force the send command to go through the web endpoint")
     sp_send.set_defaults(func=cmd_send)
 
     return parser
diff --git a/b4/ez.py b/b4/ez.py
index 3799e07..e38827f 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1459,10 +1459,8 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
         pathlib.Path(cmdargs.output_dir).mkdir(parents=True, exist_ok=True)
 
     sconfig = b4.get_sendemail_config()
-    # 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'):
+    if not sconfig.get('smtpserver') or cmdargs.send_web:
         endpoint = config.get('send-endpoint-web', '')
         if not re.search(r'^https?://', endpoint):
             logger.debug('Endpoint does not start with https, ignoring: %s', endpoint)
diff --git a/docs/contributor/send.rst b/docs/contributor/send.rst
index 9be8d1c..ca7f082 100644
--- a/docs/contributor/send.rst
+++ b/docs/contributor/send.rst
@@ -124,9 +124,10 @@ You should now be able to send patches via this web submission endpoint.
 
 Using your own SMTP server
 --------------------------
-B4 will use the ``sendemail`` section from your git configuration, but
-it only supports the most common subset of options. The vast majority of
-servers will only need the following settings::
+If there is a ``sendmail`` section in your git configuration, B4 will try use
+that by default instead of the web endpoint. Only the most common subset of
+options are supported. The vast majority of servers will only need the
+following settings::
 
     [sendemail]
        smtpServer = smtp.example.org
@@ -136,7 +137,8 @@ servers will only need the following settings::
        smtpPass = [omitted]
 
 You can also set up msmtp or a similar tool and specify the path to the
-``sendmail``-compliant binary as the value for ``smtpServer``.
+``sendmail``-compliant binary as the value for ``smtpServer``. You can force B4
+to use the web endpoint by passing ``--web`` to the send command.
 
 Sending your patches
 --------------------

---
base-commit: 099c9b47b39b6076752b8c757872080fad8fae56
change-id: 20230801-jag-add_web_switch-42a4287768ed

Best regards,
-- 
Joel Granados <j.granados@samsung.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH b4] ez: Add a --web arg to force web endpoint
  2023-08-01 15:03 [PATCH b4] ez: Add a --web arg to force web endpoint Joel Granados via B4 Relay
@ 2023-08-01 16:14 ` Konstantin Ryabitsev
  2023-08-02  7:30   ` Joel Granados
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Ryabitsev @ 2023-08-01 16:14 UTC (permalink / raw)
  To: j.granados; +Cc: Kernel.org Tools

On Tue, Aug 01, 2023 at 05:03:36PM +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados <j.granados@samsung.com>
> 
> Make it easier to prefer going through the web endpoint by adding an
> argument that will force this path. This is for users that want to use
> B4 for preparing and sharing patchsets over mail and need an argument to
> activate the web endpoint whenever needed, but want to default to smtp
> server for the rest.

Okay, that looks good to me, but can you please make two changes:

> @@ -330,6 +330,8 @@ def setup_parser() -> argparse.ArgumentParser:
>                            help='Initiate a new web authentication request')
>      ag_sendh.add_argument('--web-auth-verify', dest='auth_verify', metavar='VERIFY_TOKEN',
>                            help='Submit the token received via verification email')
> +    ag_sendh.add_argument('--web', dest='send_web', action='store_true', default=False,
> +                          help="Force the send command to go through the web endpoint")

1. It doesn't really belong in this argument group (it's just for
   setting up authentication and says so in the title). You can just put this
   switch with the main arguments, perhaps as the last entry.
2. Call it --use-web-endpoint instead of just --web

Thanks!

-K

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH b4] ez: Add a --web arg to force web endpoint
  2023-08-01 16:14 ` Konstantin Ryabitsev
@ 2023-08-02  7:30   ` Joel Granados
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Granados @ 2023-08-02  7:30 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: Kernel.org Tools

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

On Tue, Aug 01, 2023 at 12:14:22PM -0400, Konstantin Ryabitsev wrote:
> On Tue, Aug 01, 2023 at 05:03:36PM +0200, Joel Granados via B4 Relay wrote:
> > From: Joel Granados <j.granados@samsung.com>
> > 
> > Make it easier to prefer going through the web endpoint by adding an
> > argument that will force this path. This is for users that want to use
> > B4 for preparing and sharing patchsets over mail and need an argument to
> > activate the web endpoint whenever needed, but want to default to smtp
> > server for the rest.
> 
> Okay, that looks good to me, but can you please make two changes:
> 
> > @@ -330,6 +330,8 @@ def setup_parser() -> argparse.ArgumentParser:
> >                            help='Initiate a new web authentication request')
> >      ag_sendh.add_argument('--web-auth-verify', dest='auth_verify', metavar='VERIFY_TOKEN',
> >                            help='Submit the token received via verification email')
> > +    ag_sendh.add_argument('--web', dest='send_web', action='store_true', default=False,
> > +                          help="Force the send command to go through the web endpoint")
> 
> 1. It doesn't really belong in this argument group (it's just for
>    setting up authentication and says so in the title). You can just put this
totally missed that :), thx for the feedback
>    switch with the main arguments, perhaps as the last entry.
I have added it to the main args under --no-stdin.

Now that it is in the main args, I'll change the argument documentation
from "Force the send command to go through the web endpoint" to "Force
going through the web endpoint".

> 2. Call it --use-web-endpoint instead of just --web
sure thing

> 
> Thanks!
> 
> -K

-- 

Joel Granados

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-02  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 15:03 [PATCH b4] ez: Add a --web arg to force web endpoint Joel Granados via B4 Relay
2023-08-01 16:14 ` Konstantin Ryabitsev
2023-08-02  7:30   ` Joel Granados

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox