def getTemplate(configName): settings = configuration.get_all_configurations() config = False if not configName: config = configuration.current() else: if configName in settings['hosts']: config = configuration.get(configName) if config and 'blueprint' in config: return config['blueprint'] if config and 'docker' in config: docker_config_name = config['docker']['configuration'] else: docker_config_name = configName if docker_config_name: docker_config = configuration.getDockerConfig(docker_config_name) if docker_config and 'blueprint' in docker_config: return docker_config['blueprint'] if settings and 'blueprint' in settings: return settings['blueprint'] return False
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
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
def createDestroyHelper(stages, command, **kwargs): dockerConfig = configuration.getDockerConfig( configuration.current()['docker']['configuration']) for step in stages: step['dockerConfig'] = dockerConfig log.info(command + ': current stage: \'{stage}\' via \'{connection}\''.format( **step)) hostConfig = {} for key in ['host', 'user', 'port']: hostConfig[key] = configuration.current()[key], methods.call(step['connection'], 'getHostConfig', configuration.current(), hostConfig=hostConfig) hostString = join_host_strings(**hostConfig) with _settings(host_string=hostString): methods.runTask(configuration.current(), command, quiet=True, **step)
def getDockerConfig(self, config): if not 'docker' in config or 'configuration' not in config['docker']: return False docker_config_name = config['docker']['configuration'] docker_config = configuration.getDockerConfig(docker_config_name, config['runLocally']) if docker_config and 'password' in docker_config: self.addPasswordToFabricCache(**docker_config) return docker_config
def createDestroyHelper(stages, command, **kwargs): dockerConfig = configuration.getDockerConfig(configuration.current()['docker']['configuration']) for step in stages: step['dockerConfig'] = dockerConfig log.info(command + ': current stage: \'{stage}\' via \'{connection}\''.format(**step)) hostConfig = {} for key in ['host', 'user', 'port']: hostConfig[key] = configuration.current()[key], methods.call(step['connection'], 'getHostConfig', configuration.current(), hostConfig=hostConfig) hostString = join_host_strings(**hostConfig) with _settings(host_string = hostString): methods.runTask(configuration.current(), command, quiet=True, **step)