vagrant-config_builder 0.15.1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +18 -4
- data/CHANGELOG +44 -0
- data/Gemfile +3 -4
- data/lib/config_builder/model/base.rb +182 -8
- data/lib/config_builder/model/network/forwarded_port.rb +34 -13
- data/lib/config_builder/model/network/private_network.rb +17 -1
- data/lib/config_builder/model/network/public_network.rb +39 -0
- data/lib/config_builder/model/nfs.rb +33 -0
- data/lib/config_builder/model/provider/aws.rb +16 -39
- data/lib/config_builder/model/provider/azure.rb +11 -33
- data/lib/config_builder/model/provider/base.rb +37 -0
- data/lib/config_builder/model/provider/libvirt.rb +33 -39
- data/lib/config_builder/model/provider/openstack.rb +69 -0
- data/lib/config_builder/model/provider/openstack_plugin.rb +46 -0
- data/lib/config_builder/model/provider/softlayer.rb +85 -0
- data/lib/config_builder/model/provider/virtualbox.rb +84 -17
- data/lib/config_builder/model/provider/vmware.rb +6 -4
- data/lib/config_builder/model/provider/vsphere.rb +33 -15
- data/lib/config_builder/model/provisioner/base.rb +33 -0
- data/lib/config_builder/model/provisioner/file.rb +1 -10
- data/lib/config_builder/model/provisioner/puppet.rb +32 -22
- data/lib/config_builder/model/provisioner/puppet_server.rb +21 -15
- data/lib/config_builder/model/provisioner/shell.rb +28 -10
- data/lib/config_builder/model/root.rb +28 -4
- data/lib/config_builder/model/ssh.rb +29 -11
- data/lib/config_builder/model/synced_folder.rb +83 -14
- data/lib/config_builder/model/vm.rb +111 -52
- data/lib/config_builder/model/winrm.rb +27 -7
- data/lib/config_builder/model.rb +9 -1
- data/lib/config_builder/model_delegator.rb +5 -24
- data/lib/config_builder/version.rb +1 -1
- data/spec/integration/vagrant/root_config_spec.rb +89 -0
- data/spec/integration/vagrant/vm_config_spec.rb +101 -0
- data/spec/integration/vagrant/vm_provider_spec.rb +57 -0
- data/spec/integration/vagrant/vm_provisioner_spec.rb +90 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/{config_builder → unit}/filter/boxes_spec.rb +0 -0
- data/spec/{config_builder → unit}/filter/roles_spec.rb +0 -0
- data/spec/{config_builder → unit}/loader/yaml_spec.rb +0 -0
- data/spec/unit/model/base_spec.rb +122 -0
- data/spec/{config_builder → unit}/model/provider/vmware_fusion_spec.rb +6 -5
- data/templates/locales/en.yml +4 -0
- metadata +33 -20
@@ -0,0 +1,37 @@
|
|
1
|
+
# Abstract base class for Vagrant providers
|
2
|
+
#
|
3
|
+
# @abstract
|
4
|
+
#
|
5
|
+
# @since 0.16.0
|
6
|
+
#
|
7
|
+
# @see https://www.vagrantup.com/docs/providers/configuration.html
|
8
|
+
class ConfigBuilder::Model::Provider::Base < ConfigBuilder::Model::Base
|
9
|
+
def_model_delegator :overrides
|
10
|
+
|
11
|
+
def to_proc
|
12
|
+
Proc.new do |vm_config|
|
13
|
+
vm_config.provider instance_id do |config, overrides|
|
14
|
+
configure!(config)
|
15
|
+
|
16
|
+
# NOTE: All models inheriting from this class need to provide
|
17
|
+
# delegators which can consume a tuple of provider and override
|
18
|
+
# configuration.
|
19
|
+
eval_models([config, overrides])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def eval_overrides(configs)
|
25
|
+
with_attr(:overrides) do |hash|
|
26
|
+
_, overrides = configs
|
27
|
+
r = ConfigBuilder::Model::Root.new_from_hash(hash)
|
28
|
+
r.call(overrides)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Set this to the name of the 'provider': 'vsphere', 'openstack', 'vmware',
|
33
|
+
# etc.
|
34
|
+
def instance_id
|
35
|
+
raise NotImplementedError
|
36
|
+
end
|
37
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# @see http://github.com/pradels/vagrant-libvirt
|
2
|
-
class ConfigBuilder::Model::Provider::Libvirt < ConfigBuilder::Model::Base
|
2
|
+
class ConfigBuilder::Model::Provider::Libvirt < ConfigBuilder::Model::Provider::Base
|
3
3
|
|
4
4
|
# @!attribute [rw] uri
|
5
5
|
# @return [String] Manually specify URI
|
@@ -15,7 +15,7 @@ class ConfigBuilder::Model::Provider::Libvirt < ConfigBuilder::Model::Base
|
|
15
15
|
|
16
16
|
# @!attribute [rw] connect_via_ssh
|
17
17
|
# @return [String] If use ssh tunnel to connect to Libvirt.
|
18
|
-
def_model_attribute :connect_via_ssh
|
18
|
+
def_model_attribute :connect_via_ssh
|
19
19
|
|
20
20
|
# @!attribute [rw] socket
|
21
21
|
# @return [String] Path towards the libvirt socket
|
@@ -50,58 +50,52 @@ class ConfigBuilder::Model::Provider::Libvirt < ConfigBuilder::Model::Base
|
|
50
50
|
# @return [String] Libvirt default network address
|
51
51
|
def_model_attribute :management_network_address
|
52
52
|
|
53
|
+
# @!attribute [rw] management_network_mode
|
54
|
+
# @return [String]
|
55
|
+
def_model_attribute :management_network_mode
|
56
|
+
|
57
|
+
# @!attribute [rw] management_network_mac
|
58
|
+
# @return [String]
|
59
|
+
def_model_attribute :management_network_mac
|
60
|
+
|
53
61
|
# @!attribute [rw] default_prefix
|
54
62
|
# @return [String] Default host prefix (alternative to use project folder
|
55
63
|
# name)
|
56
64
|
def_model_attribute :default_prefix
|
57
65
|
|
58
66
|
# Domain specific settings used while creating new domain.
|
67
|
+
def_model_attribute :uuid
|
59
68
|
def_model_attribute :memory
|
60
69
|
def_model_attribute :cpus
|
61
70
|
def_model_attribute :cpu_mode
|
71
|
+
def_model_attribute :loader
|
72
|
+
def_model_attribute :boot_order
|
73
|
+
def_model_attribute :machine_type
|
74
|
+
def_model_attribute :machine_arch
|
75
|
+
def_model_attribute :machine_virtual_size
|
62
76
|
def_model_attribute :disk_bus
|
77
|
+
def_model_attribute :nic_model_type
|
63
78
|
def_model_attribute :nested
|
64
79
|
def_model_attribute :volume_cache
|
65
80
|
def_model_attribute :kernel
|
66
81
|
def_model_attribute :cmd_line
|
67
82
|
def_model_attribute :initrd
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
with_attr(:id_ssh_key_file) { |val| vb_config.id_ssh_key_file = val }
|
85
|
-
with_attr(:storage_pool_name) { |val| vb_config.storage_pool_name = val }
|
86
|
-
with_attr(:random_hostname) { |val| vb_config.random_hostname = val }
|
87
|
-
with_attr(:management_network_name) { |val|
|
88
|
-
vb_config.username = val
|
89
|
-
}
|
90
|
-
with_attr(:management_network_address) { |val|
|
91
|
-
vb_config.username = val
|
92
|
-
}
|
93
|
-
with_attr(:default_prefix) { |val| vb_config.username = val }
|
94
|
-
with_attr(:memory) { |val| vb_config.memory = val }
|
95
|
-
with_attr(:cpus) { |val| vb_config.cpus = val }
|
96
|
-
with_attr(:cpu_mode) { |val| vb_config.cpu_mode = val }
|
97
|
-
with_attr(:disk_bus) { |val| vb_config.disk_bus = val }
|
98
|
-
with_attr(:nested) { |val| vb_config.nested = val }
|
99
|
-
with_attr(:volume_cache) { |val| vb_config.volume_cache = val }
|
100
|
-
with_attr(:kernel) { |val| vb_config.kernel = val }
|
101
|
-
with_attr(:cmd_line) { |val| vb_config.cmd_line = val }
|
102
|
-
with_attr(:initrd) { |val| vb_config.initrd = val }
|
103
|
-
end
|
104
|
-
end
|
83
|
+
def_model_attribute :graphics_type
|
84
|
+
def_model_attribute :graphics_autoport
|
85
|
+
def_model_attribute :graphics_port
|
86
|
+
def_model_attribute :graphics_passwd
|
87
|
+
def_model_attribute :graphics_ip
|
88
|
+
def_model_attribute :video_type
|
89
|
+
def_model_attribute :video_vram
|
90
|
+
def_model_attribute :keymap
|
91
|
+
def_model_attribute :nic_adapter_count
|
92
|
+
def_model_attribute :disks
|
93
|
+
def_model_attribute :cdroms
|
94
|
+
def_model_attribute :inputs
|
95
|
+
def_model_attribute :suspend_mode
|
96
|
+
|
97
|
+
def instance_id
|
98
|
+
'libvirt'
|
105
99
|
end
|
106
100
|
|
107
101
|
ConfigBuilder::Model::Provider.register('libvirt', self)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# @see https://github.com/ggiamarchi/vagrant-openstack-provider
|
2
|
+
class ConfigBuilder::Model::Provider::Openstack < ConfigBuilder::Model::Provider::Base
|
3
|
+
|
4
|
+
# Credentials
|
5
|
+
def_model_attribute :username
|
6
|
+
def_model_attribute :password
|
7
|
+
def_model_attribute :tenant_name
|
8
|
+
def_model_attribute :region
|
9
|
+
def_model_attribute :openstack_auth_url
|
10
|
+
def_model_attribute :openstack_compute_url
|
11
|
+
def_model_attribute :openstack_network_url
|
12
|
+
def_model_attribute :openstack_volume_url
|
13
|
+
def_model_attribute :openstack_image_url
|
14
|
+
def_model_attribute :openstack_orchestration_url
|
15
|
+
def_model_attribute :endpoint_type
|
16
|
+
|
17
|
+
# VM Configuration
|
18
|
+
def_model_attribute :server_name
|
19
|
+
def_model_attribute :flavor
|
20
|
+
def_model_attribute :image
|
21
|
+
def_model_attribute :availability_zone
|
22
|
+
def_model_attribute :security_groups
|
23
|
+
def_model_attribute :user_data
|
24
|
+
def_model_attribute :metadata
|
25
|
+
def_model_attribute :scheduler_hints
|
26
|
+
|
27
|
+
# Floating IPs
|
28
|
+
def_model_attribute :floating_ip
|
29
|
+
def_model_attribute :floating_ip_pool
|
30
|
+
def_model_attribute :floating_ip_pool_always_allocate
|
31
|
+
|
32
|
+
# Networks
|
33
|
+
def_model_attribute :networks
|
34
|
+
|
35
|
+
# Volumes
|
36
|
+
def_model_attribute :volumes
|
37
|
+
def_model_attribute :volume_boot
|
38
|
+
|
39
|
+
# Orchestration Stacks
|
40
|
+
def_model_attribute :stacks
|
41
|
+
def_model_attribute :stack_create_timeout
|
42
|
+
def_model_attribute :stack_delete_timeout
|
43
|
+
|
44
|
+
# SSH authentication
|
45
|
+
def_model_attribute :keypair_name
|
46
|
+
def_model_attribute :public_key_path
|
47
|
+
def_model_attribute :ssh_username
|
48
|
+
def_model_attribute :ssh_disabled
|
49
|
+
def_model_attribute :ssh_timeout
|
50
|
+
|
51
|
+
# Synced folders
|
52
|
+
def_model_attribute :sync_method
|
53
|
+
def_model_attribute :rsync_includes
|
54
|
+
def_model_attribute :rsync_ignore_files
|
55
|
+
|
56
|
+
# Timeouts
|
57
|
+
def_model_attribute :server_create_timeout
|
58
|
+
def_model_attribute :server_active_timeout
|
59
|
+
def_model_attribute :server_stop_timeout
|
60
|
+
def_model_attribute :server_delete_timeout
|
61
|
+
def_model_attribute :http_open_timeout
|
62
|
+
def_model_attribute :http_read_timeout
|
63
|
+
|
64
|
+
def instance_id
|
65
|
+
'openstack'
|
66
|
+
end
|
67
|
+
|
68
|
+
ConfigBuilder::Model::Provider.register('openstack', self)
|
69
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# @see https://github.com/cloudbau/vagrant-openstack-plugin
|
2
|
+
class ConfigBuilder::Model::Provider::OpenstackPlugin < ConfigBuilder::Model::Provider::Base
|
3
|
+
|
4
|
+
def_model_attribute :username
|
5
|
+
def_model_attribute :api_key
|
6
|
+
def_model_attribute :tenant
|
7
|
+
def_model_attribute :region
|
8
|
+
def_model_attribute :endpoint
|
9
|
+
def_model_attribute :proxy
|
10
|
+
def_model_attribute :ssl_verify_peer
|
11
|
+
|
12
|
+
def_model_attribute :server_name
|
13
|
+
def_model_attribute :flavor
|
14
|
+
def_model_attribute :image
|
15
|
+
def_model_attribute :availability_zone
|
16
|
+
def_model_attribute :security_groups
|
17
|
+
def_model_attribute :user_data
|
18
|
+
def_model_attribute :metadata
|
19
|
+
def_model_attribute :scheduler_hints
|
20
|
+
|
21
|
+
def_model_attribute :floating_ip
|
22
|
+
def_model_attribute :floating_ip_pool
|
23
|
+
|
24
|
+
def_model_attribute :network
|
25
|
+
def_model_attribute :networks
|
26
|
+
def_model_attribute :address_id
|
27
|
+
|
28
|
+
def_model_attribute :disks
|
29
|
+
|
30
|
+
def_model_attribute :orchestration_stack_name
|
31
|
+
def_model_attribute :orchestration_stack_destroy
|
32
|
+
def_model_attribute :orchestration_cfn_template
|
33
|
+
def_model_attribute :orchestration_cfn_template_file
|
34
|
+
def_model_attribute :orchestration_cfn_template_url
|
35
|
+
def_model_attribute :orchestration_cfn_template_parameters
|
36
|
+
|
37
|
+
def_model_attribute :keypair_name
|
38
|
+
def_model_attribute :ssh_username
|
39
|
+
def_model_attribute :ssh_ip_family
|
40
|
+
|
41
|
+
def instance_id
|
42
|
+
'openstack'
|
43
|
+
end
|
44
|
+
|
45
|
+
ConfigBuilder::Model::Provider.register('openstack_plugin', self)
|
46
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# @see https://github.com/audiolize/vagrant-softlayer
|
2
|
+
class ConfigBuilder::Model::Provider::SoftLayer < ConfigBuilder::Model::Provider::Base
|
3
|
+
def_model_attribute :api_key
|
4
|
+
def_model_attribute :endpoint_url
|
5
|
+
def_model_attribute :username
|
6
|
+
|
7
|
+
def_model_attribute :manage_dns
|
8
|
+
|
9
|
+
def_model_attribute :datacenter
|
10
|
+
def_model_attribute :dedicated
|
11
|
+
def_model_attribute :disk_capacity
|
12
|
+
def_model_attribute :domain
|
13
|
+
def_model_attribute :force_private_ip
|
14
|
+
def_model_attribute :hostname
|
15
|
+
def_model_attribute :hourly_billing
|
16
|
+
def_model_attribute :image_guid
|
17
|
+
def_model_attribute :local_disk
|
18
|
+
def_model_attribute :max_memory
|
19
|
+
def_model_attribute :network_speed
|
20
|
+
def_model_attribute :operating_system
|
21
|
+
def_model_attribute :post_install
|
22
|
+
def_model_attribute :private_only
|
23
|
+
def_model_attribute :start_cpus
|
24
|
+
def_model_attribute :user_data
|
25
|
+
def_model_attribute :vlan_private
|
26
|
+
def_model_attribute :vlan_public
|
27
|
+
def_model_attribute :ssh_key
|
28
|
+
# Aliases for ssh_key
|
29
|
+
def_model_attribute :ssh_keys
|
30
|
+
def_model_attribute :ssh_key_id
|
31
|
+
def_model_attribute :ssh_key_ids
|
32
|
+
def_model_attribute :ssh_key_name
|
33
|
+
def_model_attribute :ssh_key_names
|
34
|
+
|
35
|
+
def_model_attribute :api_timeout
|
36
|
+
def_model_attribute :provision_timeout
|
37
|
+
def_model_attribute :rebuild_timeout
|
38
|
+
def_model_attribute :transaction_wait
|
39
|
+
|
40
|
+
def_model_delegator :load_balancers
|
41
|
+
|
42
|
+
def instance_id
|
43
|
+
'softlayer'
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def eval_load_balancers(configs)
|
49
|
+
provider, _ = configs
|
50
|
+
|
51
|
+
attr(:load_balancers).each do |hash|
|
52
|
+
v = ConfigBuilder::Model::Provider::SoftLayer::LoadBalancer.new_from_hash(hash)
|
53
|
+
v.call(provider)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class LoadBalancer < ConfigBuilder::Model::Base
|
58
|
+
|
59
|
+
def_model_attribute :destination_port
|
60
|
+
def_model_attribute :health_check
|
61
|
+
def_model_attribute :weight
|
62
|
+
|
63
|
+
def to_proc
|
64
|
+
Proc.new do |config|
|
65
|
+
config.join_load_balancer service_group_opts do |service|
|
66
|
+
with_attr(:destination_port) { |val| service.destination_port = val }
|
67
|
+
with_attr(:health_check) { |val| service.health_check = val }
|
68
|
+
with_attr(:weight) { |val| service.weight = val }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def service_group_opts
|
74
|
+
h = {}
|
75
|
+
with_attr(:method) { |val| h[:method] = val }
|
76
|
+
with_attr(:port) { |val| h[:port] = val }
|
77
|
+
with_attr(:type) { |val| h[:type] = val }
|
78
|
+
with_attr(:vip) { |val| h[:vip] = val }
|
79
|
+
h
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
ConfigBuilder::Model::Provider.register('softlayer', self)
|
85
|
+
end
|
@@ -1,35 +1,102 @@
|
|
1
1
|
# @see http://docs.vagrantup.com/v2/virtualbox/configuration.html
|
2
|
-
class ConfigBuilder::Model::Provider::Virtualbox < ConfigBuilder::Model::Base
|
2
|
+
class ConfigBuilder::Model::Provider::Virtualbox < ConfigBuilder::Model::Provider::Base
|
3
3
|
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
4
|
+
# Vagrant by default will make "smart" decisions to enable/disable
|
5
|
+
# the NAT DNS proxy. If this is set to `true`, then the DNS proxy
|
6
|
+
# will not be enabled, and it is up to the end user to do it.
|
7
|
+
#
|
8
|
+
# @return [Boolean]
|
9
|
+
def_model_attribute :auto_nat_dns_proxy
|
10
|
+
|
11
|
+
# If true, will check if guest additions are installed and up to
|
12
|
+
# date. By default, this is true.
|
13
|
+
#
|
14
|
+
# @return [Boolean]
|
15
|
+
def_model_attribute :check_guest_additions
|
7
16
|
|
8
17
|
# @!attribute [rw] customize
|
9
|
-
# @return [Array<String>] A list of customize arguments to use upon VM
|
18
|
+
# @return [Array<String>] A list of customize arguments to use upon VM
|
19
|
+
# instantiation.
|
10
20
|
def_model_attribute :customize
|
11
21
|
|
12
|
-
#
|
13
|
-
#
|
22
|
+
# Shortcut for setting CPU count for the virtual machine.
|
23
|
+
# Calls #customize internally.
|
24
|
+
#
|
25
|
+
# @param count [Integer, String] the count of CPUs
|
26
|
+
def_model_attribute :cpus
|
27
|
+
|
28
|
+
# If true, unused network interfaces will automatically be deleted.
|
29
|
+
# This defaults to false because the detection does not work across
|
30
|
+
# multiple users, and because on Windows this operation requires
|
31
|
+
# administrative privileges.
|
32
|
+
#
|
33
|
+
# @return [Boolean]
|
34
|
+
def_model_attribute :destroy_unused_network_interfaces
|
35
|
+
|
36
|
+
# If set to `true`, then VirtualBox will be launched with a GUI.
|
37
|
+
#
|
38
|
+
# @return [Boolean]
|
14
39
|
def_model_attribute :gui
|
15
40
|
|
41
|
+
# If set to `true`, then a linked clone is created from a master
|
42
|
+
# VM generated from the specified box.
|
43
|
+
#
|
44
|
+
# @return [Boolean]
|
45
|
+
def_model_attribute :linked_clone
|
46
|
+
|
47
|
+
# The snapshot to base the linked clone from. If this isn't set
|
48
|
+
# a snapshot will be made with the name of "base" which will be used.
|
49
|
+
#
|
50
|
+
# If this is set, then the snapshot must already exist.
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
def_model_attribute :linked_clone_snapshot
|
54
|
+
|
55
|
+
# Shortcut for setting memory size for the virtual machine.
|
56
|
+
# Calls #customize internally.
|
57
|
+
#
|
58
|
+
# @param size [Integer, String] the memory size in MB
|
59
|
+
def_model_attribute :memory
|
60
|
+
|
61
|
+
# This should be set to the name of the machine in the VirtualBox
|
62
|
+
# GUI.
|
63
|
+
#
|
64
|
+
# @return [String]
|
65
|
+
def_model_attribute :name
|
66
|
+
|
67
|
+
# Whether or not this VM has a functional vboxsf filesystem module.
|
68
|
+
# This defaults to true. If you set this to false, then the "virtualbox"
|
69
|
+
# synced folder type won't be valid.
|
70
|
+
#
|
71
|
+
# @return [Boolean]
|
72
|
+
def_model_attribute :functional_vboxsf
|
73
|
+
|
16
74
|
def initialize
|
17
75
|
@defaults = {:customize => []}
|
18
76
|
end
|
19
77
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
with_attr(:name) { |val| vb_config.name = val }
|
24
|
-
|
25
|
-
attr(:customize).each do |cmd|
|
26
|
-
vb_config.customize cmd
|
27
|
-
end
|
78
|
+
def instance_id
|
79
|
+
'virtualbox'
|
80
|
+
end
|
28
81
|
|
29
|
-
|
30
|
-
|
82
|
+
# @private
|
83
|
+
def configure_customize(config, val)
|
84
|
+
val.each do |cmd|
|
85
|
+
config.customize(cmd)
|
31
86
|
end
|
32
87
|
end
|
33
88
|
|
89
|
+
# @private
|
90
|
+
def configure_linked_clone(config, val)
|
91
|
+
# Linked clone support landed in Vagrant 1.8
|
92
|
+
config.linked_clone = val if (Vagrant::VERSION > '1.8')
|
93
|
+
end
|
94
|
+
|
95
|
+
# @private
|
96
|
+
def configure_linked_clone_snapshot(config, val)
|
97
|
+
# Linked clone support landed in Vagrant 1.8
|
98
|
+
config.linked_clone_snapshot = val if (Vagrant::VERSION > '1.8')
|
99
|
+
end
|
100
|
+
|
34
101
|
ConfigBuilder::Model::Provider.register('virtualbox', self)
|
35
102
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# @see http://docs.vagrantup.com/v2/vmware/configuration.html
|
2
|
-
class ConfigBuilder::Model::Provider::VMware < ConfigBuilder::Model::Base
|
2
|
+
class ConfigBuilder::Model::Provider::VMware < ConfigBuilder::Model::Provider::Base
|
3
3
|
|
4
4
|
# @!attribute [rw] vmx
|
5
5
|
# @return [Hash<String, String>] A hash of VMX options for the given VM
|
@@ -26,11 +26,13 @@ class ConfigBuilder::Model::Provider::VMware < ConfigBuilder::Model::Base
|
|
26
26
|
def to_proc
|
27
27
|
Proc.new do |vm_config|
|
28
28
|
@providers.each do |vmware_provider|
|
29
|
-
vm_config.provider vmware_provider do |
|
30
|
-
|
29
|
+
vm_config.provider vmware_provider do |provider, override|
|
30
|
+
provider.gui = attr(:gui)
|
31
31
|
attr(:vmx).each_pair do |key, value|
|
32
|
-
|
32
|
+
provider.vmx[key] = value
|
33
33
|
end
|
34
|
+
|
35
|
+
eval_models([provider, override])
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -1,14 +1,31 @@
|
|
1
1
|
# @see https://github.com/nsidc/vagrant-vsphere
|
2
|
-
class ConfigBuilder::Model::Provider::Vsphere< ConfigBuilder::Model::Base
|
2
|
+
class ConfigBuilder::Model::Provider::Vsphere< ConfigBuilder::Model::Provider::Base
|
3
3
|
|
4
|
-
|
4
|
+
def_model_attribute :host
|
5
|
+
def_model_attribute :insecure
|
6
|
+
def_model_attribute :user
|
7
|
+
def_model_attribute :password
|
8
|
+
def_model_attribute :data_center_name
|
9
|
+
def_model_attribute :compute_resource_name
|
10
|
+
def_model_attribute :resource_pool_name
|
11
|
+
def_model_attribute :clone_from_vm
|
12
|
+
def_model_attribute :template_name
|
13
|
+
def_model_attribute :name
|
14
|
+
def_model_attribute :vm_base_path
|
15
|
+
def_model_attribute :customization_spec_name
|
16
|
+
def_model_attribute :data_store_name
|
17
|
+
def_model_attribute :linked_clone
|
18
|
+
def_model_attribute :proxy_host
|
19
|
+
def_model_attribute :proxy_port
|
20
|
+
def_model_attribute :vlan
|
21
|
+
def_model_attribute :addressType
|
22
|
+
def_model_attribute :mac
|
23
|
+
def_model_attribute :memory_mb
|
24
|
+
def_model_attribute :cpu_count
|
25
|
+
def_model_attribute :cpu_reservation
|
26
|
+
def_model_attribute :mem_reservation
|
5
27
|
|
6
|
-
|
7
|
-
# The mandatory attributes will be verified by vagrant-vsphere
|
8
|
-
# @see https://github.com/nsidc/vagrant-vsphere#configuration
|
9
|
-
VSPHERE_ATTRIBUTES.each do |key|
|
10
|
-
def_model_attribute attr
|
11
|
-
end
|
28
|
+
def_model_attribute :custom_attributes
|
12
29
|
|
13
30
|
def initialize
|
14
31
|
@defaults = {
|
@@ -16,13 +33,14 @@ class ConfigBuilder::Model::Provider::Vsphere< ConfigBuilder::Model::Base
|
|
16
33
|
}
|
17
34
|
end
|
18
35
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
36
|
+
def instance_id
|
37
|
+
'vsphere'
|
38
|
+
end
|
39
|
+
|
40
|
+
# @private
|
41
|
+
def config_custom_attributes(config, val)
|
42
|
+
val.each do |e|
|
43
|
+
config.custom_attribute(*e)
|
26
44
|
end
|
27
45
|
end
|
28
46
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Abstract base class for Vagrant provisioners
|
2
|
+
#
|
3
|
+
# @abstract
|
4
|
+
#
|
5
|
+
# @since 0.16.0
|
6
|
+
#
|
7
|
+
# @see https://www.vagrantup.com/docs/provisioning/basic_usage.html
|
8
|
+
class ConfigBuilder::Model::Provisioner::Base < ConfigBuilder::Model::Base
|
9
|
+
def_model_option :name
|
10
|
+
def_model_option :type
|
11
|
+
def_model_option :run
|
12
|
+
def_model_option :preserve_order
|
13
|
+
|
14
|
+
def to_proc
|
15
|
+
Proc.new do |vm_config|
|
16
|
+
options = instance_options
|
17
|
+
|
18
|
+
name = options.delete(:name)
|
19
|
+
if name.nil?
|
20
|
+
name = options.delete(:type)
|
21
|
+
elsif Vagrant::VERSION < '1.7'
|
22
|
+
# Vagrant 1.6 and earlier used "id" instead of "name".
|
23
|
+
options[:id] = name
|
24
|
+
name = options.delete(:type)
|
25
|
+
end
|
26
|
+
|
27
|
+
vm_config.provision(name, **options) do |config|
|
28
|
+
configure!(config)
|
29
|
+
eval_models(config)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# @see http://docs.vagrantup.com/v2/provisioning/file.html
|
2
|
-
class ConfigBuilder::Model::Provisioner::File < ConfigBuilder::Model::Base
|
2
|
+
class ConfigBuilder::Model::Provisioner::File < ConfigBuilder::Model::Provisioner::Base
|
3
3
|
# @!attribute [rw] source
|
4
4
|
# @return [Source] Is the local path of the file to be uploaded.
|
5
5
|
def_model_attribute :source
|
@@ -11,14 +11,5 @@ class ConfigBuilder::Model::Provisioner::File < ConfigBuilder::Model::Base
|
|
11
11
|
# determined by running vagrant ssh-config, and defaults to "vagrant".
|
12
12
|
def_model_attribute :destination
|
13
13
|
|
14
|
-
def to_proc
|
15
|
-
Proc.new do |vm_config|
|
16
|
-
vm_config.provision :file do |file_config|
|
17
|
-
with_attr(:source) { |val| file_config.source = val }
|
18
|
-
with_attr(:destination) { |val| file_config.destination = val }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
14
|
ConfigBuilder::Model::Provisioner.register('file', self)
|
24
15
|
end
|