Пример #1
0
def apply_config_by_methods(config, settings):
    from lib import methods

    methodNames = config['needs']
    for methodName in methodNames:
        m = methods.getMethod(methodName)
        m.applyConfig(config, settings)
Пример #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

  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
Пример #3
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
Пример #4
0
def apply_config_by_methods(config, settings):
  from lib import methods

  methodNames = config['needs']
  for methodName in methodNames:
    m = methods.getMethod(methodName)
    m.applyConfig(config, settings)
Пример #5
0
def get_default_config_from_methods(config, settings, defaults):
    from lib import methods

    methodNames = config['needs']
    for methodName in methodNames:
        m = methods.getMethod(methodName)
        m.getDefaultConfig(config, settings, defaults)

    return defaults
Пример #6
0
def get_default_config_from_methods(config, settings, defaults):
  from lib import methods

  methodNames = config['needs']
  for methodName in methodNames:
    m = methods.getMethod(methodName)
    m.getDefaultConfig(config, settings, defaults)

  return defaults
Пример #7
0
def validate_config_against_methods(config):
    from lib import methods

    errors = validate_dict(['rootFolder', 'type', 'needs'], config)
    methodNames = config['needs']
    for methodName in methodNames:
        m = methods.getMethod(methodName)
        e = m.validateConfig(config)
        errors = data_merge(errors, e)

    if len(errors) > 0:
        for key, msg in errors.iteritems():
            print red('Key \'%s\' in %s: %s' %
                      (key, config['config_name'], msg))

        exit(1)
Пример #8
0
def validate_config_against_methods(config):
  from lib import methods

  errors = validate_dict(['rootFolder', 'type', 'needs'], config)
  methodNames = config['needs']
  for methodName in methodNames:
    m = methods.getMethod(methodName)
    e = m.validateConfig(config)
    errors = data_merge(errors, e)

  if len(errors) > 0:
    for key, msg in errors.iteritems():
      log.error('Key \'%s\' in %s: %s' % (key, config['config_name'], msg))

    exit(1)

  if config['rootFolder'][-1:] == '/':
    config['rootFolder'] = config['rootFolder'][:-1]