簡體   English   中英

無法從環境生產源檢索信息

[英]Could not retrieve information from environment production source

我在我的一個流浪項目中使用木偶作為我的供應者。 我正在嘗試為自定義bash_profile添加模塊。

puppet的module_path設置為:

 puppet.module_path = "puppet/modules"

我的bash_profile模塊的類看起來像這樣:

class bash_profile
{
    file
    {
        "/home/vagrant/bash_profile":
            ensure => present,
            source => "puppet:///modules/bash_profile/files/bash_profile"
    }
}

這是我的木偶結構的文件結構:

puppet
| manifests
| | phpbase.pp // my main manifest file that has includes for modules
| modules
| | bash_profile
| | | files
| | | | bash_profile // the actual bash_profile file I want to ensure is present on my VM
| | | manifests
| | | | init.pp // the init file included for the bash_profile class

當我為vagrant運行配置時,我收到錯誤

錯誤:/ Stage [main] / Bash_profile / File [/ home / vagrant / bash_profile]:無法評估:無法從環境生產源中檢索信息:/// modules / bash_profile / files / bash_profile at / tmp /vagrant-puppet-1/modules-0/bash_profile/manifests/init.pp:8

我不確定為什么它無法檢索信息。 路徑似乎是正確的。 任何人都能看到我錯過的東西嗎?

是的,您不應該在URL中包含文字files/ 相反,它應該是

puppet:///modules/bash_profile/bash_profile

如果模塊名稱無效,您可能還會收到recurse => true錯誤。 例如,如果您有此模塊結構:

modules ├── my-example │ └── files │ └── example │ └── test.txt

而這個資源:

file { "/tmp/example":
  ensure => directory,
  recurse => true,
  source => "puppet:///modules/my-example/example",
}

你會收到這個錯誤:

==> default: Info: Could not find filesystem info for file 'my-example/example' in environment production ==> default: Error: /Stage[main]/Main/Node[default]/File[/tmp/example]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///my-example/example

修復是重命名模塊 - 例如,命名my_example修復它。 模塊名稱規則已記錄在案,但很容易遺漏。

需要關心的事情

  1. Puppet URI格式puppet:///modules/name_of_module/filename
  2. 要存在於模塊目錄中的fileserver目錄

視頻是顯示解決錯誤的分步指南

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM