Beispiel #1
0
def fish_completions():
  tasks = list_commands('', 'normal')
  tasks.pop(0)
  for task in tasks:
    print task.strip()

  conf = configuration.getAll()
  for key in conf['hosts'].keys():
    print "config:" + key
    print "copyFrom:" + key
    print "copyDBFrom:" + key
    print "copyFilesFrom:" + key

  if 'scripts' in conf:
    for key in conf['scripts'].keys():
      print "script:" + key

  if 'dockerHosts' in conf:
    tasks = set()
    for key in conf['dockerHosts'].keys():
      docker_conf = configuration.getDockerConfig(key, False, False)
      if docker_conf:
        tasks.update(methods.getMethod('docker').getInternalCommands() + docker_conf['tasks'].keys())
    for key in tasks:
      print "docker:" + key
Beispiel #2
0
def fish_completions():
  tasks = list_commands('', 'normal')
  tasks.pop(0)
  for task in tasks:
    print task.strip()

  conf = configuration.getAll()
  for key in conf['hosts'].keys():
    print "config:" + key
    print "copyFrom:" + key
    print "copyDBFrom:" + key
    print "copyFilesFrom:" + key
    print "installFrom:" + key

  if 'scripts' in conf:
    for key in conf['scripts'].keys():
      print "script:" + key

  if 'dockerHosts' in conf:
    tasks = set()
    for key in conf['dockerHosts'].keys():
      docker_conf = configuration.getDockerConfig(key, False, False)
      if docker_conf:
        tasks.update(methods.getMethod('docker').getInternalCommands() + docker_conf['tasks'].keys())
    for key in tasks:
      print "docker:" + key
Beispiel #3
0
def help():
    # print("called!")

    commands = list_commands(None, "nested")

    support_type = ['cmd', 'cloud', 'classic', 'config', 'io', 'py', 'git']
    ignore = ['Dumper', 'Loader', 'bind_cloud', 'bind_hosts', 'dump',
              'dump_codes']
    origin = ['Available commands:']

    print(commands)

    # commands.split("\n")

    return
    #
    for c in commands_buff:

        compare = c.strip()

        print(compare)

        if compare in ignore:
            continue

        if compare in origin:
            print(c)
            continue

        # print("    " + c)
        pass
Beispiel #4
0
def help():
    # print("called!")

    commands = list_commands(None, "nested")

    support_type = ['cmd', 'cloud', 'classic', 'config', 'io', 'py', 'git']
    ignore = [
        'Dumper', 'Loader', 'bind_cloud', 'bind_hosts', 'dump', 'dump_codes'
    ]
    origin = ['Available commands:']

    print(commands)

    # commands.split("\n")

    return
    #
    for c in commands_buff:

        compare = c.strip()

        print(compare)

        if compare in ignore:
            continue

        if compare in origin:
            print(c)
            continue

        # print("    " + c)
        pass
Beispiel #5
0
def usage():
    """
    Prints this usage information
    """
    puts("usage: fab host.HOST TASK[:OPTIONS]")
    puts("See the list below for available host.HOST and TASK choices.")
    puts("Use fab -d TASK for a list of that task's available options.")
    puts("\n".join(list_commands("", "normal")))
Beispiel #6
0
def display_fabric_tasks():
    paths = find_fabfile()
    docstring, callables, default = load_fabfile(paths)
    callables.pop('setup', None)
    state.commands.update(callables)

    commands = list_commands(docstring, 'normal')
    print("\n".join(commands))
Beispiel #7
0
 def prompt_for_command():
     import fabric.state
     from fabric.main import list_commands, _task_names
     
     command_list = [
         cmd
         for cmd in list_commands('No command supplied!', 'normal')
         if  not cmd.startswith('    prompt_for_command') and
             re.subn(r'^    ([^\s]+).*', r'\1', cmd)[0] not in stages.STAGE_NAMES
     ]
     print '\n'.join(command_list) + '\n'
     
     cmd = None
     while cmd is None:
         cmd = prompt(white('Please select a command:', bold=True)).strip()
         if cmd == 'prompt_for_command':
             print "Stop being an ass."
             cmd = None
         elif cmd not in _task_names(fabric.state.commands):
             print "%r is not a valid command!" % cmd
             cmd = None
     
     execute(cmd)
Beispiel #8
0
def polish(env='dev'):
    """Polish code by running some or all sniffs
    :param env: Environment to determine what all sniffs to run
                Options: 'dev', 'ci'
                Default: 'dev'
    :type env: str

    When environment is 'ci', all the sniffs registered are run.
    When environment is 'dev', only fast-critical and fast-major
    sniffs are run.
    """
    fabric_tasks = list_commands('', 'short')
    results = list()
    with settings(warn_only=True):
        if env == 'ci':
            sniffs_to_run = []
            for sniff in _sniffs:
                if sniff['function'].name not in fabric_tasks:
                    continue
                sniffs_to_run.append(sniff)
        elif env == 'dev':
            sniffs_to_run = []
            for sniff in _sniffs:
                if sniff['function'].name not in fabric_tasks:
                    continue
                if sniff['timing'] != 'fast':
                    continue
                if sniff['severity'] not in ('critical', 'major'):
                    continue
                sniffs_to_run.append(sniff)
        else:
            raise ValueError('env must be one of: ' + str(['dev', 'ci']))
        for sniff in sniffs_to_run:
            results.append(sniff['function']())

    if any(result.failed for result in results):
        sys.exit(1)
Beispiel #9
0
def eq_output(docstring, format_, expected):
    return eq_(
        "\n".join(list_commands(docstring, format_)),
        expected
    )
Beispiel #10
0
def eq_output(docstring, format_, expected):
    return eq_("\n".join(list_commands(docstring, format_)), expected)