From 9288d1e56cc59885c4a652d14b05558d1b2c2974 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 12 Mar 2014 23:09:34 -0300 Subject: [PATCH] core: Enable paralelization for Vagrant 1.2+ only --- lib/vagrant-backports/utils.rb | 16 +++++++++++++--- lib/vagrant-lxc/plugin.rb | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-backports/utils.rb b/lib/vagrant-backports/utils.rb index dec12f3..ca09514 100644 --- a/lib/vagrant-backports/utils.rb +++ b/lib/vagrant-backports/utils.rb @@ -1,16 +1,26 @@ module Vagrant module Backports class << self + def vagrant_1_2_or_later? + greater_than?('1.2.0') + end + def vagrant_1_3_or_later? - Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0') + greater_than?('1.3.0') end def vagrant_1_4_or_later? - Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.4.0') + greater_than?('1.4.0') end def vagrant_1_5_or_later? - Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.5.0') + greater_than?('1.5.0') + end + + private + + def greater_than?(version) + Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new(version) end end end diff --git a/lib/vagrant-lxc/plugin.rb b/lib/vagrant-lxc/plugin.rb index f489773..0bd0e19 100644 --- a/lib/vagrant-lxc/plugin.rb +++ b/lib/vagrant-lxc/plugin.rb @@ -10,7 +10,9 @@ module Vagrant LXC-based virtual machines. EOF - provider(:lxc, parallel: true) do + extra = [] + extra << {parallel: true} if Vagrant::Backports.vagrant_1_2_or_later? + provider(:lxc, *extra) do require File.expand_path("../provider", __FILE__) I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')