Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: Vagrantfile

Issue 29363649: Issue 2835 - Find alternative setup for sharing data with VirtualBox (Closed)
Patch Set: Created Nov. 21, 2016, 2:34 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 require 'yaml' 1 require 'yaml'
2 2
3 VAGRANTFILE_API_VERSION = "2" 3 VAGRANTFILE_API_VERSION = "2"
4 REPOSITORY_DIR = File.dirname(__FILE__) 4 REPOSITORY_DIR = File.dirname(__FILE__)
5 DEPENDENCY_SCRIPT = File.join(REPOSITORY_DIR, "ensure_dependencies.py") 5 DEPENDENCY_SCRIPT = File.join(REPOSITORY_DIR, "ensure_dependencies.py")
6 6
7 if !system("python", DEPENDENCY_SCRIPT) 7 if !system("python", DEPENDENCY_SCRIPT)
8 error = Vagrant::Errors::VagrantError 8 error = Vagrant::Errors::VagrantError
9 error.error_message("Failed to ensure dependencies being up-to-date!") 9 error.error_message("Failed to ensure dependencies being up-to-date!")
10 raise error 10 raise error
(...skipping 15 matching lines...) Expand all
26 setup = YAML.load_file(setup_path) rescue {} 26 setup = YAML.load_file(setup_path) rescue {}
27 requirements = setup.fetch("requirements", {}) 27 requirements = setup.fetch("requirements", {})
28 28
29 requirements.each do |key, value| 29 requirements.each do |key, value|
30 vb.customize ['modifyvm', :id, "--#{key}", "#{value}"] 30 vb.customize ['modifyvm', :id, "--#{key}", "#{value}"]
31 end 31 end
32 32
33 end 33 end
34 34
35 # The repository location in the production system's puppet master 35 # The repository location in the production system's puppet master
36 config.vm.synced_folder ".", "/etc/puppet/infrastructure" 36 if system('which', 'rsync', :out => File::NULL)
37 config.vm.synced_folder ".", "/etc/puppet/infrastructure", type: "rsync"
38 else
39 config.vm.synced_folder ".", "/etc/puppet/infrastructure"
40 end
37 41
38 config.vm.provision :shell, :inline => ' 42 config.vm.provision :shell, :inline => '
39 sudo /etc/puppet/infrastructure/hiera/install_precise.py 43 sudo /etc/puppet/infrastructure/hiera/install_precise.py
40 ' 44 '
41 45
mathias 2016/11/21 15:16:48 Please remove the unnecessary white-space here, th
42 config.vm.provision :puppet do |puppet| 46 config.vm.provision :puppet do |puppet|
43 puppet.options = [ 47 puppet.options = [
44 '--environment=development', 48 '--environment=development',
45 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie r.rb', 49 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie r.rb',
46 '--node_terminus=exec', 50 '--node_terminus=exec',
47 '--verbose', 51 '--verbose',
48 '--debug', 52 '--debug',
49 ] 53 ]
50 puppet.manifests_path = 'manifests' 54 puppet.manifests_path = 'manifests'
51 puppet.manifest_file = 'nodes.pp' 55 puppet.manifest_file = 'nodes.pp'
52 puppet.module_path = 'modules' 56 puppet.module_path = 'modules'
53 end 57 end
54 58
55 yield(config) if block_given? 59 yield(config) if block_given?
56 end 60 end
57 end 61 end
58 62
59 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
60 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") 64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml")
61 config_data = YAML.load_file(config_path) 65 config_data = YAML.load_file(config_path)
62 servers = config_data["servers"] 66 servers = config_data["servers"]
63 servers.each do |server, items| 67 servers.each do |server, items|
64 ip = items["ip"][0] 68 ip = items["ip"][0]
65 role = items.fetch("role", "default") 69 role = items.fetch("role", "default")
66 define_standard_vm(config, server, ip, role) 70 define_standard_vm(config, server, ip, role)
67 end 71 end
68 end 72 end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld