[tor-commits] [chutney/master] Add a print_phases command to report how many phases there are.

nickm at torproject.org nickm at torproject.org
Fri Jun 26 13:34:43 UTC 2020


commit 5d4f04d32887412a66fb189025ff51a1dc755701
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jun 24 10:33:25 2020 -0400

    Add a print_phases command to report how many phases there are.
    
    Chutney supports multiple phases so that we can configure the
    network in a particular sequence.  But to use them in a shell
    script, we'll need to have some way to ask chutney how many phases a
    network has.
---
 lib/chutney/TorNet.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index a00decd..8e8a151 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -2561,6 +2561,16 @@ class Network(object):
                            any_tor_was_running,
                            True)
 
+    def print_phases(self):
+        """Print the total number of phases in which the network is
+           initialized, configured, or bootstrapped."""
+        def max_phase(key):
+            return max(int(n._env[key]) for n in self._nodes)
+        cfg_max = max_phase("config_phase")
+        launch_max = max_phase("launch_phase")
+        print("CHUTNEY_CONFIG_PHASES={}".format(cfg_max))
+        print("CHUTNEY_LAUNCH_PHASES={}".format(launch_max))
+
 def Require(feature):
     network = _THE_NETWORK
     network._addRequirement(feature)





More information about the tor-commits mailing list