libmachine/libmachine.go
func (api *Client) Create(h *host.Host) error {
	if err := cert.BootstrapCertificates(h.AuthOptions()); err != nil {
		return fmt.Errorf("Error generating certificates: %s", err)
	}

	log.Info("Running pre-create checks...")

	if err := h.Driver.PreCreateCheck(); err != nil {
		return mcnerror.ErrDuringPreCreate{
			Cause: err,
		}
	}

	if err := api.Save(h); err != nil {
		return fmt.Errorf("Error saving host to store before attempting creation: %s", err)
	}

	log.Info("Creating machine...")

	if err := api.performCreate(h); err != nil {
		return fmt.Errorf("Error creating machine: %s", err)
	}

	log.Debug("Reticulating splines...")

	return nil
}
func (api *Client) Create(h *host.Host) error {
	if err := cert.BootstrapCertificates(h.AuthOptions()); err != nil {
		return fmt.Errorf("Error generating certificates: %s", err)
	}

	log.Info("Running pre-create checks...")

	if err := h.Driver.PreCreateCheck(); err != nil {
		return mcnerror.ErrDuringPreCreate{
			Cause: err,
		}
	}

	if err := api.Save(h); err != nil {
		return fmt.Errorf("Error saving host to store before attempting creation: %s", err)
	}

	log.Info("Creating machine...")

	if err := api.performCreate(h); err != nil {
		return fmt.Errorf("Error creating machine: %s", err)
	}

	log.Debug("Reticulating splines...")

	return nil
}
func ( api * Client ) Create ( h * host . Host ) error { if err := cert . BootstrapCertificates ( h . AuthOptions ( ) ) ; err != nil { return fmt . Errorf ( " " , err ) } log . Info ( " " ) if err := h . Driver . PreCreateCheck ( ) ; err != nil { return mcnerror . ErrDuringPreCreate { Cause : err , } } if err := api . Save ( h ) ; err != nil { return fmt . Errorf ( " " , err ) } log . Info ( " " ) if err := api . performCreate ( h ) ; err != nil { return fmt . Errorf ( " " , err ) } log . Debug ( " " ) return nil }
// Create is the wrapper method which covers all of the boilerplate around
// actually creating, provisioning, and persisting an instance in the store.
Create is the wrapper method which covers all of the boilerplate around actually creating provisioning and persisting an instance in the store .