push_puppetforge.py 文件源码

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

项目:sat6_scripts 作者: RedHatSatellite 项目源码 文件源码
def postModule(moduleTar, moduleInputDir, pfserver, pfmodpath, pfuser, pftoken):
    """
    Function to push puppet modules using curl to Artifiactory repository
    """
    # Remove module's extension (.tar.gz)
    puppetModuleNameNoExt = splitext(moduleTar)[0]

    # Remove the path from the module
    puppetModuleName = puppetModuleNameNoExt.split('/')[-1]

    # Split the module name into the required parts
    puppetModuleNameList = puppetModuleName.split('-')
    author = puppetModuleNameList[0]
    moduleName = puppetModuleNameList[1]
    version = puppetModuleNameList[2]

    url = "http://" + pfserver + pfmodpath + "/" + author + "/" + moduleName + "/" + moduleTar
    fileName = moduleInputDir + "/" + moduleTar

    # Put the files using curl (need to clean this up)
    authtoken = pfuser + ":" + pftoken
    subprocess.call(['curl', '-u', authtoken, '-XPUT', url, '-T', fileName])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号