[tor-commits] [chutney/master] Add the ability to mark a value as derived at runtime.

teor at torproject.org teor at torproject.org
Thu Aug 1 23:02:19 UTC 2019


commit fa0bc73beec21da3ed559f38ce9d09d3896adb70
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue May 14 14:35:28 2019 -0400

    Add the ability to mark a value as derived at runtime.
    
    Some jobs, like parsing the obs4_bridgeline file, don't belong in
    Chutney.  Fortunately, our template-and-environment system makes
    those easy to override.
---
 lib/chutney/TorNet.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 1e7b1e4..2640e0c 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -278,6 +278,13 @@ class Node(object):
     def specialize(self, **kwargs):
         return Node(parent=self, **kwargs)
 
+    def set_runtime(self, key, fn):
+        """Specify a runtime function that gets invoked to find the
+           runtime value of a key.  It should take a single argument, which
+           will be an environment.
+        """
+        setattr(self._env, "_get_"+key, fn)
+
     ######
     # Chutney uses these:
 





More information about the tor-commits mailing list