python - 无法使用 Puppet 设置 Python 3 的安装目录

标签 python puppet

我继承了一堆 Puppet 脚本,并且正在更新它们。我的脚本之一是用于安装 Python 的。我想将其安装到C:/bin/Python34。但是,每次我运行 Puppet 脚本时,它都会安装到 C:/Python34。如果我手动运行安装程序,我会发现这是默认安装位置,因此看起来我没有正确覆盖脚本中的目录。

我的代码如下:

class python( $installer = 'python-3.4.2.msi' )
{
    package
    {
        'Python3':
        ensure => 'installed',
        source => "\\\\myApp.server\\Python\\${installer}",
        install_options => { 'INSTALLDIR' => 'C:\bin\Python34' },
    }
}

不幸的是,当我在运行脚本时运行 --debug 选项时,似乎没有出现错误:

Debug: Prefetching windows resources for package
Debug: Executing 'msiexec.exe /qn /norestart /i \\myApp.server\Python\python-3.4.2.msi INSTALLDIR=C:\bin\Python34'
Notice: /Stage[main]/Python/Package[Python3]/ensure: created
Debug: /Package[Python3]: The container Class[Python] will propagate my refresh event
Debug: Class[Python]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 53869152
Debug: Storing state
Debug: Stored state in 0.01 seconds
Notice: Finished catalog run in 39.22 seconds
Debug: Using settings: adding file resource 'rrddir': 'File[C:/ProgramData/PuppetLabs/puppet/var/rrd]{:path=>"C:/ProgramData/PuppetLabs/puppet/var/rrd", :mode=>"750", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}'
Debug: Finishing transaction 48943728
Debug: Received report to process from bgtmnwl-659gxw1.peroot.com
Debug: Processing report from bgtmnwl-659gxw1.peroot.com with processor Puppet::Reports::Store

这段代码似乎适用于其他软件,但不适用于 Python。我正在以管理员身份运行命令提示符。

Python 的安装程序有什么不同吗?为什么 Puppet 无法设置 Python 3 的安装目录?

最佳答案

Puppet 使用 msiexec 安装 python。要设置安装目录,请提供 TARGETDIR 而不是 INSTALLDIR。请点击链接了解更多explanation .

关于python - 无法使用 Puppet 设置 Python 3 的安装目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30266866/

相关文章:

python - numpy.astype 与 numba 的非常奇怪的结果

python - 如何从另一个类继承变量

python - 使用链接删除链表中的节点

puppet - 如何使用 Puppet 需要另一个自定义类

ssl - Puppet:无法从远程服务器检索目录

Python:通过遍历列表列表将项目附加到列表

python - 在三引号 fstring 中保留缩进

puppet - 如何使用 Puppet 参数化类来强制应用资源的顺序?

ruby - Puppet 模板迭代和 yaml 文件