Sha256: e7b187e7e2b1450f1c12ab113de57988411931a23f6a065ad6249ae77b74b30c
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
require 'vagrant-vultr/helpers/client' module VagrantPlugins module Vultr module Action class Create include Helpers::Client def initialize(app, env) @app = app @machine = env[:machine] @client = client @logger = Log4r::Logger.new('vagrant::vultr::create') end def call(env) region = env[:machine].provider_config.region plan = env[:machine].provider_config.plan os = env[:machine].provider_config.os snapshot = env[:machine].provider_config.snapshot @logger.info "Creating server with:" @logger.info " -- Region: #{region}" @logger.info " -- OS: #{os}" @logger.info " -- Plan: #{plan}" @logger.info " -- Snapshot: #{snapshot}" attributes = { region: region, os: os, plan: plan, snapshot: snapshot, ssh_key_name: Action::SetupSSHKey::NAME } @machine.id = @client.create_server(attributes) env[:ui].info 'Waiting for subcription to become active...' @client.wait_to_activate(@machine.id) env[:ui].info 'Waiting for server to start...' @client.wait_to_power_on(@machine.id) env[:ui].info 'Waiting for SSH to become active...' @client.wait_for_ssh(@machine) env[:ui].info 'Machine is booted and ready to use!' @app.call(env) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-vultr-0.1.2 | lib/vagrant-vultr/action/create.rb |
vagrant-vultr-0.1.1 | lib/vagrant-vultr/action/create.rb |
vagrant-vultr-0.1.0 | lib/vagrant-vultr/action/create.rb |