deployment.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:fluiddb 作者: fluidinfo 项目源码 文件源码
def deployConfigFiles(templateData, *files):
    """
    Deploy configuration files, filling template fields with real deployment
    data.

    @param templateData: A C{dict} with the data to fill the templates.
    @param *files: A list C{(source, destination)} with information about what
        files to copy
    """
    serverName = templateData['server-name']

    for origin, destination in files:
        specificFilename = os.path.join('deployment', serverName, origin)
        defaultFilename = os.path.join('deployment', 'default', origin)
        origin = (specificFilename
                  if os.path.exists(specificFilename)
                  else defaultFilename)
        destination = destination.format(**templateData)
        put(origin, destination, use_sudo=True)

        for key, value in templateData.iteritems():
            sed(destination, '\{\{ %s \}\}' % key, value.replace('.', r'\.'),
                use_sudo=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号