Commit 0234d059 authored by Julien Muchembled's avatar Julien Muchembled

demo: add wrapper to easily monkey-patch re6st

Also:
- use '/usr/bin/env python' to easily use a Python interpreter different than
  /usr/bin/python
- demo must be run by root so "dont_write_bytecode" to avoid having *.pyc files
  owned by root in the working copy
parent 51cfbec7
...@@ -161,8 +161,8 @@ if 1: ...@@ -161,8 +161,8 @@ if 1:
" -subj /CN=re6st.example.com/emailAddress=re6st@example.com" " -subj /CN=re6st.example.com/emailAddress=re6st@example.com"
" -set_serial 0x120010db80042 -days %u" % CA_DAYS, shell=True) " -set_serial 0x120010db80042 -days %u" % CA_DAYS, shell=True)
db_path = 'registry/registry.db' db_path = 'registry/registry.db'
registry.screen('../re6st-registry @registry/re6st-registry.conf --db %s' registry.screen('./py re6st-registry @registry/re6st-registry.conf'
' --mailhost %s -v%u --control-socket registry/babeld.socket' ' --db %s --mailhost %s -v%u --control-socket registry/babeld.socket'
% (db_path, os.path.abspath('mbox'), VERBOSE)) % (db_path, os.path.abspath('mbox'), VERBOSE))
registry_url = 'http://%s/' % REGISTRY registry_url = 'http://%s/' % REGISTRY
registry.Popen(('python', '-c', """if 1: registry.Popen(('python', '-c', """if 1:
...@@ -183,7 +183,7 @@ if 1: ...@@ -183,7 +183,7 @@ if 1:
if not os.path.exists(dh_path): if not os.path.exists(dh_path):
os.symlink('../dh2048.pem', dh_path) os.symlink('../dh2048.pem', dh_path)
email = node.name + '@example.com' email = node.name + '@example.com'
p = node.Popen(('../../re6st-conf', '--registry', registry, p = node.Popen(('../py', 're6st-conf', '--registry', registry,
'--email', email), stdin=subprocess.PIPE, cwd=folder) '--email', email), stdin=subprocess.PIPE, cwd=folder)
token = None token = None
while not token: while not token:
...@@ -196,7 +196,7 @@ if 1: ...@@ -196,7 +196,7 @@ if 1:
p.communicate(str(token[0])) p.communicate(str(token[0]))
os.remove(dh_path) os.remove(dh_path)
os.remove(folder + '/ca.crt') os.remove(folder + '/ca.crt')
node.screen('../re6stnet @%s/re6stnet.conf -v%u --registry %s' node.screen('./py re6stnet @%s/re6stnet.conf -v%u --registry %s'
' --control-socket %s/babeld.socket' ' --control-socket %s/babeld.socket'
' %s' % (folder, VERBOSE, registry, folder, args)) ' %s' % (folder, VERBOSE, registry, folder, args))
re6stnet(registry, 'registry', '--ip ' + REGISTRY, registry='http://localhost/') re6stnet(registry, 'registry', '--ip ' + REGISTRY, registry='http://localhost/')
......
#!/usr/bin/env python
def __file__():
import argparse, os, sys
sys.dont_write_bytecode = True
sys.path[0] = os.path.dirname(sys.path[0])
from argparse import ArgumentParser
_parse_args = ArgumentParser.parse_args
ArgumentParser.parse_args = lambda self: _parse_args(self, sys.argv[2:])
return os.path.join(sys.path[0], sys.argv[1])
__file__ = __file__()
execfile(__file__)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment