[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 5d4f04d32887412a66fb189025ff51a1dc755701
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits