jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/320277 )

Change subject: Drop the vbguest plugin and sideload the mediawiki-vagrant 
plugin
......................................................................


Drop the vbguest plugin and sideload the mediawiki-vagrant plugin

This started as a patch to remove the vbguest plugin due to the various
problems that it has caused with apt-get after an initial Puppet run.
The vbguest plugin hooks into the VM startup sequence before local
shares are mounted and tries to run apt. This is fine until the first
Puppet run has happened in the VM. Our Puppet code messes around with
the apt cache directroy structure to assist with caching across VM
instance create/destroy cycles. These changes leave the apt
configuration pointing at a /vagrant/cache/apt directory that doesn't
exist except when the local shares are mounted in the VM.

This causes enough problems for people that I have a paste
(<https://phabricator.wikimedia.org/P2955>) to point them to as a quick
fix.

The scope grew however when Vagrant 1.9.0 was released with internal
changes that break our local plugin install as well. Our plugin was
loaded directly via the Vagrantfile before an internal change was
introduced in Vagrant 1.6.0 that made that impossible. A new way to work
around that regression was introduced in Vagrant 1.7.0 and that method
of loading a plugin from local disk continues to work in Vagrant 1.9.0.

The end result is that setup.{bat,sh} no longer installs the vbguest
plugin and our local mediawiki-vagrant plugin is read directly from the
local git clone rather than being compiled and installed.

The one desirable feature that has been lost in the current
implementation is forcing the user to run setup.{bat,sh} on initial
install and periodically there after when the major version number of
the plugin is bumped. I'm sure we can find a way to add this back by
storing some metadata in the .settings.yaml file.

Bug: T151928
Change-Id: I07bc0e1fbf73d665e439dcdbf1805acf6ecc2746
---
A .vagrantplugins
M Vagrantfile
M lib/mediawiki-vagrant/setup.rb
3 files changed, 8 insertions(+), 107 deletions(-)

Approvals:
  Dduvall: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.vagrantplugins b/.vagrantplugins
new file mode 100644
index 0000000..8ef13ac
--- /dev/null
+++ b/.vagrantplugins
@@ -0,0 +1,4 @@
+# vim:ft=ruby:
+$: << File.join(File.expand_path('..', __FILE__), 'lib')
+require 'mediawiki-vagrant'
+require 'mediawiki-vagrant/settings/definitions'
diff --git a/Vagrantfile b/Vagrantfile
index 41c7c3d..f2f96b4 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -27,31 +27,11 @@
 # http://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker
 #
 
-# T151928: Vagrant 1.9.0 unable to install local mediawiki-vagrant plugin
-Vagrant.require_version '< 1.9.0'
+# The .vagrantplugins loading mechanism we use was added in v1.7.0
+Vagrant.require_version '>= 1.7.0'
 
-
-# Ensure we're using the latest version of the plugin
-require_relative 'lib/mediawiki-vagrant/version'
-require 'fileutils'
 require 'ipaddr'
 require 'socket'
-
-# NOTE Use RubyGems over the Vagrant plugin manager as it's more reliable
-gemspec = Gem::Specification.find { |s| s.name == 'mediawiki-vagrant' }
-setup = Vagrant::Util::Platform.windows? ? 'setup.bat' : 'setup.sh'
-
-if gemspec.nil?
-  raise "The mediawiki-vagrant plugin hasn't been installed yet. Please run 
`#{setup}`."
-else
-  installed = gemspec.version
-    latest = Gem::Version.new(MediaWikiVagrant::VERSION)
-    requirement = Gem::Requirement.new("~> 
#{latest.segments.first(2).join('.')}")
-
-    raise "Your mediawiki-vagrant plugin isn't up-to-date. Please re-run 
`#{setup}`." unless requirement.satisfied_by?(installed)
-end
-
-require 'mediawiki-vagrant/settings/definitions'
 
 mwv = MediaWikiVagrant::Environment.new(File.expand_path('..', __FILE__))
 settings = mwv.load_settings
diff --git a/lib/mediawiki-vagrant/setup.rb b/lib/mediawiki-vagrant/setup.rb
index d08ce41..9592279 100644
--- a/lib/mediawiki-vagrant/setup.rb
+++ b/lib/mediawiki-vagrant/setup.rb
@@ -6,12 +6,9 @@
   # Assists with the setup of MediaWiki-Vagrant.
   #
   # Provides an interactive set of prompts for configuration of required
-  # settings, installs plugin dependencies, and builds and installs the
-  # mediawiki-vagrant plugin.
+  # settings.
   #
   class Setup
-    PLUGINS = ['vagrant-vbguest']
-
     class ExecutionError < RuntimeError
       attr_reader :command, :status
 
@@ -47,25 +44,10 @@
       end
     end
 
-    # Executes the setup runner. Installs plugin dependencies, builds and
-    # installs the mediawiki-vagrant plugin, and prompts the user to
-    # configure any required settings.
+    # Prompt the user to configure any required settings.
     #
     def run
       @options.parse!
-
-      # Install/update plugins
-      (PLUGINS & installed_plugins).each { |plugin| update_plugin(plugin) }
-      (PLUGINS - installed_plugins).each { |plugin| install_plugin(plugin) }
-
-      # Install/update mediawiki-vagrant plugin
-      gem_path = build_gem
-
-      begin
-        install_plugin(gem_path)
-      ensure
-        Dir['mediawiki-vagrant-*.gem'].each { |gem| File.unlink(gem) }
-      end
 
       # Configure required settings
       configure_settings unless @silent
@@ -76,69 +58,10 @@
 
     private
 
-    # Builds mediawiki-vagrant from the bundled gemspec.
-    #
-    def build_gem
-      spec = Gem::Specification.load(File.join(@directory, 
'mediawiki-vagrant.gemspec'))
-
-      # Support older versions of RubyGems as best we can
-      if defined?(Gem::Builder)
-        build_gem_using_builder(spec)
-      else
-        build_gem_using_package(spec)
-      end
-    end
-
-    # Builds mediawiki-vagrant on systems with an older version of
-    # RubyGems (< 2.0).
-    #
-    def build_gem_using_builder(spec)
-      pwd = Dir.pwd
-      verbose = Gem.configuration.verbose
-
-      Dir.chdir(File.expand_path('..', spec.loaded_from))
-      Gem.configuration.verbose = false
-
-      Gem::Builder.new(spec).build
-    ensure
-      Dir.chdir(pwd)
-      Gem.configuration.verbose = verbose
-    end
-
-    # Builds mediawiki-vagrant on systems with a newer version of RubyGems
-    # (>= 2.0).
-    #
-    def build_gem_using_package(spec)
-      require 'rubygems/package'
-
-      package = Gem::Package.new(spec.file_name)
-      package.spec = spec
-      package.use_ui(Gem::SilentUI.new) { package.build }
-
-      spec.file_name
-    end
-
     # Prompts the user to configure required settings.
     #
     def configure_settings
       vagrant('config', '--required') { |pipe| pipe.each_char { |c| print c } }
-    end
-
-    # Installs the given Vagrant plugin.
-    #
-    def install_plugin(name)
-      notify "Installing plugin #{name}"
-      vagrant('plugin', 'install', name)
-    end
-
-    # Currently installed Vagrant plugins.
-    #
-    def installed_plugins
-      @installed_plugins ||= vagrant('plugin', 'list') do |pipe|
-        pipe.each_line.with_object([]) do |line, plugins|
-          line.match(/^([\w\-]+) \([\w\.]+\)/) { |m| plugins << m[1] }
-        end
-      end
     end
 
     # Outputs the given message at the given indentation level unless we're
@@ -149,12 +72,6 @@
         prefix = ('-' * level) + (level > 0 ? ' ' : '')
         message_or_io.each_line { |line| puts "#{prefix}#{line}" }
       end
-    end
-
-    # Skips updates for already installed plugins.
-    #
-    def update_plugin(name)
-      notify "Plugin #{name} is already installed"
     end
 
     # Executes the vagrant commands with the given arguments.

-- 
To view, visit https://gerrit.wikimedia.org/r/320277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I07bc0e1fbf73d665e439dcdbf1805acf6ecc2746
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to