|
11 | 11 |
|
12 | 12 | CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "contrib", "coreos", "user-data") |
13 | 13 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") |
| 14 | +CONTRIB_UTILS_PATH = File.join(File.dirname(__FILE__), "contrib", "utils.sh") |
| 15 | + |
| 16 | +# Make variables from contrib/utils.sh accessible |
| 17 | +if File.exists?(CONTRIB_UTILS_PATH) |
| 18 | + cu_vars = Hash.new do |hash, key| |
| 19 | + value = `. #{CONTRIB_UTILS_PATH} 2> /dev/null && echo $#{key}`.chomp |
| 20 | + hash[key] = value unless value.empty? |
| 21 | + end |
| 22 | +else |
| 23 | + raise Vagrant::Errors::VagrantError.new, "The file '#{CONTRIB_UTILS_PATH}' is missing." |
| 24 | +end |
14 | 25 |
|
15 | 26 | # Defaults for config options defined in CONFIG |
16 | 27 | $num_instances = 1 |
17 | 28 | $instance_name_prefix = "deis" |
18 | | -$update_channel = ENV["COREOS_CHANNEL"] || "stable" |
| 29 | +$update_channel = cu_vars["COREOS_CHANNEL"] |
| 30 | +$image_version = cu_vars["COREOS_VERSION"] |
19 | 31 | $enable_serial_logging = false |
20 | 32 | $share_home = false |
21 | 33 | $vm_gui = false |
@@ -52,15 +64,18 @@ def vm_cpus |
52 | 64 | end |
53 | 65 |
|
54 | 66 | Vagrant.configure("2") do |config| |
55 | | - # always use Vagrant's insecure key |
| 67 | + # always use Vagrants insecure key |
56 | 68 | config.ssh.insert_key = false |
| 69 | + |
57 | 70 | config.vm.box = "coreos-%s" % $update_channel |
58 | | - config.vm.box_version = ">= 766.4.0" |
59 | | - config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" % $update_channel |
| 71 | + if $image_version != "current" |
| 72 | + config.vm.box_version = $image_version |
| 73 | + end |
| 74 | + config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant.json" % [$update_channel, $image_version] |
60 | 75 |
|
61 | 76 | ["vmware_fusion", "vmware_workstation"].each do |vmware| |
62 | 77 | config.vm.provider vmware do |v, override| |
63 | | - override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json" % $update_channel |
| 78 | + override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant_vmware_fusion.json" % [$update_channel, $image_version] |
64 | 79 | end |
65 | 80 | end |
66 | 81 |
|
|
0 commit comments