-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathplugin.rb
54 lines (46 loc) · 1.43 KB
/
plugin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
begin
require 'vagrant'
rescue LoadError
raise 'The Vagrant vSphere plugin must be run within Vagrant.'
end
# This is a sanity check to make sure no one is attempting to install
# this into an early Vagrant version.
if Vagrant::VERSION < '1.5'
fail 'The Vagrant vSphere plugin is only compatible with Vagrant 1.5+'
end
module VagrantPlugins
module VSphere
class Plugin < Vagrant.plugin('2')
name 'vsphere'
description 'Allows Vagrant to manage machines with VMWare vSphere'
config(:vsphere, :provider) do
require_relative 'config'
Config
end
provider(:vsphere, parallel: true) do
# TODO: add logging
setup_i18n
# Return the provider
require_relative 'provider'
Provider
end
provider_capability('vsphere', 'public_address') do
require_relative 'cap/public_address'
Cap::PublicAddress
end
# TODO: Remove the if guard when Vagrant 1.8.0 is the minimum version.
# rubocop:disable IndentationWidth
if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.8.0')
provider_capability('vsphere', 'snapshot_list') do
require_relative 'cap/snapshot_list'
Cap::SnapshotList
end
end
# rubocop:enable IndentationWidth
def self.setup_i18n
I18n.load_path << File.expand_path('locales/en.yml', VSphere.source_root)
I18n.reload!
end
end
end
end