我有一个 pip 样式的 requirements.txt 文件,用于跟踪我的 python 依赖项,我正在将我的开发环境转移到 vagrant + puppet。到目前为止,我一直在使用 puppet 中内置的 pip 提供程序来安装单个软件包,如下所示:
package {
["django", "nose"]:
ensure => present,
provider => pip
}
是否可以改为传入我的 requirements.txt 并让 puppet 在该文件更改时使包保持最新?
最佳答案
是的,这是可能的。不要定义包资源,而是定义一个“exec”资源,它将 requirements.txt 作为变量并运行 pip install 命令。
例如
class pip_install(
$path_requirements_file,
){
exec { "pip_requirements_install":
command => "pip install -r ${path_requirements_file}",
refreshonly => true,
}
}
关于python - pip install -r requirements.txt 来自 puppet ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21420205/