簡體   English   中英

流浪漢找不到家/流浪漢/hiera.yaml

[英]Vagrant not able to find home/vagrant/hiera.yaml

我繼承了一個使用Puppet,Vagrant和VirtualBox來配置本地Centos測試機的python應用程序。

該應用程序是在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 ...中找到。類似地,如果我將它裝進盒子,在home / vagrant內部絕對沒有任何東西,但是當我在/ tmp中查看時可以找到此文件

所以我很困惑,流浪漢是否正在“虛擬”框中查看並期望在home / vagrant / hiera.yaml中找到該文件? 還是我繼承了最初無法正常運行的應用程序? 我真的被困在這里,無法與原始開發人員聯系。

以下是我的Vagrantfile中的一些詳細信息:

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 ,它將當前目錄(其中包含Vagrantfile目錄)掛載到來賓計算機上的/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文件的絕對路徑,而不是相對路徑。

警告應該消失了。

暫無
暫無

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

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