Dduvall has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232563
Change subject: Factor out `$FACTOR` global
......................................................................
Factor out `$FACTOR` global
Removed the use of a `$FACTOR` global to override facts in our
provisioner middleware. We can instead modify configuration of the
current runtime machine via the passed in `env` argument.
Change-Id: I14fcf2f73e2529046f7156d865edda574cfb2236
---
M Vagrantfile
M lib/mediawiki-vagrant/middleware.rb
2 files changed, 19 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/63/232563/1
diff --git a/Vagrantfile b/Vagrantfile
index 8b2b8a7..dc58b2e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -214,31 +214,31 @@
# Windows's Command Prompt has poor support for ANSI escape sequences.
puppet.options << '--color=false' if Vagrant::Util::Platform.windows?
- puppet.facter = $FACTER = {
- 'fqdn' => config.vm.hostname,
- 'git_user' => settings[:git_user],
- 'forwarded_port' => settings[:http_port],
- 'shared_apt_cache' => '/vagrant/cache/apt/',
- 'environment' => ENV['MWV_ENVIRONMENT'] || 'vagrant',
+ puppet.facter = {
+ 'fqdn' => config.vm.hostname,
+ 'git_user' => settings[:git_user],
+ 'forwarded_port' => settings[:http_port],
+ 'shared_apt_cache' => '/vagrant/cache/apt/',
+ 'environment' => ENV['MWV_ENVIRONMENT'] || 'vagrant',
}
if settings[:http_port] != 80
- $FACTER['port_fragment'] = ":#{settings[:http_port]}"
+ puppet.facter['port_fragment'] = ":#{settings[:http_port]}"
end
if settings[:nfs_shares]
- $FACTER['share_owner'] = Process.uid
- $FACTER['share_group'] = Process.gid
+ puppet.facter['share_owner'] = Process.uid
+ puppet.facter['share_group'] = Process.gid
else
- $FACTER['share_owner'] = 'vagrant'
- $FACTER['share_group'] = 'www-data'
+ puppet.facter['share_owner'] = 'vagrant'
+ puppet.facter['share_group'] = 'www-data'
end
# Derive a host IP from the configured static IP by getting the first
# usable IP in the 8-bit network
if settings[:static_ip]
network = IPAddr.new("#{settings[:static_ip]}/24")
- $FACTER['host_ip'] = network.to_range.take(2).last.to_s
+ puppet.facter['host_ip'] = network.to_range.take(2).last.to_s
end
end
end
diff --git a/lib/mediawiki-vagrant/middleware.rb
b/lib/mediawiki-vagrant/middleware.rb
index 448fb14..74cd19a 100644
--- a/lib/mediawiki-vagrant/middleware.rb
+++ b/lib/mediawiki-vagrant/middleware.rb
@@ -10,7 +10,13 @@
def call(env)
if @mwv.valid?
@mwv.prune_roles
- $FACTER['provider_name'] = env[:machine].provider_name
+
+ # Add the name of the current provider to our puppet facts
+ env[:machine].config.vm.provisioners.each do |provisioner|
+ if provisioner.type == :puppet
+ provisioner.config.facter['provider_name'] =
env[:machine].provider_name
+ end
+ end
end
@app.call(env)
--
To view, visit https://gerrit.wikimedia.org/r/232563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I14fcf2f73e2529046f7156d865edda574cfb2236
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Dduvall <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits