modulepackage
0.0.0-20240411124306-8f1017fbc46f
Repository: https://github.com/kafeg/vagrantutil.git
Documentation: pkg.go.dev
# README
Vagrantutil 
Vagrantutil is a toolset for managing Vagrant boxes via an idiomatic Go (Golang) API. The package is work in progress, so please vendor it. Checkout the examples below for the usage.
Install
go get github.com/kafeg/vagrantutil
Usage and Examples
package main
import (
"log"
"github.com/koding/vagrantutil"
)
func main() {
vagrant, _ := vagrantutil.NewVagrant("myfolder")
vagrant.Create(`# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "vagrant"
config.vm.provider "virtualbox" do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048", "--cpus", "2"]
end
end
`)
status, _ := vagrant.Status() // prints "NotCreated"
// starts the box
output, _ := vagrant.Up()
// print the output
for line := range output {
log.Println(line)
}
// stop/halt the box
vagrant.Halt()
// destroy the box
vagrant.Destroy()
}
# Functions
NewVagrant returns a new Vagrant instance for the given path.
Wait is a convenience function that consumes Vagrant output looking for well-known errors.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Some possible states: https://github.com/mitchellh/vagrant/blob/master/templates/locales/en.yml#L1504.
# Variables
The following errors are returned by the Wait function:.
The following errors are returned by the Wait function:.
The following errors are returned by the Wait function:.
The following errors are returned by the Wait function:.
The following errors are returned by the Wait function:.
# Structs
Box represents a single line of `vagrant box list` output.
CommandOutput is the streaming output of a command.
No description provided by the author
Waiter is used to consume output channel from a Vagrant command, parsing each line looking for an error when command execution fails.
# Type aliases
No description provided by the author