Sha256: 905a1b241037c108ab726d8029723174dcb683018dbf491f073496e3903d16ee

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

require 'semantic'

module Hobo
  module Lib
    module HostCheck
      def vagrant_version
        begin
          version = shell "vagrant --version", :capture => true
          version.gsub!(/^Vagrant /, '')
          version = ::Semantic::Version.new version
          minimum_version = ::Semantic::Version.new "1.3.5"

          advice = <<-EOF
  The version of vagrant which you are using (#{version}) is less than the minimum required (#{minimum_version}).

  Please go to http://www.vagrantup.com/downloads.html and download the latest version for your platform.
  EOF
          raise Hobo::HostCheckError.new("Vagrant is too old!", advice) if version < minimum_version
        rescue Errno::ENOENT
          advice = <<-EOF
Vagrant could not be detected on the path!

Please go to http://www.vagrantup.com/downloads.html and download the latest version for your platform.
EOF
          raise Hobo::HostCheckError.new("Vagrant is not on the path", advice)
        rescue Hobo::ExternalCommandError => error
          advice = <<-EOF
Vagrant produced an error while checking its presence.

This is usually caused by using the vagrant gem which is no longer supported.

Uninstall any gem version of vagrant with the following command selecting "yes" to any prompt:
  gem uninstall vagrant

You can then download and install the latest version from http://www.vagrantup.com/downloads.html

If you do not have any vagrant gems installed it may be possible that a gem such as vagrant-wrapper is installed and is failing.

Please seek assistance from #devops if this is the case.
EOF
          raise Hobo::HostCheckError.new("Vagrant produced an error while checking presence", advice)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.8 lib/hobo/lib/host_check/vagrant.rb
hobo-inviqa-0.0.7.pre.rc3 lib/hobo/lib/host_check/vagrant.rb
hobo-inviqa-0.0.7.pre.rc2 lib/hobo/lib/host_check/vagrant.rb
hobo-inviqa-0.0.7.pre.rc1 lib/hobo/lib/host_check/vagrant.rb