def add_subparser(subparsers): get_subparser(description="'paasta docker_inspect' works by picking a container running your service " "at random. It then runs docker docker_inspect <container_id> ", help_text="Docker inspect against a container running your service", command='docker_inspect', function=paasta_docker_inspect, subparsers=subparsers)
def add_subparser(subparsers): get_subparser(description="'paasta docker_stop' works by picking a container running your service " "at random. It then runs docker stop <container_id> to stop the container. " "You should expect marathon to then replace the dead container. " "Note this doesn't do any draining of the connections to this container!", help_text="Docker stop a container running your service", command='docker_stop', function=paasta_docker_stop, subparsers=subparsers)
def add_subparser(subparsers): get_subparser( description= "'paasta docker_stop' works by picking a container running your service " "at random. It then runs docker stop <container_id> to stop the container. " "You should expect marathon to then replace the dead container. " "Note this doesn't do any draining of the connections to this container!", help_text="Docker stop a container running your service", command='docker_stop', function=paasta_docker_stop, subparsers=subparsers)
def test_get_subparser(): mock_subparser = mock.Mock() mock_function = mock.Mock() mock_command = 'test' mock_help_text = 'HALP' mock_description = 'what_i_do' utils.get_subparser(subparsers=mock_subparser, function=mock_function, help_text=mock_help_text, description=mock_description, command=mock_command) mock_subparser.add_parser.assert_called_with('test', help='HALP', description=('what_i_do'), epilog=("Note: This command requires SSH and " "sudo privileges on the remote PaaSTA nodes.")) mock_subparser.add_parser.return_value.set_defaults.assert_called_with(command=mock_function)
def add_subparser(subparsers): new_parser = get_subparser(description="'paasta docker_exec' works by picking a container running your service " "at random. It then runs docker exec -ti <container_id> <commands> " "where commands are those that you specify", help_text="Docker exec against a container running your service", command='docker_exec', function=paasta_docker_exec, subparsers=subparsers) new_parser.add_argument('exec_command', help='Command to append to docker docker_exec', nargs='?', default='/bin/bash')
def test_get_subparser(): mock_subparser = mock.Mock() mock_function = mock.Mock() mock_command = "test" mock_help_text = "HALP" mock_description = "what_i_do" utils.get_subparser( subparsers=mock_subparser, function=mock_function, help_text=mock_help_text, description=mock_description, command=mock_command, ) mock_subparser.add_parser.assert_called_with( "test", help="HALP", description=("what_i_do"), epilog=("Note: This command requires SSH and " "sudo privileges on the remote PaaSTA nodes."), ) mock_subparser.add_parser.return_value.set_defaults.assert_called_with( command=mock_function)
def add_subparser(subparsers): new_parser = get_subparser(description="'paasta sysdig' works by SSH'ing to remote PaaSTA masters and " "running sysdig with the neccessary filters", help_text="Run sysdig on a remote host and filter to a service and instance", command='sysdig', function=paasta_sysdig, subparsers=subparsers) new_parser.add_argument( '-l', '--local', help="Run the script here rather than SSHing to a PaaSTA master", default=False, action='store_true' )
def add_subparser(subparsers): new_parser = get_subparser( description= "'paasta docker_exec' works by picking a container running your service " "at random. It then runs docker exec -ti <container_id> <commands> " "where commands are those that you specify", help_text="Docker exec against a container running your service", command='docker_exec', function=paasta_docker_exec, subparsers=subparsers) new_parser.add_argument('exec_command', help='Command to append to docker docker_exec', nargs='?', default='/bin/bash')
def add_subparser(subparsers): new_parser = get_subparser( description= "'paasta sysdig' works by SSH'ing to remote PaaSTA masters and " "running sysdig with the neccessary filters", help_text= "Run sysdig on a remote host and filter to a service and instance", command='sysdig', function=paasta_sysdig, subparsers=subparsers) new_parser.add_argument( '-l', '--local', help="Run the script here rather than SSHing to a PaaSTA master", default=False, action='store_true')
def add_subparser(subparsers): new_parser = get_subparser( description="'paasta docker_exec' works by picking a container running your service " "at random. It then runs docker exec -ti <container_id> <commands> " "where commands are those that you specify", help_text="Docker exec against a container running your service", command="docker_exec", function=paasta_docker_exec, subparsers=subparsers, ) new_parser.add_argument( "--user", help="User to exec into the container as (e.g. root)" ) new_parser.add_argument( "exec_command", help="Command to append to docker docker_exec", nargs="?", default="/bin/bash", )