为什么我在此Vagrantfile中遇到语法错误

时间:2019-10-08 14:33:48

标签: ubuntu vagrant syntax-error vagrantfile

我刚刚开始学习如何使用Vagrant!因此,当我尝试在Vagrant中迈出第一步时,我正在尝试使用“ vagrant up”创建一个vagrant环境,但在Vagrantfile上却出现语法错误。这是Vagrantfile:

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

Vagrant.configure("2") do |config|

# Always use Vagrant's default insecure key
  config.ssh.insert_key = false
# Always use X11 Forwarding with r+this machine
  config.ssh.forward_x11 = true
# To avoid/allow install and uninstall of VBoxGuessAdditions.
  config.vbguest.auto_update = false
# Disable/enable automatic box update checking.
  config.vm.box_check_update = false



# Assign a friendly name for vagrant STATUS
  config.vm.define "mininet" do |mininet_config|
  # Every Vagrant development environment requires a box.
  mininet_config.vm.box = "ktr/mininet"
  # Assign a friendly name to this host VM
  mininet_config.vm.hostname = "mininet"
  # Create a private network, which allows host-only access to the machine
  mininet_config.vm.network "private_network", ip: "192.168.56.11"
  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant.
  # Example for VirtualBox:
    mininet_config.vm.provider "virtualbox" do |vb|
    # Change the VM name/ID in the Hypervisor
      vb.name = "mininet"
      opts = ["modifyvm", :id, "--natdnshostresolver1", "on"]
      vb.customize opts
    end
  end

# Some shell provisioning when machine is launched
 config.vm.provision "shell", :inline "apt-get update --fix-missing"

end

这是终端的警告:

 syntax error, unexpected tSTRING_BEG, expecting keyword_end
m.provision "shell", :inline "apt-get update --fix-missing"
                              ^
/home/alexandre/Desktop/3ano/RC/lab1/RC/mininet-updated/Vagrantfile:38: syntax error, unexpected keyword_end, expecting end-of-input

如果有人能帮助我解决这个问题,我将非常感激。 谢谢您的时间

0 个答案:

没有答案