我安装了vagrant-hostmanager 1.8.6,当我运行function getInningRuns( xmlString, inningNumber) {
// parse xml string into xml nodes of type inning
// if xml is not received as a string, you can omit the $.parseXML()
var innings = $($.parseXML( xmlString )).find("inning");
// get requested inning
var inning = $.grep(innings, function(inning){
return ($(inning).attr("number") == inningNumber);
})[0];
// return runs attribute
return $(inning).attr("runs");
}
时,我最终出现以下错误:
vagrant hostmanager
...并且[vagrant-hostmanager:guest] Updating hosts file on the virtual machine puppet_server...
sh: 1: Syntax error: "(" unexpected
文件未更新。有办法解决这个问题吗?
这是我的VagrantFile:
/etc/hosts
我认为它与hosts文件本身有关,所以我清空它并重新运行命令,但它仍然没有更新它。
答案 0 :(得分:0)
has_many :stores, foreign_key: "store_id"
原因是shell错误,因为ruby拆分意外地包含在shell命令中。
有2个问题......
我尝试运行命令从命令行获取:
sh: 1: Syntax error: "(" unexpected
它产生了错误的IP地址......所以我尝试了:
VBoxManage guestproperty get "puppet_server" "/VirtualBox/GuestInfo/Net/1/V4/IP
Value: 172.x.x.x
我得到了我期待的地址。
块:
VBoxManage guestproperty get "puppet_server" "/VirtualBox/GuestInfo/Net/2/V4/IP
Value: 10.0.3.15
应该是:
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
`VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP".split()[1]`
end
end
然后,在启动所有计算机后,我再次运行 config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
`VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/2/V4/IP"`.split()[1]
end
end
,并按预期填写了所有vagrant hostmanager
个文件。