Nishuuzz opened a new issue, #55269:
URL: https://github.com/apache/arrow/issues/55269

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `archery crossbow notify-token-expiration` raises a `TypeError` before it 
builds a message, so the command cannot run at all, and its `--sender-name`, 
`--sender-email` and `--recipient-email` options are never passed on.
   
   `dev/archery/archery/crossbow/cli.py`:
   
   ```python
       report = TokenExpirationReport(token_expiration_date, days_left)
       email_report = TokenExpirationEmailReport(report)
   ```
   
   `TokenExpirationEmailReport.__init__` is `def __init__(self, **kwargs)`, so 
the positional argument is rejected:
   
   ```
   TypeError: TokenExpirationEmailReport.__init__() takes 1 positional argument 
but 2 were given
   ```
   
   This happens before the `if send:` branch, so the dry-run path fails the 
same way:
   
   ```console
   $ archery crossbow notify-token-expiration \
       --sender-name 'Crossbow Reporter' \
       --sender-email [email protected] \
       --recipient-email [email protected]
   TypeError: TokenExpirationEmailReport.__init__() takes 1 positional argument 
but 2 were given
   ```
   
   There is a second problem behind it. `EmailReport.fields` is
   
   ```python
       fields = [
           'report',
           'sender_name',
           'sender_email',
           'recipient_email',
       ]
   ```
   
   and `Report.__init__` raises `ValueError(f'Missing keyword argument 
{field}')` for anything missing, so even written as 
`TokenExpirationEmailReport(report=report)` it fails with `ValueError: Missing 
keyword argument sender_name`. `EmailReport.render()` needs those three to set 
the `From` and `To` headers, and `ReportUtils.send_email()` takes no addresses 
of its own — it just hands the rendered message to `smtplib`.
   
   ### Where it came from
   
   `288cd43bdc` (GH-48623, #48624, first released in 24.0.0) replaced
   
   ```python
       email_report = EmailReport(
           report=TokenExpirationReport(
               token_expiration_date or "ALREADY_EXPIRED", days_left),
           sender_name=sender_name,
           sender_email=sender_email,
           recipient_email=recipient_email
       )
   ```
   
   with the positional call above when it introduced the 
`TokenExpirationEmailReport` subclass. The sibling `nightly-report` command was 
converted in the same commit and still passes all four keyword arguments, so 
only this command is affected.
   
   Nothing in the repository invokes `notify-token-expiration`, which is 
presumably why this has gone unnoticed.
   
   ### Component(s)
   
   Developer Tools
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to