2016-05-23 14 views
0

で簡単なキーのスキャン中に、私はエラーを取得する:ベイグラント - メッセージ:サイコ::にSyntaxError:(<unknown>):期待見つけることができませんでした ':' 私は</p> <pre><code>vagrant up </code></pre> <p>を実行している場合は行9列1

There was an error loading a Vagrantfile. The file being loaded 
and the error message are shown below. This is usually caused by 
a syntax error. 

Path: /Users/darius/PhpstormProjects/api.notification.guru/Vagrantfile 
Line number: 0 
Message: Psych::SyntaxError: (<unknown>): could not find expected ':' while scanning a simple key at line 9 column 1 

放浪ファイル次のようになります。構文エラーが行9にする必要があります

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

require 'fileutils' 

Vagrant.require_version ">= 1.6.0" 

CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "cloud-config") 
CONFIG = File.join(File.dirname(__FILE__), "vm-config.rb") 
CA_CERT_PATH = File.join(File.dirname(__FILE__), "certs/domain.pem") 

# Defaults for config options defined in CONFIG 
$num_instances = 1 
$instance_name_prefix = "core" 
$update_channel = "stable" 
$image_version = "current" 
$enable_serial_logging = false 
$share_home = false 
$vm_gui = false 
$vm_memory = 1024 
$vm_cpus = 1 
$shared_folders = {} 
$forwarded_ports = {} 

# Attempt to apply the deprecated environment variable NUM_INSTANCES to 
# $num_instances while allowing config.rb to override it 
if ENV["NUM_INSTANCES"].to_i > 0 && ENV["NUM_INSTANCES"] 
    $num_instances = ENV["NUM_INSTANCES"].to_i 
end 

if File.exist?(CONFIG) 
    require CONFIG 
end 

# Use old vb_xxx config variables when set 
def vm_gui 
    $vb_gui.nil? ? $vm_gui : $vb_gui 
end 

def vm_memory 
    $vb_memory.nil? ? $vm_memory : $vb_memory 
end 

def vm_cpus 
    $vb_cpus.nil? ? $vm_cpus : $vb_cpus 
end 

Vagrant.configure("2") do |config| 
    # always use Vagrants insecure key 
    config.ssh.insert_key = false 

    config.vm.box = "coreos-%s" % $update_channel 
    if $image_version != "current" 
     config.vm.box_version = $image_version 
    end 
    config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant.json" % [$update_channel, $image_version] 

    config.vm.provider :virtualbox do |v| 
    # On VirtualBox, we don't have guest additions or a functional vboxsf 
    # in CoreOS, so tell Vagrant that so it can be smarter. 
    v.check_guest_additions = false 
    v.functional_vboxsf  = false 
    end 

    # plugin conflict 
    if Vagrant.has_plugin?("vagrant-vbguest") then 
    config.vbguest.auto_update = false 
    end 

    (1..$num_instances).each do |i| 
    config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 
     config.vm.provider :virtualbox do |vb| 
     vb.name = "api.notification.guru-%s" % [vm_name] 
     end 

     config.vm.hostname = vm_name 

     if $enable_serial_logging 
     logdir = File.join(File.dirname(__FILE__), "log") 
     FileUtils.mkdir_p(logdir) 

     serialFile = File.join(logdir, "%s-serial.txt" % vm_name) 
     FileUtils.touch(serialFile) 

     config.vm.provider :virtualbox do |vb, override| 
      vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"] 
      vb.customize ["modifyvm", :id, "--uartmode1", serialFile] 
     end 
     end 

     if $expose_docker_tcp 
     config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true 
     end 

     $forwarded_ports.each do |guest, host| 
     config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true 
     end 

     config.vm.provider :virtualbox do |vb| 
     vb.gui = vm_gui 
     vb.memory = vm_memory 
     vb.cpus = vm_cpus 
     end 

     ip = "172.17.3.#{i+100}" 
     config.vm.network :private_network, ip: ip 

     # Uncomment below to enable NFS for sharing the host machine into the coreos-vagrant VM. 
     config.vm.synced_folder ".", "/home/core/shared", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp,noatime'] 
     $shared_folders.each_with_index do |(host_folder, guest_folder), index| 
     config.vm.synced_folder host_folder.to_s, guest_folder.to_s, id: "core-share%02d" % index, nfs: true, mount_options: ['nolock,vers=3,udp'] 
     end 

     if $share_home 
     config.vm.synced_folder ENV['HOME'], ENV['HOME'], id: "home", :nfs => true, :mount_options => ['nolock,vers=3,udp'] 
     end 

     if File.exist?(CLOUD_CONFIG_PATH) 
     config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data" 
     config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true 
     end 

     if File.exist?(CA_CERT_PATH) 
     config.vm.provision :file, :source => "#{CA_CERT_PATH}", :destination => "/tmp/domain.pem" 
     config.vm.provision :shell, :inline => "mv /tmp/domain.pem /etc/ssl/certs/domain.pem && update-ca-certificates > /dev/null", :privileged => true 
     end 
    end 
    end 
end 

私は私の同僚をチェックするように求め誰がこれを使うのか - 彼はその行は同じであり、彼は間違いをしないと言った。

他の同様の投稿でyamlファイルをチェックしてみましたが、どのファイルがあるのか​​わかりません。私は、このエラーに関連するものがいくつかあるとは思わない。

symfonyプロジェクトです。ベンダーフォルダー内の一部のパッケージからのymlファイルのみが表示されます。だから何かするべきではない。

アイデア?

+0

本当にこのファイルから本当にわからない - Vagrantfileからこの行と対応する部分を削除し、それが機能するかどうかを確認しようとしましたか? –

+0

私は今、別の行にエラーを取得しようとしました。「メッセージ:NameError:初期化されていない定数CONFIG」 - 意味があるCONFIGは初期化されません –

+0

vm-config.rbファイルをあなたの同僚と比較するべきでしょうそこから - なぜ私が言ったのか、Vagrantfile(configが使われている意味)から対応する部分を削除する/ファイルの9行目を見てください –

答えて

0

実際には、行番号9が迷彩ファイルではありませんでした。これは、以前の行に墜落:

CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "cloud-config") 

し、私は雲-configファイルが

< < < < < < < HEAD

のような競合を持っていたし、それがそのファイルの読み込みに失敗しました。クラウド設定がgitにないため、これらの競合がどのようにそこにあるのかわかりません。

しかし、私はGitのクラウドconfig.distファイルから行をコピーした後、tempplateタグ

discovery: https://discovery.etcd.io/<token> 

と、このトークンがoverwritenたとマシンがlauchedた

vagrant up 

を実行するがありました。

関連する問題

 関連する問題