2014-12-17 2 views
1

로컬 Vagrant 시스템의 퍼핏 매니페스트에 문제가 있습니다. 디버깅을 시작하는 위치에오류 : 정의되지 않은 메소드 'ref'for nil : 노드의 NilClass vagrant-trusty64

Error: undefined method `ref' for nil:NilClass on node vagrant-trusty64.lan 
Error: undefined method `ref' for nil:NilClass on node vagrant-trusty64.lan 
The following SSH command responded with a non-zero exit status. 
Vagrant assumes that this means the command failed! 

puppet apply --modulepath '/tmp/vagrant-puppet-1/modules-0:/etc/puppet/modules' --hiera_config=/tmp/vagrant-puppet-1/hiera.yaml --manifestdir /tmp/vagrant-puppet-1/manifests --detailed-exitcodes /tmp/vagrant-puppet-1/manifests/vagrant.pp || [ $? -eq 2 ] 

Stdout from the command: 



Stderr from the command: 

stdin: is not a tty 
Error: undefined method `ref' for nil:NilClass on node vagrant-trusty64.lan 
Error: undefined method `ref' for nil:NilClass on node vagrant-trusty64.lan 

모든 아이디어 : 나는 규정에 나의 방랑 기계를 시도 할 때마다, 나는 원인을 찾을 수 없습니다 다음과 같은 출력을 받게?

Vagrantfile :

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 
VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    # Use Phusion's Ubuntu 12.04 box with support for Docker 
    config.vm.box = "phusion-open-ubuntu-14.04-amd64" 
    config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box" 
    # Set hostname 
    config.vm.hostname = "vagrant-trusty64" 

    # Configure the VirtualBox Provider 
    config.vm.provider :virtualbox do |vb| 
     # Give the VM 1GB of RAM 
     # vb.customize ["modifyvm", :id, "--memory", "1024"] 
    end 

    # Provisioning with Puppet Standalone 
    config.vm.provision :puppet do |puppet| 
     puppet.hiera_config_path = "conf/puppet/hiera.yaml" 
     puppet.manifests_path = "manifests" 
     puppet.manifest_file = "vagrant.pp" 
     puppet.module_path = "modules" 
    end 
end 
+0

이 항목을 시작하려면 '--trace' 옵션을 Puppet에 전달해야합니다. 방랑자 안에서 어떻게해야할지 모르겠다. –

+0

우리에게'Vagrantfile'을 보여주세요 – BMW

+0

@FelixFrank 나는 그것을하는 방법을 안다. 그것은 나의 다음 단계 일 것이다. –

답변

2

첫째, 질문에 대한 자신의 의견에 밖으로 Felix Frank 점으로, 이러한 문제를 디버깅 할 때, 방랑가 사용하는 인형 인수에 인형의 --trace 인수를 추가

Vagrant.configure("2") do |config| 
    config.vm.provision :puppet do |puppet| 
     # ... 
     puppet.options = ["--debug", "--trace"] 
    end 
end 

더 나은 해결책 :

Vagrant.configure("2") do |config| 
    config.vm.provision :puppet do |puppet| 
     # ... 
     if ENV.key?('PUPPET_OPTS') 
      puppet.options = ENV['PUPPET_OPTS'].split(' ') 
     end 
    end 
end 
실행할 때

위의 명령으로 간단하게 PUPPET_OPTS 환경 변수를 정의 :

PUPPET_OPTS="--trace --debug" vagrant provision 

는 인형의 일반 지점 일들이 실패되었다는 것을 명단을 밝혔다. 나는 몇 가지 물건을 주석 처리하고 다음 클래스에 문제 격리 : a, bcprofiles::some::long::path의 내부 클래스했다

class profiles::some::long::path { 
    contain a, b, c 
} 

을 .... 기묘한 점은 어쨌든이 정확한 코드가 지난 밤에 어떤 시점에서 잘 돌아갔다는 것입니다. I'm still trying to find out if there's an abridged syntax for including classes in the current class' package.

관련 문제