Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Vagrant includes for nodes and local #163

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 3 additions & 28 deletions distributed/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

31 changes: 3 additions & 28 deletions elastic/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

31 changes: 3 additions & 28 deletions env/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

31 changes: 3 additions & 28 deletions graylog/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

31 changes: 3 additions & 28 deletions influxdb/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

31 changes: 3 additions & 28 deletions standalone/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.8.0"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodes = {}
if not File.exists?("Vagrantfile.nodes") then
puts "ERROR: Vagrantfile.nodes is missing from source tree."
exit 1
end

eval(IO.read("Vagrantfile.nodes"), binding)

# allow to override the configuration
if File.exists?("Vagrantfile.local") then
eval(IO.read("Vagrantfile.local"), binding)
end
VAGRANT_HOME = File.dirname(__FILE__) unless defined? VAGRANT_HOME
require VAGRANT_HOME + "/../tools/vagrant_helper"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
$nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box_virtualbox]
node_config.vm.hostname = name + "." + options[:net]
Expand Down Expand Up @@ -125,4 +101,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end
end

32 changes: 32 additions & 0 deletions tools/vagrant_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

raise "VAGRANT_HOME needs to be defined prior vagrant_helper!" unless defined? VAGRANT_HOME

VAGRANTFILE_API_VERSION = "2" unless defined? VAGRANTFILE_API_VERSION
VAGRANT_REQUIRED_VERSION = "1.8.0" unless defined? VAGRANT_REQUIRED_VERSION
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4" unless defined? VAGRANT_REQUIRED_LINKED_CLONE_VERSION

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
exit 1
end
else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

nodesFile = VAGRANT_HOME + "/Vagrantfile.nodes"
localFile = VAGRANT_HOME + "/Vagrantfile.local"
nodes = {}

raise "ERROR: Vagrantfile.nodes is missing from source tree." unless File.exists?(nodesFile)

eval(IO.read(nodesFile), binding)

# allow to override the configuration
eval(IO.read(localFile), binding) if File.exists?(localFile)

# Export nodes to global scope
$nodes = nodes