Commit graph

188 commits

Author SHA1 Message Date
Lars Eggert 6eabd4a3a1
chore: Use codespell to fix typos in comments. (#4794)
First part of replacement of #4651
2022-11-28 10:36:36 -06:00
Jennifer Richards a653582cf7
fix: timezone fixes from last few comparisons with tzaware-obe 2022-09-28 13:21:50 -03:00
Jennifer Richards ebebdbed3e
refactor: replace datetime.now and datetime.today with timezone.now (#4211)
* refactor: replace datetime.now with timezone.now

* refactor: migrate model fields to use timezone.now as default

* refactor: replace datetime.today with timezone.now

datetime.datetime.today() is equivalent to datetime.datetime.now(); both
return a naive datetime with the current local time.

* refactor: rephrase datetime.now(tz) as timezone.now().astimezone(tz)

This is effectively the same, but is less likely to encourage accidental
use of naive datetimes.

* refactor: revert datetime.today() change to old migrations

* refactor: change a missed datetime.now to timezone.now

* chore: renumber timezone_now migration

* chore: renumber migrations
2022-08-25 13:45:16 -03:00
Jennifer Richards 3705bedfcd
feat: Celery support and asynchronous draft submission API (#4037)
* ci: add Dockerfile and action to build celery worker image

* ci: build celery worker on push to jennifer/celery branch

* ci: also build celery worker for main branch

* ci: Add comment to celery Dockerfile

* chore: first stab at a celery/rabbitmq docker-compose

* feat: add celery configuration and test task / endpoint

* chore: run mq/celery containers for dev work

* chore: point to ghcr.io image for celery worker

* refactor: move XML parsing duties into XMLDraft

Move some PlaintextDraft methods into the Draft base class and
implement for the XMLDraft class. Use xml2rfc code from ietf.submit
as a model for the parsing.

This leaves some mismatch between the PlaintextDraft and the Draft
class spec for the get_author_list() method to be resolved.

* feat: add api_upload endpoint and beginnings of async processing

This adds an api_upload() that behaves analogously to the api_submit()
endpoint. Celery tasks to handle asynchronous processing are added but
are not yet functional enough to be useful.

* perf: index Submission table on submission_date

This substantially speeds up submission rate threshold checks.

* feat: remove existing files when accepting a new submission

After checking that a submission is not in progress, remove any files
in staging that have the same name/rev with any extension. This should
guard against stale files confusing the submission process if the
usual cleanup fails or is skipped for some reason.

* refactor: make clear that deduce_group() uses only the draft name

* refactor: extract only draft name/revision in clean() method

Minimizing the amount of validation done when accepting a file. The
data extraction will be moved to asynchronous processing.

* refactor: minimize checks and data extraction in api_upload() view

* ci: fix dockerfiles to match sandbox testing

* ci: tweak celery container docker-compose settings

* refactor: clean up Draft parsing API and usage

  * remove get_draftname() from Draft api; set filename during init
  * further XMLDraft work
    - remember xml_version after parsing
    - extract filename/revision during init
    - comment out long broken get_abstract() method
  * adjust form clean() method to use changed API

* feat: flesh out async submission processing

First basically working pass!

* feat: add state name for submission being validated asynchronously

* feat: cancel submissions that async processing can't handle

* refactor: simplify/consolidate async tasks and improve error handling

* feat: add api_submission_status endpoint

* refactor: return JSON from submission api endpoints

* refactor: reuse cancel_submission method

* refactor: clean up error reporting a bit

* feat: guard against cancellation of a submission while validating

Not bulletproof but should prevent

* feat: indicate that a submission is still being validated

* fix: do not delete submission files after creating them

* chore: remove debug statement

* test: add tests of the api_upload and api_submission_status endpoints

* test: add tests and stubs for async side of submission handling

* fix: gracefully handle (ignore) invalid IDs in async submit task

* test: test process_uploaded_submission method

* fix: fix failures of new tests

* refactor: fix type checker complaints

* test: test submission_status view of submission in "validating" state

* fix: fix up migrations

* fix: use the streamlined SubmissionBaseUploadForm for api_upload

* feat: show submission history event timestamp as mouse-over text

* fix: remove 'manual' as next state for 'validating' submission state

* refactor: share SubmissionBaseUploadForm code with Deprecated version

* fix: validate text submission title, update a couple comments

* chore: disable requirements updating when celery dev container starts

* feat: log traceback on unexpected error during submission processing

* feat: allow secretariat to cancel "validating" submission

* feat: indicate time since submission on the status page

* perf: check submission rate thresholds earlier when possible

No sense parsing details of a draft that is going to be dropped regardless
of those details!

* fix: create Submission before saving to reduce race condition window

* fix: call deduce_group() with filename

* refactor: remove code lint

* refactor: change the api_upload URL to api/submission

* docs: update submission API documentation

* test: add tests of api_submission's text draft consistency checks

* refactor: rename api_upload to api_submission to agree with new URL

* test: test API documentation and submission thresholds

* fix: fix a couple api_submission view renames missed in templates

* chore: use base image + add arm64 support

* ci: try to fix workflow_dispatch for celery worker

* ci: another attempt to fix workflow_dispatch

* ci: build celery image for submit-async branch

* ci: fix typo

* ci: publish celery worker to ghcr.io/painless-security

* ci: install python requirements in celery image

* ci: fix up requirements install on celery image

* chore: remove XML_LIBRARY references that crept back in

* feat: accept 'replaces' field in api_submission

* docs: update api_submission documentation

* fix: remove unused import

* test: test "replaces" validation for submission API

* test: test that "replaces" is set by api_submission

* feat: trap TERM to gracefully stop celery container

* chore: tweak celery/mq settings

* docs: update installation instructions

* ci: adjust paths that trigger celery worker image  build

* ci: fix branches/repo names left over from dev

* ci: run manage.py check when initializing celery container

Driver here is applying the patches. Starting the celery workers
also invokes the check task, but this should cause a clearer failure
if something fails.

* docs: revise INSTALL instructions

* ci: pass filename to pip update in celery container

* docs: update INSTALL to include freezing pip versions

Will be used to coordinate package versions with the celery
container in production.

* docs: add explanation of frozen-requirements.txt

* ci: build image for sandbox deployment

* ci: add additional build trigger path

* docs: tweak INSTALL

* fix: change INSTALL process to stop datatracker before running migrations

* chore: use ietf.settings for manage.py check in celery container

* chore: set uid/gid for celery worker

* chore: create user/group in celery container if needed

* chore: tweak docker compose/init so celery container works in dev

* ci: build mq docker image

* fix: move rabbitmq.pid to writeable location

* fix: clear password when CELERY_PASSWORD is empty

Setting to an empty password is really not a good plan!

* chore: add shutdown debugging option to celery image

* chore: add django-celery-beat package

* chore: run "celery beat" in datatracker-celery image

* chore: fix docker image name

* feat: add task to cancel stale submissions

* test: test the cancel_stale_submissions task

* chore: make f-string with no interpolation a plain string

Co-authored-by: Nicolas Giard <github@ngpixel.com>
Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2022-08-22 13:29:31 -05:00
Robert Sparks 3d529bad20
fix: improve validation of submission version. Add submission name validation tests.
Co-authored-by: russhousley <housley@vigilsec.com>
2022-03-22 14:51:25 -03:00
Robert Sparks 9df659b06e
fix: better draft name validation. Fixes #3539. (#3671) 2022-03-18 18:01:25 -05:00
Jennifer Richards 6c260a5b7e Merge 7.45.1.dev0 into Bootstrap 5 update branch. Made a first pass at reconciling differences.
- Legacy-Id: 19945
2022-02-17 20:09:49 +00:00
Lars Eggert cc723ce449 More fixes.
- Legacy-Id: 19899
2022-01-31 19:17:50 +00:00
Lars Eggert 335a39d4fc More fixes.
- Legacy-Id: 19884
2022-01-28 13:00:47 +00:00
Lars Eggert cf629a42ad And more fixes.
- Legacy-Id: 19877
2022-01-25 10:14:25 +00:00
Jennifer Richards cf62b46093 Find references from submitted XML instead of rendering to text and parsing. Fixes #3342. Commit ready for merge.
- Legacy-Id: 19825
2022-01-07 17:53:23 +00:00
Lars Eggert 6fa5fa073e More fixes.
- Legacy-Id: 19812
2022-01-06 12:26:10 +00:00
Lars Eggert 5132661b06 More test fixes
- Legacy-Id: 19803
2022-01-05 11:25:25 +00:00
Robert Sparks 865dc62676 Change strategy to only creating a single file per doc/rev, and not creating the 'draft-'-less or version-less variants. Corrected calculation of date in the management command.
- Legacy-Id: 19789
2021-12-16 22:33:47 +00:00
Robert Sparks b7eec8ae26 Build and maintain a full set of bibxml-ids documents.
- Legacy-Id: 19782
2021-12-14 20:56:26 +00:00
Lars Eggert f974fd3c04 Fix more things
- Legacy-Id: 19762
2021-12-09 06:41:00 +00:00
Robert Sparks 5c28a85cf1 Merged in [19555] from jennifer@painless-security.com:
Use temporary directories instead of 'real' filesystem for tests. Fixes #3414.
 - Legacy-Id: 19561
Note: SVN reference [19555] has been migrated to Git commit 81d9234d54
2021-11-08 18:16:56 +00:00
Jennifer Richards 81d9234d54 Use temporary directories instead of "real" filesystem for tests. Fixes #3414. Commit ready for merge.
- Legacy-Id: 19555
2021-11-05 19:45:57 +00:00
Lars Eggert b058ba28ec Remove the ability to submit Postscript I-Ds.
Commit ready for merge. Fixes #3448.
 - Legacy-Id: 19486
2021-10-28 16:24:29 +00:00
Lars Eggert 962253f994 Remove the Note Well from the datatracker and point to the IETF web site.
One less thing to keep in sync if the Note Well changes.

Commit ready for merge.
 - Legacy-Id: 19484
2021-10-28 13:08:10 +00:00
Robert Sparks 47082fe4c5 Allow submit and expire_drafts to succeed when there is no "next" IETF meeting in the database. Fixes #3370. Commit ready for merge.
- Legacy-Id: 19269
2021-08-01 17:50:35 +00:00
Jennifer Richards 9ef3764ad7 Run v2v3 converter internally when v2 XML is submitted. Fixes #3305. Commit ready for merge.
- Legacy-Id: 19242
2021-07-20 18:13:41 +00:00
Jennifer Richards 197194a41c Update action holders when a new draft is submitted. Fixes #3281. Commit ready for merge.
- Legacy-Id: 19122
2021-06-14 17:11:23 +00:00
Jennifer Richards 1155fb32f6 Accept 'None' when updating DocumentAuthor affiliation / country. Commit ready for merge.
- Legacy-Id: 19028
2021-05-21 15:54:03 +00:00
Jennifer Richards b08110b838 Allow external resources to be set/suggested during submission process. Fixes #3068. Commit ready for merge.
- Legacy-Id: 18960
2021-04-19 20:21:19 +00:00
Robert Sparks 42bd8f5a41 Enable two tests that were not running because of typos in the test name. Thanks to Jennifer for spotting the typos.
- Legacy-Id: 18819
2021-02-01 22:37:57 +00:00
Robert Sparks 9a9f3fa360 Merged in [18798] from jennifer@painless-security.com:
Improve handling of submissions for closed working groups. Fixes #3058.
 - Legacy-Id: 18807
Note: SVN reference [18798] has been migrated to Git commit 233bff8196
2021-01-27 23:19:42 +00:00
Jennifer Richards 233bff8196 Improve handling of submissions for closed working groups. Fixes #3058. Commit ready for merge.
- Legacy-Id: 18798
2021-01-18 14:55:25 +00:00
Robert Sparks 3697180cc1 Reverted merge of timezone-aware migration efforts.
- Legacy-Id: 18792
2021-01-12 16:54:20 +00:00
Henrik Levkowetz 774e752a54 Snapshot of timezone-aware datatracker code. Tests pass, and the test-crawler shows only expected differences. Trunk changes merged in up to r18768.
- Legacy-Id: 18770
2020-12-16 23:53:37 +00:00
Robert Sparks 10c24535a9 Merged in [18753] from henrik@levkowetz.com:
Added test case setUp() and tearDown() code to create yang model test directories for ApiSubmitTests.
 - Legacy-Id: 18754
Note: SVN reference [18753] has been migrated to Git commit bca7a5d128
2020-12-11 19:41:16 +00:00
Robert Sparks 4a12278a39 revert unintended commit of debugging
- Legacy-Id: 18747
2020-12-10 17:07:44 +00:00
Robert Sparks b673e9f836 Merged in [18719] from housley@vigilsec.com:
Automatically move the IESG document state when a ballot is issued, prevent a writeup change or re-issue of ballot if the document is already approved, and warn about issuing ballots before the IETF Last Call is finished. Fixes #3119.
 - Legacy-Id: 18746
Note: SVN reference [18719] has been migrated to Git commit 89ec802a5b
2020-12-10 17:04:41 +00:00
Robert Sparks 3baea05e6d Use the id-archive wherever we had been using the id-repository. Fixes #3080. Commit ready for merge.
- Legacy-Id: 18550
2020-10-02 14:13:17 +00:00
Henrik Levkowetz 15ea994266 Added an xml_version field to Submission objects, to capture the schema version of submitted XML files (if any). Related to issue #3067.
- Legacy-Id: 18440
2020-08-28 14:31:36 +00:00
Robert Sparks 2b10465aa7 Convert IRTF area groups into their own group type rather than attempting to overload AG. Fixes #3027. Commit ready for merge.
- Legacy-Id: 18298
2020-07-28 18:54:44 +00:00
Henrik Levkowetz 0a0df995e6 Merged in [18250] from jennifer@painless-security.com:
Reject or require manual processing for submissions when inconsistent SubmissionDocEvent revs exist. Fixes #2909.
 - Legacy-Id: 18277
Note: SVN reference [18250] has been migrated to Git commit b61bdc289b
2020-07-26 11:15:49 +00:00
Henrik Levkowetz f0baae3623 Made test parts that depends on yanglint conditional. Added some informational messages about tests skipped due to missing resources.
- Legacy-Id: 18255
2020-07-24 13:43:59 +00:00
Jennifer Richards b61bdc289b Reject or require manual processing for submissions when inconsistent SubmissionDocEvent revs exist. Fixes #2909. Commit ready for merge.
- Legacy-Id: 18250
2020-07-24 13:24:00 +00:00
Henrik Levkowetz 25e644d0e2 Added support for pulling yang modules from yangcatalog.org.
- Legacy-Id: 18141
2020-07-08 18:44:56 +00:00
Henrik Levkowetz 9047875296 Removed an unused parameter from submit.tests.do_submission_email().
- Legacy-Id: 18082
2020-06-27 17:17:22 +00:00
Henrik Levkowetz 186e2ae67b Decorated post_submission() with @transaction.atomic, and did some slight refactoring of code related to post_submission() calls and submission events. This was triggered by a submission left in an intermediate state because of a WSGI timeout (leading to a 504 error).
- Legacy-Id: 17892
2020-05-28 15:01:33 +00:00
Henrik Levkowetz bc05e7a8d0 Refactored many instances of msg.get_payload(decode=True).decode('utf-8') and similar to get_payload_text(msg), which uses msg.get_charset() to get the actual charset to do the decoding, in a consistent manner. Also removed some instances of force_str, but more remain.
- Legacy-Id: 17807
2020-05-16 20:20:05 +00:00
Henrik Levkowetz f10ddadc0e Merged in changes from trunk up to r17584.
- Legacy-Id: 17593
2020-04-07 16:02:52 +00:00
Henrik Levkowetz 4d345573ae Check if any files matching the submitted draft name and revision already exists on disk in the active drafts or archived drafts directories, and if so reject the submission. Fixes issue #2908
- Legacy-Id: 17498
2020-03-21 22:56:57 +00:00
Robert Sparks edc41a8705 Don't warn about idcutoff when the cutoff is after the meeting starts. Fixes #2907. Commit ready for merge.
- Legacy-Id: 17419
2020-03-11 16:15:40 +00:00
Henrik Levkowetz 726fcbf27d Removed all __future__ imports.
- Legacy-Id: 17391
2020-03-05 23:53:42 +00:00
Henrik Levkowetz e9a37d8ac8 Removed six.text_type(), changed six.moves.urllib to plain urllib, and removed now unused six imports.
- Legacy-Id: 17385
2020-03-05 14:41:41 +00:00
Henrik Levkowetz b4d7dd131a Added ability to use the submission API with active secondary email addresses. Fixes issue #2639.
- Legacy-Id: 17383
2020-03-04 18:05:56 +00:00
Henrik Levkowetz 096c08aac4 Added a test case for draft submission errors due to periods in document names.
- Legacy-Id: 17251
2020-01-18 15:07:51 +00:00