module VagrantPlugins::VSphere::Action

Public Class Methods

action_destroy() click to toggle source

Vagrant commands

# File lib/vSphere/action.rb, line 10
def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere

    b.use Call, IsRunning do |env, b2|
      if env[:result]
        if env[:force_confirm_destroy]
          b2.use PowerOff
          next
        end

        b2.use Call, GracefulHalt, :poweroff, :running do |env2, b3|
          b3.use PowerOff unless env2[:result]
        end
      end
    end
    b.use Destroy
  end
end
action_get_ssh_info() click to toggle source
# File lib/vSphere/action.rb, line 169
def self.action_get_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use GetSshInfo
    b.use CloseVSphere
  end
end
action_get_state() click to toggle source

vSphere specific actions

# File lib/vSphere/action.rb, line 159
def self.action_get_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use HandleBox
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use GetState
    b.use CloseVSphere
  end
end
action_halt() click to toggle source
# File lib/vSphere/action.rb, line 119
def self.action_halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Call, IsRunning do |env2, b3|
        unless env2[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use Call, GracefulHalt, :poweroff, :running do |env3, b4|
          b4.use PowerOff unless env3[:result]
        end
      end
    end
    b.use CloseVSphere
  end
end
action_provision() click to toggle source
# File lib/vSphere/action.rb, line 31
def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Call, IsRunning do |env2, b3|
        unless env2[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use Provision
        b3.use SyncedFolders
      end
    end
  end
end
action_reload() click to toggle source
# File lib/vSphere/action.rb, line 144
def self.action_reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConnectVSphere
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end
      b2.use action_halt
      b2.use action_up
    end
  end
end
action_ssh() click to toggle source
# File lib/vSphere/action.rb, line 53
def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Call, IsRunning do |env2, b3|
        unless env2[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use SSHExec
      end
    end
  end
end
action_ssh_run() click to toggle source
# File lib/vSphere/action.rb, line 74
def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Call, IsRunning do |env2, b3|
        unless env2[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use SSHRun
      end
    end
  end
end
action_up() click to toggle source
# File lib/vSphere/action.rb, line 95
def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use HandleBox
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use Call, IsCreated do |env, b2|
      if env[:result]
        b2.use MessageAlreadyCreated
        next
      end

      b2.use Clone
    end
    b.use Call, IsRunning do |env, b2|
      b2.use PowerOn unless env[:result]
    end
    b.use CloseVSphere
    b.use WaitForCommunicator
    b.use Provision
    b.use SyncedFolders
    b.use SetHostname
  end
end