Sha256: a2784a5ad76c2bc671fc2f4bbd8a1118c834b1ce10c068249f221ff478ebe832

Contents?: true

Size: 1.52 KB

Versions: 15

Compression:

Stored size: 1.52 KB

Contents

require 'pathname'
require 'vagrant-vcloud/plugin'

module VagrantPlugins
  module VCloud
    lib_path = Pathname.new(File.expand_path('../vagrant-vcloud', __FILE__))
    autoload :Action, lib_path.join('action')
    autoload :Errors, lib_path.join('errors')

    # This returns the path to the source of this plugin.
    #
    # @return [Pathname]
    def self.source_root
      @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
    end
  end
end

module Vagrant
  class Machine
    attr_reader :vappid

    def vappid=(value)
      @logger.info("New vApp ID: #{value.inspect}")

      # The file that will store the id if we have one. This allows the
      # ID to persist across Vagrant runs.

      id_file = @data_dir.join('../../../vcloud_vappid')

      ### this should be ./.vagrant/vcloud_vappid

      if value
        # Write the "id" file with the id given.
        id_file.open('w+') do |f|
          f.write(value)
        end
      else
        # Delete the file, since the machine is now destroyed
        id_file.delete if id_file.file?
      end

      # Store the ID locally
      @vappid = value

      # Notify the provider that the ID changed in case it needs to do
      # any accounting from it.
      # @provider.machine_id_changed
    end

    # This returns the vCloud Director vApp ID.
    #
    # @return [vAppId]
    def get_vapp_id
      vappid_file = @data_dir.join('../../../vcloud_vappid')
      if vappid_file.file?
        @vappid = vappid_file.read
      else
        nil
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vagrant-vcloud-0.5.0 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.7 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.6 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.4 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.3 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.2 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.1 lib/vagrant-vcloud.rb
vagrant-vcloud-0.4.0 lib/vagrant-vcloud.rb
vagrant-vcloud-0.3.3 lib/vagrant-vcloud.rb
vagrant-vcloud-0.3.2 lib/vagrant-vcloud.rb
vagrant-vcloud-0.3.1 lib/vagrant-vcloud.rb
vagrant-vcloud-0.3.0 lib/vagrant-vcloud.rb
vagrant-vcloud-0.2.2 lib/vagrant-vcloud.rb
vagrant-vcloud-0.2.1 lib/vagrant-vcloud.rb
vagrant-vcloud-0.2.0 lib/vagrant-vcloud.rb