Skip to content

Commit c696a71

Browse files
chore: Drop alias generation mgmt commands (#7082)
* chore: Remove generate_draft_aliases.py Also remove test and update some now-stale help strings. These are not very helpful, but will not exist for long in their updated incarnation. * chore: Remove generate_group_aliases.py ... and its test. * chore: Remove unused import * chore: Remove unused import
1 parent 10cd14f commit c696a71

File tree

5 files changed

+4
-542
lines changed

5 files changed

+4
-542
lines changed

ietf/checks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def check_group_email_aliases_exists(app_configs, **kwargs):
4242
if not ok:
4343
errors.append(checks.Error(
4444
"Found no aliases in the group email aliases file\n'%s'."%settings.GROUP_ALIASES_PATH,
45-
hint="Please run the generate_group_aliases management command to generate them.",
45+
hint="These should be created by the infrastructure using ietf/bin/aliases-from-json.py.",
4646
obj=None,
4747
id="datatracker.E0002",
4848
))
4949
except IOError as e:
5050
errors.append(checks.Error(
5151
"Could not read group email aliases:\n %s" % e,
52-
hint="Please run the generate_group_aliases management command to generate them.",
52+
hint="These should be created by the infrastructure using ietf/bin/aliases-from-json.py.",
5353
obj=None,
5454
id="datatracker.E0003",
5555
))
@@ -69,14 +69,14 @@ def check_doc_email_aliases_exists(app_configs, **kwargs):
6969
if not ok:
7070
errors.append(checks.Error(
7171
"Found no aliases in the document email aliases file\n'%s'."%settings.DRAFT_VIRTUAL_PATH,
72-
hint="Please run the generate_draft_aliases management command to generate them.",
72+
hint="These should be created by the infrastructure using ietf/bin/aliases-from-json.py.",
7373
obj=None,
7474
id="datatracker.E0004",
7575
))
7676
except IOError as e:
7777
errors.append(checks.Error(
7878
"Could not read document email aliases:\n %s" % e,
79-
hint="Please run the generate_draft_aliases management command to generate them.",
79+
hint="These should be created by the infrastructure using ietf/bin/aliases-from-json.py.",
8080
obj=None,
8181
id="datatracker.E0005",
8282
))

ietf/doc/management/commands/generate_draft_aliases.py

Lines changed: 0 additions & 183 deletions
This file was deleted.

ietf/doc/tests.py

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,152 +2181,6 @@ def tearDown(self):
21812181
os.unlink(self.doc_virtual_file.name)
21822182
super().tearDown()
21832183

2184-
def testManagementCommand(self):
2185-
a_month_ago = (timezone.now() - datetime.timedelta(30)).astimezone(RPC_TZINFO)
2186-
a_month_ago = a_month_ago.replace(hour=0, minute=0, second=0, microsecond=0)
2187-
ad = RoleFactory(
2188-
name_id="ad", group__type_id="area", group__state_id="active"
2189-
).person
2190-
shepherd = PersonFactory()
2191-
author1 = PersonFactory()
2192-
author2 = PersonFactory()
2193-
author3 = PersonFactory()
2194-
author4 = PersonFactory()
2195-
author5 = PersonFactory()
2196-
author6 = PersonFactory()
2197-
mars = GroupFactory(type_id="wg", acronym="mars")
2198-
marschairman = PersonFactory(user__username="marschairman")
2199-
mars.role_set.create(
2200-
name_id="chair", person=marschairman, email=marschairman.email()
2201-
)
2202-
doc1 = IndividualDraftFactory(
2203-
authors=[author1], shepherd=shepherd.email(), ad=ad
2204-
)
2205-
doc2 = WgDraftFactory(
2206-
name="draft-ietf-mars-test", group__acronym="mars", authors=[author2], ad=ad
2207-
)
2208-
doc3 = WgDraftFactory.create(
2209-
name="draft-ietf-mars-finished",
2210-
group__acronym="mars",
2211-
authors=[author3],
2212-
ad=ad,
2213-
std_level_id="ps",
2214-
states=[("draft", "rfc"), ("draft-iesg", "pub")],
2215-
time=a_month_ago,
2216-
)
2217-
rfc3 = WgRfcFactory()
2218-
DocEventFactory.create(doc=rfc3, type="published_rfc", time=a_month_ago)
2219-
doc3.relateddocument_set.create(
2220-
relationship_id="became_rfc", target=rfc3
2221-
)
2222-
doc4 = WgDraftFactory.create(
2223-
authors=[author4, author5],
2224-
ad=ad,
2225-
std_level_id="ps",
2226-
states=[("draft", "rfc"), ("draft-iesg", "pub")],
2227-
time=datetime.datetime(2010, 10, 10, tzinfo=ZoneInfo(settings.TIME_ZONE)),
2228-
)
2229-
rfc4 = WgRfcFactory()
2230-
DocEventFactory.create(
2231-
doc=rfc4,
2232-
type="published_rfc",
2233-
time=datetime.datetime(2010, 10, 10, tzinfo=RPC_TZINFO),
2234-
)
2235-
doc4.relateddocument_set.create(
2236-
relationship_id="became_rfc", target=rfc4
2237-
)
2238-
doc5 = IndividualDraftFactory(authors=[author6])
2239-
2240-
args = []
2241-
kwargs = {}
2242-
out = io.StringIO()
2243-
call_command("generate_draft_aliases", *args, **kwargs, stdout=out, stderr=out)
2244-
self.assertFalse(out.getvalue())
2245-
2246-
with open(settings.DRAFT_ALIASES_PATH) as afile:
2247-
acontent = afile.read()
2248-
for x in [
2249-
"xfilter-" + doc1.name,
2250-
"xfilter-" + doc1.name + ".ad",
2251-
"xfilter-" + doc1.name + ".authors",
2252-
"xfilter-" + doc1.name + ".shepherd",
2253-
"xfilter-" + doc1.name + ".all",
2254-
"xfilter-" + doc2.name,
2255-
"xfilter-" + doc2.name + ".ad",
2256-
"xfilter-" + doc2.name + ".authors",
2257-
"xfilter-" + doc2.name + ".chairs",
2258-
"xfilter-" + doc2.name + ".all",
2259-
"xfilter-" + doc3.name,
2260-
"xfilter-" + doc3.name + ".ad",
2261-
"xfilter-" + doc3.name + ".authors",
2262-
"xfilter-" + doc3.name + ".chairs",
2263-
"xfilter-" + doc5.name,
2264-
"xfilter-" + doc5.name + ".authors",
2265-
"xfilter-" + doc5.name + ".all",
2266-
]:
2267-
self.assertIn(x, acontent)
2268-
2269-
for x in [
2270-
"xfilter-" + doc1.name + ".chairs",
2271-
"xfilter-" + doc2.name + ".shepherd",
2272-
"xfilter-" + doc3.name + ".shepherd",
2273-
"xfilter-" + doc4.name,
2274-
"xfilter-" + doc5.name + ".shepherd",
2275-
"xfilter-" + doc5.name + ".ad",
2276-
]:
2277-
self.assertNotIn(x, acontent)
2278-
2279-
with open(settings.DRAFT_VIRTUAL_PATH) as vfile:
2280-
vcontent = vfile.read()
2281-
for x in [
2282-
ad.email_address(),
2283-
shepherd.email_address(),
2284-
marschairman.email_address(),
2285-
author1.email_address(),
2286-
author2.email_address(),
2287-
author3.email_address(),
2288-
author6.email_address(),
2289-
]:
2290-
self.assertIn(x, vcontent)
2291-
2292-
for x in [
2293-
author4.email_address(),
2294-
author5.email_address(),
2295-
]:
2296-
self.assertNotIn(x, vcontent)
2297-
2298-
for x in [
2299-
"xfilter-" + doc1.name,
2300-
"xfilter-" + doc1.name + ".ad",
2301-
"xfilter-" + doc1.name + ".authors",
2302-
"xfilter-" + doc1.name + ".shepherd",
2303-
"xfilter-" + doc1.name + ".all",
2304-
"xfilter-" + doc2.name,
2305-
"xfilter-" + doc2.name + ".ad",
2306-
"xfilter-" + doc2.name + ".authors",
2307-
"xfilter-" + doc2.name + ".chairs",
2308-
"xfilter-" + doc2.name + ".all",
2309-
"xfilter-" + doc3.name,
2310-
"xfilter-" + doc3.name + ".ad",
2311-
"xfilter-" + doc3.name + ".authors",
2312-
"xfilter-" + doc3.name + ".chairs",
2313-
"xfilter-" + doc3.name + ".all",
2314-
"xfilter-" + doc5.name,
2315-
"xfilter-" + doc5.name + ".authors",
2316-
"xfilter-" + doc5.name + ".all",
2317-
]:
2318-
self.assertIn(x, vcontent)
2319-
2320-
for x in [
2321-
"xfilter-" + doc1.name + ".chairs",
2322-
"xfilter-" + doc2.name + ".shepherd",
2323-
"xfilter-" + doc3.name + ".shepherd",
2324-
"xfilter-" + doc4.name,
2325-
"xfilter-" + doc5.name + ".shepherd",
2326-
"xfilter-" + doc5.name + ".ad",
2327-
]:
2328-
self.assertNotIn(x, vcontent)
2329-
23302184
@override_settings(TOOLS_SERVER="tools.example.org", DRAFT_ALIAS_DOMAIN="draft.example.org")
23312185
def test_generator_class(self):
23322186
"""The DraftAliasGenerator should generate the same lists as the old mgmt cmd"""

0 commit comments

Comments
 (0)