Vagrant 无法从环境生产源检索信息

Vagrant 无法从环境生产源检索信息,vagrant,puppet,provisioning,vagrantfile,Vagrant,Puppet,Provisioning,Vagrantfile,在我的一个流浪项目中,我用木偶作为我的供给者。我正在尝试为自定义bash_配置文件添加一个模块 木偶的模块路径设置为: puppet.module_path = "puppet/modules" 我的bash_profile模块的类如下所示: class bash_profile { file { "/home/vagrant/bash_profile": ensure => present, source

在我的一个流浪项目中,我用木偶作为我的供给者。我正在尝试为自定义bash_配置文件添加一个模块

木偶的
模块路径
设置为:

 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\u profile/File[/home/vagrant/Bash\u profile]:无法评估:无法从环境生产源检索信息puppet:///modules/bash_profile/files/bash_profile at/tmp/vagrant-puppet-1/modules-0/bash_profile/manifests/init.pp:8


我不知道为什么它无法检索信息。这条路似乎是正确的。有人能看到我遗漏了什么吗?

是的,你不应该在URL中包含文字
文件/
。相反,它应该是

puppet:///modules/bash_profile/bash_profile
需要关心的事情

  • Puppet URI格式
    puppet:///modules/name_of_module/filename
  • 要显示在模块目录中的文件服务器目录

  • 这是一个解决错误的分步指南

    如果您的模块名无效,您也可能通过
    recurse=>true
    收到此错误。例如,如果您有此模块结构:

    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
    
    模块
    ├── 我的例子
    │   └── 文件夹
    │       └── 例子
    │           └── test.txt
    

    该资源:

    file { "/tmp/example":
      ensure => directory,
      recurse => true,
      source => "puppet:///modules/my-example/example",
    }
    
    您将得到以下错误:

    ==>默认值:信息:在生产环境中找不到文件“my example/example”的文件系统信息
    ==>默认值:错误:/Stage[main]/main/Node[default]/File[/tmp/example]:无法评估:无法从环境生产源检索信息puppet:///my-example/example
    


    例如,修复方法是重命名模块,将其命名为
    my_example
    fixes。但是很容易错过。

    @timbooo,只是好奇,你为什么要编辑标题?我用这种方式在问题前面加上前缀,这样以后我就可以更容易地回顾这些问题。没有必要在标题中添加标签,请参阅。您也可以使用标签以与主题相关的方式浏览您的问题。明白了,谢谢您的链接和说明。我只是阅读了相同的文档,但错过了相同的要点。四个小时试图弄清楚那个网址!我还尝试使用文件URI。我的同事说,在source属性中,需要关闭“file:”。我不确定,但这对他来说很有效。天啊,这完全违背了我对他的期望。