from __future__ import print_function import json import os import shutil import subprocess from dcos import constants, util from dcos.errors import DCOSException logger = util.get_logger(__name__) def command_executables(subcommand): """List the real path to executable dcos program for specified subcommand. :param subcommand: name of subcommand. E.g. marathon :type subcommand: str :returns: the dcos program path :rtype: str """ executables = [ command_path for command_path in list_paths() if noun(command_path) == subcommand ] if len(executables) > 1: msg = 'Found more than one executable for command {!r}.' raise DCOSException(msg.format(subcommand))
import contextlib import datetime import functools import json import sys import time import six from dcos import emitting, http, packagemanager, sse, util from dcos.cosmos import get_cosmos_url from dcos.errors import DCOSException, DefaultError logger = util.get_logger(__name__) emitter = emitting.FlatEmitter() def _no_file_exception(): return DCOSException('No files exist. Exiting.') def log_files(mesos_files, follow, lines): """Print the contents of the given `mesos_files`. Behaves like unix tail. :param mesos_files: file objects to print :type mesos_files: [MesosFile] :param follow: same as unix tail's -f :type follow: bool :param lines: number of lines to print :type lines: int