Skip to content

Commit

Permalink
Merge pull request #88 from dcos/ken/agent-fault-injection
Browse files Browse the repository at this point in the history
restarting of nodes and agent or master processes
  • Loading branch information
colin-msphere authored Nov 4, 2016
2 parents 886f379 + ca11ebb commit 803d262
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shakedown/dcos/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from dcos import (marathon, mesos)


def get_public_agents():
"""Provides a list of hostnames / IPs that are public agents in the cluster"""
agent_list = []
Expand All @@ -15,6 +16,7 @@ def get_public_agents():

return agent_list


def get_private_agents():
"""Provides a list of hostnames / IPs that are private agents in the cluster"""

Expand All @@ -34,6 +36,7 @@ def get_private_agents():

return agent_list


def get_agents():
"""Provides a list of hostnames / IPs of all agents in the cluster"""

Expand Down Expand Up @@ -118,6 +121,7 @@ def restart_agent(

run_command_on_agent(hostname, "sudo systemctl restart dcos-mesos-slave")


def stop_agent(
hostname
):
Expand All @@ -140,6 +144,13 @@ def start_agent(
run_command_on_agent(hostname, "sudo systemctl start dcos-mesos-slave")


def restart_agent_node(hostname):
""" Restarts the agent node
"""

run_command_on_agent(hostname, "sudo /sbin/shutdown -r now")


def delete_agent_log(
hostname
):
Expand Down
13 changes: 13 additions & 0 deletions shakedown/dcos/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ def reconnect_master():
reconnect_node(shakedown.master_ip())


def restart_master_node():
""" Restarts the master node
"""

run_command_on_master("sudo /sbin/shutdown -r now")


def systemctl_master(command='restart'):
""" Used to start, stop or restart the master process
"""
run_command_on_master('sudo systemctl {} dcos-mesos-master'.format(command))


@contextlib.contextmanager
def disconnected_master(incoming=True, outgoing=True):

Expand Down

0 comments on commit 803d262

Please sign in to comment.