Vagrant 流浪汉找不到家/流浪汉/hiera.yaml

Vagrant 流浪汉找不到家/流浪汉/hiera.yaml,vagrant,puppet,vagrantfile,Vagrant,Puppet,Vagrantfile,我继承了一个python应用程序,它使用Puppet、Vagrant和VirtualBox提供本地Centos测试机 此应用程序是在Mac上编写的,我正在Windows上开发。 当我运行vagrant up时,我看到一个很大的列表,其中最相关的是: Running Puppet with site.pp.. Warning: Config file /home/vagrant/hiera.yaml not found, using Hiera defaults WARN: Fri Apr

我继承了一个python应用程序,它使用Puppet、Vagrant和VirtualBox提供本地Centos测试机

此应用程序是在Mac上编写的,我正在Windows上开发。

当我运行
vagrant up
时,我看到一个很大的列表,其中最相关的是:

Running Puppet with site.pp..    
Warning: Config file /home/vagrant/hiera.yaml not found, using Hiera defaults
WARN: Fri Apr 25 16:32:24 +0100 2014: Not using Hiera::Puppet_logger. It does not report itself to b
e suitable.
我知道希拉是什么,为什么它很重要,但我不知道如何解决这个问题

文件hiera.yaml存在于回购协议中,但在home/vagrant/hiera.yaml中找不到,而是在./puppet/manifests/hiera.yaml….中找到。。。。类似地,如果我ssh到这个框中,home/vagrant中绝对没有任何内容,但是我可以在/tmp中找到这个文件

所以我很困惑,vagrant是否正在查看虚拟盒子,并希望在home/vagrant/hiera.yaml中找到此文件?还是我继承了一个一开始就不能正常工作的应用程序?我真的被困在这里了,我无法联系到原来的开发人员

以下是我的文件中的一些详细信息:

Vagrant.configure("2") do |config|
  # Base box configuration ommitted    
  # Forwarded ports ommitted   
  # Statically set hostname and internal network to match puppet env ommitted

  # Enable provisioning with Puppet standalone 
  config.vm.provision :puppet do |puppet|

    # Tell Puppet where to find the hiera config
    puppet.options = "--hiera_config hiera.yaml --manifestdir /tmp/vagrant-puppet/manifests"

    # Boilerplate Vagrant/Puppet configuration
    puppet.module_path = "puppet/modules"
    puppet.manifests_path = "puppet/manifests"
    puppet.manifest_file = "site.pp"

    # Custom facts provided to Puppet
    puppet.facter = {
      # Tells Puppet that we're running in Vagrant
      "is_vagrant" => true,
    }
  end

  # Make the client accessible
  config.vm.synced_folder "marflar_client/", "/opt/marflar_client"
end

这真的很奇怪。

有一行
puppet.options
告诉puppet在哪里查找hiera.yaml,目前它只指定了文件名。现在,当您运行
vagrant up
时,它会将当前目录(其中包含
vagrant文件的目录)装入来宾计算机上的
/vagrant
。由于您说的
hiera.yaml
实际上可以在
/puppet/manifests/hiera.yaml
中找到,因此我相信您希望更改
puppet.options
行,如下所示:

puppet.options = "--hiera_config /vagrant/puppet/manifests/hiera.yaml --manifestdir /tmp/vagrant-puppet/manifests"

要解决此警告,您可以首先尝试从引用此文件的位置进行检查,即:

$ grep -Rn hiera.yaml /etc/puppet
/etc/puppet/modules/stdlib/spec/spec_helper_acceptance.rb:13:    on hosts, '/bin/touch /etc/puppet/hiera.yaml'
/etc/puppet/modules/mysql/spec/spec_helper_acceptance.rb:34:      shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
在这种情况下,这是你的流浪汉档案

您也可以尝试通过以下方式找到正确的路径:

sudo updatedb && locate hiera.yaml
或者按照@EvgenyChernyavskiy的建议,如果找到该文件,则创建一个符号链接:

sudo ln -vs /etc/hiera.yaml /etc/puppet/hiera.yaml
或者创建空文件(
touch/etc/puppet/hiera.yaml

在您的情况下,应该使用hiera.yaml文件的绝对路径,而不是相对路径


警告应该消失。

可能值得注意的是,hiera_配置选项仅在Puppet 3中可用。*非常感谢,这个答案帮助我走得更远!令人惊叹的。