Sha256: ed7787d757056564c29a7990b9e6a56c838ddb03c0d5b8feb61db49252784dfb

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

require 'semantic'

module Hobo
  module Lib
    module HostCheck
      def vagrant_version opts
        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

2 entries across 2 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.9.pre.rc1 lib/hobo/lib/host_check/vagrant.rb
hobo-inviqa-0.0.9.pre.alpha lib/hobo/lib/host_check/vagrant.rb