def configure(mode, quiet=False): settings = config['modes'][mode] yamlout = yaml.dump({mode: settings}) if not quiet: puts(colored.green('>>> configuring')) puts(yamlout) for name, commands in settings.items(): out = yaml.dump({mode: commands}) swarm_exec(cass(name))("sh", "-c", fmt("echo '#{out}' > /honeycomb.yml")) for cmd in commands: swarm_exec(cass(name))( "tc", "qdisc", "replace", "dev", "eth0", "root", "netem", *cmd.split())
def cmd_modes(extra=None, opt=None): print pretty_yaml({ node: yaml.load(swarm_exec(node)("cat", "/honeycomb.yml").stdout) for node in containers('owl_cass') })
def cmd_status(extra=None, opt=None): for node in containers('owl_cass'): puts(colored.magenta("[#{node}]", bold=True)) puts(pretty_yaml(yaml.load(swarm_exec(node)("cat", "/honeycomb.yml").stdout)))