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

Side by Side Diff: Vagrantfile

Issue 29366882: Issue 3574 - Refactor Puppet class base into class adblockplus (Closed)
Patch Set: For comment 6 Created Dec. 6, 2016, 11:42 a.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 | hiera/puppet_node_classifier.rb » ('j') | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 puppet.module_path = 'modules' 56 puppet.module_path = 'modules'
57 end 57 end
58 58
59 yield(config) if block_given? 59 yield(config) if block_given?
60 end 60 end
61 end 61 end
62 62
63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") 64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml")
65 config_data = YAML.load_file(config_path) 65 config_data = YAML.load_file(config_path)
66 servers = config_data["servers"] 66 servers = config_data["adblockplus::hosts"]
67 servers.each do |server, items| 67 servers.each do |server, items|
68 ip = items["ip"][0] 68 next if items['ensure'] == 'absent'
69 ip = items["ips"][0]
69 role = items.fetch("role", "default") 70 role = items.fetch("role", "default")
70 define_standard_vm(config, server, ip, role) 71 define_standard_vm(config, server, ip, role)
71 end 72 end
72 end 73 end
OLDNEW
« no previous file with comments | « no previous file | hiera/puppet_node_classifier.rb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld