diff --git a/chaos_monkey/monkey.py b/chaos_monkey/monkey.py index e61249a87..e3af0e012 100644 --- a/chaos_monkey/monkey.py +++ b/chaos_monkey/monkey.py @@ -111,16 +111,7 @@ class ChaosMonkey(object): ControlClient.keepalive() ControlClient.load_control_config() - # TODO: this is temporary until we change server to support changing of config. - for user in list(additional_creds): - if user not in WormConfiguration.exploit_user_list: - WormConfiguration.exploit_user_list.append(user) - - creds = additional_creds[user] - if creds.has_key('password'): - password = creds['password'] - if password not in WormConfiguration.exploit_password_list: - WormConfiguration.exploit_password_list.append(password) + self.update_config_creds(additional_creds) LOG.debug("Users to try: %s" % str(WormConfiguration.exploit_user_list)) LOG.debug("Passwords to try: %s" % str(WormConfiguration.exploit_password_list)) @@ -142,6 +133,9 @@ class ChaosMonkey(object): if ControlClient.check_for_stop(): break + # TODO: Consider removing later + self.update_config_creds(additional_creds) + is_empty = False for finger in self._fingerprint: LOG.info("Trying to get OS fingerprint from %r with module %s", @@ -260,4 +254,16 @@ class ChaosMonkey(object): except Exception, exc: LOG.error("Exception in self delete: %s", exc) + def update_config_creds(self, additional_creds): + # TODO: this is temporary until we change server to support changing of config. + for user in list(additional_creds): + if user not in WormConfiguration.exploit_user_list: + WormConfiguration.exploit_user_list.append(user) + + creds = additional_creds[user] + if creds.has_key('password'): + password = creds['password'] + if password not in WormConfiguration.exploit_password_list: + WormConfiguration.exploit_password_list.append(password) + LOG.info("Monkey is shutting down")