GC-4599: better logging of depth

This commit is contained in:
urihershgc 2015-12-08 09:58:06 +02:00
parent 21463211fd
commit e5d809e7aa
2 changed files with 6 additions and 3 deletions

View File

@ -59,11 +59,12 @@ def main():
with open(config_file) as config_fo: with open(config_file) as config_fo:
json_dict = json.load(config_fo) json_dict = json.load(config_fo)
WormConfiguration.from_dict(json_dict) WormConfiguration.from_dict(json_dict)
print "Configuration loaded: %r" % WormConfiguration.as_dict()
except ValueError as e: except ValueError as e:
print "Error loading config, using default: %s" % e print "Error loading config, using default: %s" % e
else: else:
LOG.warning("Config file: %s wasn't found, using default" % config_file) print("Config file: %s wasn't found, using default" % config_file)
print "Loaded Configuration: %r" % WormConfiguration.as_dict()
try: try:
if MONKEY_ARG == monkey_mode: if MONKEY_ARG == monkey_mode:

View File

@ -52,7 +52,6 @@ class ChaosMonkey(object):
self._default_server = opts.server self._default_server = opts.server
if opts.depth: if opts.depth:
WormConfiguration.depth = int(opts.depth) WormConfiguration.depth = int(opts.depth)
LOG.debug("Selected depth is: %d" % WormConfiguration.depth)
self._keep_running = True self._keep_running = True
self._network = NetworkScanner() self._network = NetworkScanner()
self._dropper_path = sys.argv[0] self._dropper_path = sys.argv[0]
@ -84,7 +83,10 @@ class ChaosMonkey(object):
ControlClient.send_telemetry("system_info_collection", system_info) ControlClient.send_telemetry("system_info_collection", system_info)
if 0 == WormConfiguration.depth: if 0 == WormConfiguration.depth:
LOG.debug("Reached max depth, shutting down")
return return
else:
LOG.debug("Running with depth: %d" % WormConfiguration.depth)
for _ in xrange(WormConfiguration.max_iterations): for _ in xrange(WormConfiguration.max_iterations):
ControlClient.keepalive() ControlClient.keepalive()