我在Vagrantfile(vagrant 1.7.4)中有以下内容,
arg1=ENV['LINUX_USERNAME']
arg2=ENV['LINUX_PASSWORD']
config.vm.provision "shell" do |s|
s.path="create_user.bash"
s.args = [arg1, arg2]
end
编辑:更新缺失的信息
我在名为install.bash
echo ""
read -p "Linux username: " LINUX_USERNAME
read -s -p "Linux password: " LINUX_PASSWORD
echo ""
echo "export LINUX_USERNAME=$LINUX_USERNAME"
echo "export LINUX_PASSWORD=$LINUX_PASSWORD"
echo "Using Linux Username $LINUX_USERNAME"
echo "Using Linux Password $LINUX_PASSWORD"
vagrant up
运行install.bash
时,我收到以下错误消息,
shell provisioner:
* Shell provisioner `args` must be a string or array.
我想也许在流浪阶段没有正确读取环境变量。请注意,如果我在命令行设置环境变量然后运行vagrant up