This repository was archived by the owner on Feb 13, 2023. It is now read-only.
File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 39
39
# Verify version requirements.
40
40
require_ansible_version ">= #{ vconfig [ 'drupalvm_ansible_version_min' ] } "
41
41
Vagrant . require_version ">= #{ vconfig [ 'drupalvm_vagrant_version_min' ] } "
42
+ require_virtualbox_version ">= #{ vconfig [ 'drupalvm_virtualbox_version_min' ] } "
42
43
43
44
Vagrant . configure ( '2' ) do |config |
44
45
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ vagrant_cpus: 1
36
36
# Minimum required versions.
37
37
drupalvm_vagrant_version_min : ' 1.8.6'
38
38
drupalvm_ansible_version_min : ' 2.2'
39
+ drupalvm_virtualbox_version_min : ' 5.1.10'
39
40
40
41
# Force use of ansible_local provisioner, even if Ansible is installed on host.
41
42
force_ansible_local : false
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ def ansible_version
55
55
/^[^\s ]+ (.+)$/ . match ( `#{ ansible_bin } --version` ) { |match | return match [ 1 ] }
56
56
end
57
57
58
+ def virtualbox_version
59
+ virtualbox = VagrantPlugins ::ProviderVirtualBox ::Driver ::Meta . new
60
+ virtualbox . version
61
+ rescue Vagrant ::Errors ::VirtualBoxNotDetected
62
+ nil
63
+ end
64
+
58
65
# Require that if installed, the ansible version meets the requirements.
59
66
def require_ansible_version ( requirement )
60
67
return unless ansible_bin
@@ -63,6 +70,14 @@ def require_ansible_version(requirement)
63
70
raise_message "You must install an Ansible version #{ requirement } to use this version of Drupal VM."
64
71
end
65
72
73
+ # Require that if installed, the VirtualBox version meets the requirements.
74
+ def require_virtualbox_version ( requirement )
75
+ return unless virtualbox_version
76
+ req = Gem ::Requirement . new ( requirement )
77
+ return if req . satisfied_by? ( Gem ::Version . new ( virtualbox_version ) )
78
+ raise_message "You must install a VirtualBox version #{ requirement } to use this version of Drupal VM."
79
+ end
80
+
66
81
def raise_message ( msg )
67
82
raise Vagrant ::Errors ::VagrantError . new , msg
68
83
end
You can’t perform that action at this time.
0 commit comments