2016-09-23 39 views
0

我不得不將我的流浪版本降級到與廚師衝突。現在我使用的是Vagrant 1.8.4,但是我遇到了自動配置功能的問題。此函數應使用與我的流浪文件相同的目錄中存在的bootstrap.sh文件來引導我創建的實例。這裏是我的Vagrantfile:Vagrant 1.8.4,無法運行文件供應商外殼

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

Vagrant.configure(2) do |config| 

    #gives the instances 1 extra network eth interfaces 
    config.vm.network "private_network", type: "dhcp" 

    #creates instances, defines linux image, hostname and a script to run on creation 
    config.vm.define "web1" do |web1| 
     web1.vm.box = "trusty64" 
     web1.vm.hostname = "web1" 
     #this will run the script bootstrap.sh that is in the same directory as the Vagrantfile 
     config.vm.provision :shell, path "bootstrap.sh" 
    end 
end 

當運行vagrant up我得到以下錯誤:

There is a syntax error in the following Vagrantfile. The syntax error 
message is reproduced below for convenience: 

/path/to/my/dir/Vagrantfile:14: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' 
     config.vm.provision :shell, path "bootstrap.sh" 
             ^

哪些是流浪1.8.4使用置備文件正確的語法?

回答

1

有2種方式把它寫在紅寶石

config.vm.provision "shell", path: "bootstrap.sh" 

,或者你可以寫

​​