Sha256: 19034708d5abbda9a94f8d000b65f660498388c8e2ddf2b1b7f355aa4687f7d1

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

require 'log4r'
require 'vagrant'

module VagrantPlugins
  module VCloudAir
    class Provider < Vagrant.plugin('2', :provider)
      def initialize(machine)
        @machine = machine
      end

      def action(name)
        action_method = "action_#{name}"
        return Action.send(action_method) if Action.respond_to?(action_method)
        nil
      end

      def ssh_info
        env = @machine.action('read_ssh_info')
        env[:machine_ssh_info]
      end

      def state
        env = @machine.action('read_state')

        state_id = env[:machine_state_id]

        # Translate into short/long descriptions
        short = state_id.to_s.gsub('_', ' ')
        long  = I18n.t("vagrant_vcloudair.vm.states.#{state_id}")

        # Return the MachineState object
        Vagrant::MachineState.new(state_id, short, long)
      end

      def to_s
        id = @machine.id.nil? ? 'new' : @machine.id
        "vCloud Air (#{id})"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-vcloudair-0.5.3 lib/vagrant-vcloudair/provider.rb
vagrant-vcloudair-0.5.2 lib/vagrant-vcloudair/provider.rb
vagrant-vcloudair-0.5.1 lib/vagrant-vcloudair/provider.rb
vagrant-vcloudair-0.5.0 lib/vagrant-vcloudair/provider.rb