Cleanup sorting method for provisioner sorting

This commit is contained in:
Brian Cain 2019-08-28 14:32:51 -07:00
parent 8c39d9bfed
commit 160ee09da2
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 4 additions and 7 deletions

View File

@ -57,6 +57,7 @@ module Vagrant
return pvs
end
# ensure placeholder variables are Arrays
dep_provs = []
each_provs = []
all_provs = []
@ -83,8 +84,6 @@ module Vagrant
end
# Add :each and :all provisioners in reverse to preserve order in Vagrantfile
# add each to final array
tmp_final_provs = []
final_provs.each_with_index.map do |(prv,o), i|
tmp_before = []
@ -104,16 +103,14 @@ module Vagrant
end
final_provs = tmp_final_provs
# add all to final array
tmp_final_provs = final_provs.dup
# Add all to final array
all_provs.reverse_each do |p,options|
if options[:before]
tmp_final_provs.insert(0, [p,options])
final_provs.insert(0, [p,options])
elsif options[:after]
tmp_final_provs.push([p,options])
final_provs.push([p,options])
end
end
final_provs = tmp_final_provs
return final_provs
end