|
@@ -752,6 +752,10 @@ DEFAULTS = {
|
|
|
'bootstrap_time': int(os.environ.get('CHUTNEY_BOOTSTRAP_TIME',
|
|
|
os.environ.get('BOOTSTRAP_TIME',
|
|
|
60))),
|
|
|
+ # the PID of the controlling script (for __OwningControllerProcess)
|
|
|
+ 'controlling_pid': (int(os.environ.get('CHUTNEY_CONTROLLING_PID', 0))
|
|
|
+ if 'CHUTNEY_CONTROLLING_PID' in os.environ
|
|
|
+ else None),
|
|
|
}
|
|
|
|
|
|
|
|
@@ -770,7 +774,7 @@ class TorEnviron(chutney.Templating.Environ):
|
|
|
torrc_template_path: path to chutney torrc_templates directory
|
|
|
hs_hostname: the hostname of the key generated by a hidden service
|
|
|
owning_controller_process: the __OwningControllerProcess torrc line,
|
|
|
- or an empty string if tor should continue after the script exits
|
|
|
+ disabled if tor should continue after the script exits
|
|
|
|
|
|
Environment fields used:
|
|
|
nodenum: chutney's internal node number for the node
|
|
@@ -848,6 +852,21 @@ class TorEnviron(chutney.Templating.Environ):
|
|
|
(my['nick'], e.errno, e.strerror, hs_hostname_file))
|
|
|
return my['hs-hostname']
|
|
|
|
|
|
+ def _get_owning_controller_process(self, my):
|
|
|
+ cpid = my['controlling_pid']
|
|
|
+ if cpid is None:
|
|
|
+ cpid = 0
|
|
|
+ ocp_line = ('__OwningControllerProcess %d' % (cpid))
|
|
|
+ # if we want to leave the network running, or controlling_pid is 1
|
|
|
+ # (or invalid)
|
|
|
+ if (os.environ.get('CHUTNEY_START_TIME', 0) < 0 or
|
|
|
+ os.environ.get('CHUTNEY_BOOTSTRAP_TIME', 0) < 0 or
|
|
|
+ os.environ.get('CHUTNEY_STOP_TIME', 0) < 0 or
|
|
|
+ cpid <= 1):
|
|
|
+ return '#' + ocp_line
|
|
|
+ else:
|
|
|
+ return ocp_line
|
|
|
+
|
|
|
|
|
|
class Network(object):
|
|
|
|