class VagrantPlugins::DigitalOcean::Config
Attributes
backups_enabled[RW]
ca_path[RW]
image[RW]
ipv6[RW]
private_networking[RW]
region[RW]
setup[RW]
setup?[RW]
size[RW]
ssh_key_name[RW]
token[RW]
user_data[RW]
Public Class Methods
new()
click to toggle source
# File lib/vagrant-digitalocean/config.rb, line 18 def initialize @token = UNSET_VALUE @image = UNSET_VALUE @region = UNSET_VALUE @size = UNSET_VALUE @private_networking = UNSET_VALUE @ipv6 = UNSET_VALUE @backups_enable = UNSET_VALUE @ca_path = UNSET_VALUE @ssh_key_name = UNSET_VALUE @setup = UNSET_VALUE @user_data = UNSET_VALUE end
Public Instance Methods
finalize!()
click to toggle source
# File lib/vagrant-digitalocean/config.rb, line 32 def finalize! @token = ENV['DO_TOKEN'] if @token == UNSET_VALUE @image = 'ubuntu-14-04-x64' if @image == UNSET_VALUE @region = 'nyc2' if @region == UNSET_VALUE @size = '512mb' if @size == UNSET_VALUE @private_networking = false if @private_networking == UNSET_VALUE @ipv6 = false if @ipv6 == UNSET_VALUE @backups_enabled = false if @backups_enabled == UNSET_VALUE @ca_path = nil if @ca_path == UNSET_VALUE @ssh_key_name = 'Vagrant' if @ssh_key_name == UNSET_VALUE @setup = true if @setup == UNSET_VALUE @user_data = nil if @user_data == UNSET_VALUE end
validate(machine)
click to toggle source
# File lib/vagrant-digitalocean/config.rb, line 46 def validate(machine) errors = [] errors << I18n.t('vagrant_digital_ocean.config.token') if !@token key = machine.config.ssh.private_key_path key = key[0] if key.is_a?(Array) if !key errors << I18n.t('vagrant_digital_ocean.config.private_key') elsif !File.file?(File.expand_path("#{key}.pub", machine.env.root_path)) errors << I18n.t('vagrant_digital_ocean.config.public_key', { :key => "#{key}.pub" }) end { 'DigitalOcean Provider' => errors } end