Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions qa/vagrant/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,26 @@ task checkVagrantVersion(type: Exec) {
standardOutput = new ByteArrayOutputStream()
doLast {
String version = standardOutput.toString().trim()
if ((version ==~ /Vagrant 1\.[789]\..+/) == false) {
throw new InvalidUserDataException(
"Illegal version of vagrant [${version}]. Need [Vagrant 1.7+]")
if ((version ==~ /Vagrant 1\.(8\.[6-9]|9\.[0-9])+/) == false) {
throw new InvalidUserDataException("Illegal version of vagrant [${version}]. Need [Vagrant 1.8.6+]")
}
}
}

task checkVirtualBoxVersion(type: Exec) {
commandLine 'vboxmanage', '--version'
standardOutput = new ByteArrayOutputStream()
doLast {
String version = standardOutput.toString().trim()
try {
String[] versions = version.split('\\.')
int major = Integer.parseInt(versions[0])
int minor = Integer.parseInt(versions[1])
if ((major < 5) || (major == 5 && minor < 1)) {
throw new InvalidUserDataException("Illegal version of virtualbox [${version}]. Need [5.1+]")
}
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
throw new InvalidUserDataException("Unable to parse version of virtualbox [${version}]. Required [5.1+]", e)
}
}
}
Expand Down Expand Up @@ -247,7 +264,7 @@ for (String box : availableBoxes) {
Task update = tasks.create("vagrant${boxTask}#update", VagrantCommandTask) {
boxName box
args 'box', 'update', box
dependsOn checkVagrantVersion
dependsOn checkVagrantVersion, checkVirtualBoxVersion
}

Task up = tasks.create("vagrant${boxTask}#up", VagrantCommandTask) {
Expand Down