Merge lp:~sseman/juju-chaos-monkey/replay-commands into lp:juju-chaos-monkey
Status: | Merged |
---|---|
Merged at revision: | 22 |
Proposed branch: | lp:~sseman/juju-chaos-monkey/replay-commands |
Merge into: | lp:juju-chaos-monkey |
Diff against target: |
324 lines (+164/-29) 3 files modified
chaos_monkey.py (+3/-8) runner.py (+60/-9) tests/test_runner.py (+101/-12) |
To merge this branch: | bzr merge lp:~sseman/juju-chaos-monkey/replay-commands |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John George (community) | Approve | ||
Review via email: mp+261583@code.launchpad.net |
Description of the change
This branch adds support to replay Chaos Monkey commands from a structured (YAML) data file. It handles a reboot requests as follows:
- Write the remaining Chaos Monkey commands to a temporary file.
- After a reboot, read the temporary file and continue the run.
- Delete the temporary file.
Here is output from using the --replay option:
$ cat /home/ubuntu/
- [deny-incoming, 2]
- [restart-unit, 2]
- [deny-all, 2]
$runner.py --replay /home/ubuntu/
$cat results.log
2015-06-10 01:02:41 INFO Chaos Monkey started in /home/ubuntu/cm
2015-06-10 01:02:41 INFO Replaying commands from /home/ubuntu/
2015-06-10 01:02:41 INFO Deny all incoming network traffic except ssh.
2015-06-10 01:02:45 INFO Restart the unit.
2015-06-10 01:02:45 INFO Init script generated:
cmd: --replay /home/ubuntu/
expire_time: 1433898167.64
runner_path: /home/ubuntu/
2015-06-10 01:02:45 INFO Chaos Monkey stopped.
2015-06-10 01:03:08 INFO Chaos Monkey restarted after a reboot in /home/ubuntu/cm
2015-06-10 01:03:08 INFO Init script removed from /etc/init/
2015-06-10 01:03:08 INFO Replaying commands from /home/ubuntu/
2015-06-10 01:03:08 INFO Deny all incoming and outgoing network traffic except ssh.
2015-06-10 01:03:15 INFO Chaos Monkey stopped.
This looks good, thanks for the example output in the description, it helps a lot while reviewing.
If you passed args returned from parse_args() to Runner.factory and setup the constructor to accept each value, with some minimal default, then all the instance data can be stored in one place. The function definitions can then be smaller. Rather than passing in args to each function, self can be referenced. Changing the data storage location is not required to land this branch but we've talked about a later branch that will change argument passing for the random_chaos() function. Please strongly consider this proposed change for that branch.