Skip to content

Commit f6d121e

Browse files
committed
feat(vagrant): check for discovery url
1 parent 83c37ed commit f6d121e

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Vagrantfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ require 'fileutils'
55

66
Vagrant.require_version ">= 1.6.5"
77

8+
unless Vagrant.has_plugin?("vagrant-triggers")
9+
raise Vagrant::Errors::VagrantError.new, "Please install the vagrant-triggers plugin running 'vagrant plugin install vagrant-triggers'"
10+
end
11+
812
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "contrib", "coreos", "user-data")
913
CONFIG = File.join(File.dirname(__FILE__), "config.rb")
1014

@@ -66,6 +70,12 @@ Vagrant.configure("2") do |config|
6670
config.vbguest.auto_update = false
6771
end
6872

73+
config.trigger.before :up do
74+
if !File.exists?(CLOUD_CONFIG_PATH) || File.readlines(CLOUD_CONFIG_PATH).grep(/#\s*discovery:/).any?
75+
raise Vagrant::Errors::VagrantError.new, "Run 'make discovery-url' first to create user-data."
76+
end
77+
end
78+
6979
(1..$num_instances).each do |i|
7080
config.vm.define vm_name = "deis-%d" % i do |config|
7181
config.vm.hostname = vm_name

docs/installing_deis/vagrant.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Install Prerequisites
1818

1919
Please install `Vagrant`_ v1.6.5+ and `VirtualBox`_.
2020

21+
The ``Vagrantfile`` requires the plugin `vagrant-triggers`_. To install the plugin run:
22+
23+
.. code-block:: console
24+
25+
$ vagrant plugin install vagrant-triggers
26+
2127
.. note::
2228

2329
For Ubuntu users: the VirtualBox package in Ubuntu has some issues when running in
@@ -78,3 +84,4 @@ start installing the platform.
7884

7985
.. _Vagrant: http://www.vagrantup.com/
8086
.. _VirtualBox: https://www.virtualbox.org/wiki/Downloads
87+
.. _vagrant-triggers: https://github.com/emyl/vagrant-triggers

0 commit comments

Comments
 (0)