[MediaWiki-commits] [Gerrit] Make custom Vagrant settings less shouty - change (mediawiki/vagrant)
jenkins-bot has submitted this change and it was merged. Change subject: Make custom Vagrant settings less shouty .. Make custom Vagrant settings less shouty An early patchset of I689f7c129 used a bash script to declare these variables, which informed the decision to name them using all-capital letters. But it's a bit shouty and obnoxious, so switch to lowercase letters instead. Change-Id: I40942283aa2a774e4d8a9fde280b2700719c633d --- M Vagrantfile M lib/settings.rb M puppet/modules/vagrant/templates/settings.yaml.erb 3 files changed, 41 insertions(+), 38 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/Vagrantfile b/Vagrantfile index 528440b..48293a8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -35,45 +35,45 @@ # -- # These can be changed by making a `.settings.yaml` file that contains YAML # replacements. Example: -# GIT_USER: "username" -# BOX_NAME: "foo" -# VAGRANT_RAM: 2048 -# FORWARD_PORTS: +# git_user: "username" +# box_name: "foo" +# vagrant_ram: 2048 +# forward_ports: # 27017: 31337 # # Some roles may also provide new settings values. When applied these roles # will require a `vagrant reload` call for their changes to take effect. settings = Settings.new({ # Gerrit username, as used at gerrit.wikimedia.org, or '' if anonymous -'GIT_USER' => '', +'git_user' => '', # The vagrant box to load on the VM -'BOX_NAME' => 'precise-cloud', +'box_name' => 'precise-cloud', # Download URL for vagrant box. If you change this, also update support/packager/urls.yaml . -'BOX_URI' => 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box', +'box_uri' => 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box', # Amount of RAM to allocate to virtual machine in MB; must be numeric -'VAGRANT_RAM' => 768, +'vagrant_ram' => 768, # Number of virtual CPUs to allocate to virtual machine; must be numeric # If you are on a single-core system, change the following default to 1: -'VAGRANT_CORES' => 2, +'vagrant_cores' => 2, # Static IP address for virtual machine -'STATIC_IP' => '10.11.12.13', +'static_ip' => '10.11.12.13', # The port on the host that should be forwarded to the guest's HTTP server. # Must be numeric. -'HTTP_PORT' => 8080, +'http_port' => 8080, # You may provide a map of vm:host port pairs for Vagrant to forward. # Keys and values must be numeric. -'FORWARD_PORTS' => {}, +'forward_ports' => {}, # Enable puppet debug output? # Must be boolean -'PUPPET_DEBUG' => false, +'puppet_debug' => false, }) # Load role provided settings @@ -91,7 +91,7 @@ print("If VM has already been created, run 'vagrant provision' to fix all remote git URLs.\n") print("You can always set it later by editing .settings.yaml file\n") print(' ==> ') -s = Settings.new({'GIT_USER' => STDIN.gets.chomp}) +s = Settings.new({'git_user' => STDIN.gets.chomp}) s.save(root_settings_file) end @@ -107,8 +107,8 @@ # the file using another tool that implements SSL properly, and then # point Vagrant to the downloaded file: # $ vagrant box add precise-cloud /path/to/file/precise.box -config.vm.box = settings['BOX_NAME'] -config.vm.box_url = settings['BOX_URI'] +config.vm.box = settings['box_name'] +config.vm.box_url = settings['box_uri'] if config.vm.respond_to? 'box_download_insecure' # Vagrant 1.2.6+ config.vm.box_download_insecure = true end @@ -117,14 +117,14 @@ # See https://github.com/mitchellh/vagrant/issues/1673 config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" -config.vm.network :private_network, ip: settings['STATIC_IP'] +config.vm.network :private_network, ip: settings['static_ip'] config.vm.network :forwarded_port, -guest: 80, host: settings['HTTP_PORT'].to_i, id: 'http' +guest: 80, host: settings['http_port'].to_i, id: 'http' # Forward additional ports -if settings['FORWARD_PORTS'] -settings['FORWARD_PORTS'].each do |guest_port,host_port| +if settings['forward_ports'] +settings['forward_ports'].each do |guest_port,host_port| config.vm.network :forwarded_port, :host => host_port.to_i, :guest => guest_port.to_i, auto_correct: true @@ -145,8 +145,8 @@ config.vm.provider :virtualbox do |vb| # See http://www.virtualbox.org/manual/ch08.html for additional options. -vb.customize ['modifyvm', :id, '--memory', settings['VAGRANT_RAM'].to_i] -vb.customize ['modifyvm', :id, '--cpus', settings['VAGRANT_CORES'].to_i] +vb.customize ['modifyvm', :id, '--memory', settings[
[MediaWiki-commits] [Gerrit] MAKE CUSTOM VAGRANT SETTINGS LESS SHOUTY - change (mediawiki/vagrant)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/131616 Change subject: MAKE CUSTOM VAGRANT SETTINGS LESS SHOUTY .. MAKE CUSTOM VAGRANT SETTINGS LESS SHOUTY AN EARLY PATCHSET OF I689F7C129 USED A BASH SCRIPT TO DECLARE THESE VARIABLES, WHICH INFORMED THE DECISION TO NAME THEM USING ALL-CAPITAL LETTERS. BUT IT'S A BIT SHOUTY AND OBNOXIOUS, SO SWITCH TO LOWERCASE LETTERS INSTEAD. Change-Id: I40942283aa2a774e4d8a9fde280b2700719c633d --- M Vagrantfile M puppet/modules/vagrant/templates/settings.yaml.erb 2 files changed, 27 insertions(+), 27 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant refs/changes/16/131616/1 diff --git a/Vagrantfile b/Vagrantfile index 46bf585..f14af64 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -35,41 +35,41 @@ # -- # These can be changed by making a `.settings.yaml` file that contains YAML # replacements. Example: -# BOX_NAME: "foo" -# VAGRANT_RAM: 2048 -# FORWARD_PORTS: +# box_name: "foo" +# vagrant_ram: 2048 +# forward_ports: # 27017: 31337 # # Some roles may also provide new settings values. When applied these roles # will require a `vagrant reload` call for their changes to take effect. settings = Settings.new({ # The vagrant box to load on the VM -'BOX_NAME' => 'precise-cloud', +'box_name' => 'precise-cloud', # Download URL for vagrant box. If you change this, also update support/packager/urls.yaml . -'BOX_URI' => 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box', +'box_uri' => 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box', # Amount of RAM to allocate to virtual machine in MB; must be numeric -'VAGRANT_RAM' => 768, +'vagrant_ram' => 768, # Number of virtual CPUs to allocate to virtual machine; must be numeric # If you are on a single-core system, change the following default to 1: -'VAGRANT_CORES' => 2, +'vagrant_cores' => 2, # Static IP address for virtual machine -'STATIC_IP' => '10.11.12.13', +'static_ip' => '10.11.12.13', # The port on the host that should be forwarded to the guest's HTTP server. # Must be numeric. -'HTTP_PORT' => 8080, +'http_port' => 8080, # You may provide a map of vm:host port pairs for Vagrant to forward. # Keys and values must be numeric. -'FORWARD_PORTS' => {}, +'forward_ports' => {}, # Enable puppet debug output? # Must be boolean -'PUPPET_DEBUG' => false, +'puppet_debug' => false, }) # Load role provided settings @@ -92,8 +92,8 @@ # the file using another tool that implements SSL properly, and then # point Vagrant to the downloaded file: # $ vagrant box add precise-cloud /path/to/file/precise.box -config.vm.box = settings['BOX_NAME'] -config.vm.box_url = settings['BOX_URI'] +config.vm.box = settings['box_name'] +config.vm.box_url = settings['box_uri'] if config.vm.respond_to? 'box_download_insecure' # Vagrant 1.2.6+ config.vm.box_download_insecure = true end @@ -105,11 +105,11 @@ config.vm.network :private_network, ip: settings['STATIC_IP'] config.vm.network :forwarded_port, -guest: 80, host: settings['HTTP_PORT'].to_i, id: 'http' +guest: 80, host: settings['http_port'].to_i, id: 'http' # Forward additional ports -if settings['FORWARD_PORTS'] -settings['FORWARD_PORTS'].each do |guest_port,host_port| +if settings['forward_ports'] +settings['forward_ports'].each do |guest_port,host_port| config.vm.network :forwarded_port, :host => host_port.to_i, :guest => guest_port.to_i, auto_correct: true @@ -130,8 +130,8 @@ config.vm.provider :virtualbox do |vb| # See http://www.virtualbox.org/manual/ch08.html for additional options. -vb.customize ['modifyvm', :id, '--memory', settings['VAGRANT_RAM'].to_i] -vb.customize ['modifyvm', :id, '--cpus', settings['VAGRANT_CORES'].to_i] +vb.customize ['modifyvm', :id, '--memory', settings['vagrant_ram'].to_i] +vb.customize ['modifyvm', :id, '--cpus', settings['vagrant_cores'].to_i] vb.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64'] vb.customize ['modifyvm', :id, '--ioapic', 'on'] # Bug 51473 @@ -154,7 +154,7 @@ ] # For more output, uncomment the following line: -if settings['PUPPET_DEBUG'] +if settings['puppet_debug'] puppet.options << '--debug' end diff --git a/puppet/modules/vagrant/templates/settings.yaml.erb b/puppet/modules/vagrant/templates/settings.yaml.erb index 7db9d86..1e8266b 100644 --- a/puppet/modules/vagrant/templates/settings.yaml.erb +++ b/puppet/modules/vagrant/templates/settings