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: Issue 2835 - Find alternative setup for sharing data with VirtualBox Created Nov. 21, 2016, 3:44 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
42 config.vm.provision :puppet do |puppet| 45 config.vm.provision :puppet do |puppet|
43 puppet.options = [ 46 puppet.options = [
44 '--environment=development', 47 '--environment=development',
45 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie r.rb', 48 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie r.rb',
46 '--node_terminus=exec', 49 '--node_terminus=exec',
47 '--verbose', 50 '--verbose',
48 '--debug', 51 '--debug',
49 ] 52 ]
50 puppet.manifests_path = 'manifests' 53 puppet.manifests_path = 'manifests'
51 puppet.manifest_file = 'nodes.pp' 54 puppet.manifest_file = 'nodes.pp'
52 puppet.module_path = 'modules' 55 puppet.module_path = 'modules'
53 end 56 end
54 57
55 yield(config) if block_given? 58 yield(config) if block_given?
56 end 59 end
57 end 60 end
58 61
59 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 62 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
60 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") 63 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml")
61 config_data = YAML.load_file(config_path) 64 config_data = YAML.load_file(config_path)
62 servers = config_data["servers"] 65 servers = config_data["servers"]
63 servers.each do |server, items| 66 servers.each do |server, items|
64 ip = items["ip"][0] 67 ip = items["ip"][0]
65 role = items.fetch("role", "default") 68 role = items.fetch("role", "default")
66 define_standard_vm(config, server, ip, role) 69 define_standard_vm(config, server, ip, role)
67 end 70 end
68 end 71 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