简体   繁体   中英

Read Vagrantfile programmatically with Ruby

Is there any way to read the Vagrantfiles with ruby natively, without having to read the content of the file and then parse for parts of the configuration that I need?

The idea is to read for a required parameter of the Vagrantfile, and use the piece of information elsewhere, I tried to include the Vagrantfile, since it is a ruby file, but I believe the file is just executed and a guest OS will be started, and my script will be blocked until vagrant returns the control back to my script.

Like cmur2 said.

Be particularly wary since the vagrant environment can overwrite the Vagrantfile in the host environment. It gets mounted read-write.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM