pip install -r requirements.txt from puppet?

pio*_*hmy 10 python pip puppet

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

package {
  ["django", "nose"]:
      ensure => present,
      provider => pip
}
Run Code Online (Sandbox Code Playgroud)

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

coc*_*ese 8

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

例如

class pip_install(
 $path_requirements_file,
){

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

}
Run Code Online (Sandbox Code Playgroud)