Skip to content

Commit e0ef654

Browse files
committed
First stab at a helper for setting up a minimal test environment on a new host.
- Legacy-Id: 12105
1 parent c7768ca commit e0ef654

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

bin/setupenv

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
from __future__ import print_function
3+
4+
import os
5+
import subprocess
6+
import requests
7+
import sys
8+
import stat
9+
10+
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
11+
12+
from ietf.settings_sqlitetest import * # we don't import from django.conf here, on purpose
13+
14+
for dir in [ AGENDA_PATH, IDSUBMIT_REPOSITORY_PATH, IDSUBMIT_STAGING_PATH,
15+
INTERNET_DRAFT_ARCHIVE_DIR, os.path.dirname(DRAFT_ALIASES_PATH), PHOTOS_DIR, ]:
16+
if not os.path.exists(dir):
17+
print("Creating %s" % dir)
18+
os.makedirs(dir)
19+
20+
for path in [ DRAFT_ALIASES_PATH, DRAFT_VIRTUAL_PATH, GROUP_ALIASES_PATH, GROUP_VIRTUAL_PATH, ]:
21+
if not os.path.exists(path):
22+
print("Setting up %s" % path)
23+
dir, fn = os.path.split(path)
24+
url = "https://zinfandel.tools.ietf.org/src/db/tmp/%s" % fn
25+
r = requests.get(url)
26+
if r.status_code == 200:
27+
with open(path, "w") as of:
28+
of.write(r.text)
29+
else:
30+
print("Error %s fetching '%s'" % (r.status_code, url))
31+
32+
path = IDSUBMIT_IDNITS_BINARY
33+
if not os.path.exists(path):
34+
print("Setting up %s" % path)
35+
r = requests.get('https://tools.ietf.org/tools/idnits/idnits')
36+
with open(path, 'w') as idnits:
37+
idnits.write(r.text)
38+
os.chmod(path, 0755)
39+

0 commit comments

Comments
 (0)