pip install -r requirements.txt from puppet?

 书友70030711 发布于 2023-01-30 17:40

我有一个pip样式的requirements.txt文件,用于跟踪我的python依赖项,我正在将我的开发环境移动到vagrant + puppet.到目前为止,我一直在使用内置于puppet的pip提供程序来安装这样的单个包:

package {
  ["django", "nose"]:
      ensure => present,
      provider => pip
}

是否有可能传递我的requirements.txt并让puppet在文件发生变化时保持包更新?

1 个回答
  • 对的,这是可能的.而不是定义包资源,而是定义一个"exec"资源,它将把requirements.txt作为变量并运行pip install命令.

    例如

    class pip_install(
     $path_requirements_file,
    ){
    
      exec { "pip_requirements_install":
        command     => "pip install -r ${path_requirements_file}",
        refreshonly => true,
      }
    
    }
    

    2023-01-30 17:41 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有