-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[arxivce-2619] Use alternate "sendmail" to talk to non-local MTA - mail.arxiv.org #737
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -343,7 +343,7 @@ class SubmissionFilesState: | |
publish_type: str | ||
version: str # from the publish event | ||
log_extra: dict | ||
submission_source: typing.Optional[dict] | ||
submission_source: typing.Optional[str] | ||
published_versions: typing.List[dict] | ||
|
||
_top_levels: dict | ||
|
@@ -770,7 +770,7 @@ def submission_message_to_file_state(data: dict, log_extra: dict, ask_webnode: b | |
source_mtime=file_state.get_submission_mtime()) | ||
|
||
except sync_published_to_gcp.WebnodeException as exc: | ||
raise MissingGeneratedFile("Failed to generate %s", pdf_path) from exc | ||
raise MissingGeneratedFile("Failed to generate %s" % pdf_path) from exc | ||
|
||
except ReadTimeout as exc: | ||
# This happens when failed to talk to webnode | ||
|
@@ -810,7 +810,7 @@ def submission_message_to_file_state(data: dict, log_extra: dict, ask_webnode: b | |
file_state.register_files('html-files', html_files) | ||
|
||
except sync_published_to_gcp.WebnodeException as _exc: | ||
raise MissingGeneratedFile("Failed to generate %s", html_path) from _exc | ||
raise MissingGeneratedFile("Failed to generate %s" % html_path) from _exc | ||
|
||
except Exception as _exc: | ||
logger.warning("ensure_html: %s", file_state.vxid.ids, extra=log_extra, | ||
|
@@ -955,10 +955,22 @@ def submission_callback(message: Message) -> None: | |
help_needed = os.environ.get("TEX_COMPILATION_RECIPIENT", "[email protected]") | ||
subject = f"Uploading of {paper_id}v{version} failed" | ||
mail_body = f"Hello EUST,\nSubmission uploading for {paper_id}v{version} has failed. Please resolve the issue.\n\nThis message is generated by a bot on arxiv-sync.serverfarm.cornell.edu.\n" | ||
cmd = ["/usr/bin/mail", "-r", "[email protected]", "-s", subject, help_needed] | ||
SENDER = os.environ.get("SENDER", "[email protected]") | ||
SMTP_SERVER = os.environ.get("SMTP_SERVER", "mail.arxiv.org") | ||
SMTP_PORT = os.environ.get("SMTP_PORT", "25") | ||
cmd = ["/usr/local/bin/arxiv-mail", | ||
"-t", help_needed, | ||
"-f", SENDER, | ||
"-m", SMTP_SERVER, | ||
"-p", SMTP_PORT, | ||
"-s", subject, | ||
] | ||
# using sendmail | ||
# cmd = ["/usr/bin/mail", "-r", "[email protected]", "-s", subject, help_needed] | ||
|
||
mail = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
try: | ||
mail.communicate(mail_body, timeout=60) | ||
mail.communicate(mail_body.encode('utf-8'), timeout=60) | ||
if mail.returncode == 0: | ||
# Once the email message is sent, done here. | ||
message.ack() | ||
|
@@ -994,7 +1006,7 @@ def submission_callback(message: Message) -> None: | |
|
||
|
||
|
||
def sync_to_gcp(state: SubmissionFilesState, log_extra: dict) -> bool: | ||
def sync_to_gcp(state: SubmissionFilesState, log_extra: dict) -> None: | ||
""" | ||
From the submission file state, copy the ones that should bu uploaded. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mail_body
above is ascii - does the.encode
call make any difference? Or is it future-proofing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body text is no doubt 7-bit ascii. dosen't hurt to use utf-8. So "future proof" if you like.