module VagrantPlugins::DigitalOcean::Actions

Public Class Methods

destroy() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 20
def self.destroy
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      else
        b.use Call, DestroyConfirm do |env2, b2|
          if env2[:result]
            b2.use Destroy
            b2.use ProvisionerCleanup if defined?(ProvisionerCleanup)
          end
        end
      end
    end
  end
end
halt() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 110
def self.halt
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        if env[:force_halt] 
          b.use PowerOff
        else
          b.use ShutDown
        end
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.already_off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
provision() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 71
def self.provision
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use Provision
        b.use ModifyProvisionPath
        b.use SyncFolders
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
rebuild() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 147
def self.rebuild
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active, :off
        b.use Rebuild
        b.use SetupSudo
        b.use SetupUser
        b.use provision
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
reload() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 130
def self.reload
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use Reload
        b.use provision
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
ssh() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 39
def self.ssh
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use SSHExec
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
ssh_run() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 55
def self.ssh_run
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use SSHRun
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end
up() click to toggle source
# File lib/vagrant-digitalocean/actions.rb, line 89
def self.up
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        env[:ui].info I18n.t('vagrant_digital_ocean.info.already_active')
      when :off
        b.use PowerOn
        b.use provision
      when :not_created
        b.use SetupKey
        b.use Create
        b.use SetupSudo
        b.use SetupUser
        b.use provision
      end
    end
  end
end