【问题标题】:Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/toolchain无法评估:无法从环境生产源中检索信息 puppet:///modules/toolchain
【发布时间】:2020-09-17 17:58:44
【问题描述】:

我正在尝试编写一个简单的资源来将可怕故事的内容从 puppet master 复制到 puppet agent。

file { "/usr/local/scaligent/" :
    ensure => 'directory',
    source => "puppet:///modules/toolchain",
    recurse => 'true',
    #owner => 'root',
    #group => 'root',
    #mode => '0755',
}

source 是 puppet master 中的 /etc/puppetlabs/code/environments/production/modules/files/toolchain/,destination 是 puppet agent 中的 /usr/local/scaligent/。

傀儡代理出现以下错误:

[~]$ sudo puppet agent -tv --noop
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Applying configuration version '1600365429'
Error: /Stage[main]/Main/File[/usr/local/scaligent/]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/toolchain
Notice: Applied catalog in 0.04 seconds
[ ~]$

【问题讨论】:

    标签: directory puppet


    【解决方案1】:

    根据 Puppet resource type referencepuppet: URI 的形式是

    puppet:///modules/<MODULE NAME>/<FILE PATH>
    

    它是指模块中的文件或目录的内容,Puppet 将在该模块的files 目录中查找它。文件系统路径类似于/etc/puppetlabs/code/environments/production/modules/&lt;MODULE NAME&gt;/files/toolchain

    您尝试使用的 URI puppet:///modules/toolchain 格式不正确,并且您尝试引用的路径不在任何模块的 files/ 目录中。

    将“toolchain”目录放在包含资源声明的模块文件中是常规的,尽管不是必需的。但是,将File 声明放在一个类、一个模块中也是很常规的做法,但您还没有这样做。正如您所做的那样,在顶级范围内声明该资源是一种好的风格,几乎为零。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 1970-01-01
      • 2023-04-09
      • 2018-11-08
      • 2014-03-28
      • 1970-01-01
      相关资源
      最近更新 更多