# class Puppet::ModuleTool::Errors::VersionAlreadyInstalledError

### Public Class Methods

new(options) click to toggle source
Calls superclass method Puppet::ModuleTool::Errors::UpgradeError.new

    # File lib/puppet/module_tool/errors/upgrader.rb, line 11
    def initialize(options)
      @module_name       = options[:module_name]
      @requested_version = options[:requested_version]
      @installed_version = options[:installed_version]
      @dependency_name   = options[:dependency_name]
      @conditions        = options[:conditions]
      super "Could not upgrade '#{@module_name}'; module is not installed"
    end

### Public Instance Methods

multiline() click to toggle source

    # File lib/puppet/module_tool/errors/upgrader.rb, line 20
    def multiline
      message = []
      message << "Could not upgrade module '#{@module_name}' (#{vstring})"
      if @conditions.length == 1 && @conditions.last[:version].nil?
        message << "  The installed version is already the latest version"
      else
        message << "  The installed version is already the best fit for the current dependencies"
        message += @conditions.select { |c| c[:module] == :you && c[:version] }.map do |c|
          "    You specified '#{@module_name}' (#{v(c[:version])})"
        end
        message += @conditions.select { |c| c[:module] != :you }.sort_by { |c| c[:module] }.map do |c|
           "    '#{c[:module]}' (#{v(c[:version])}) requires '#{@module_name}' (#{v(c[:dependency])})"
        end
      end
      message << "    Use `puppet module install --force` to re-install this module"
      message.join("\n")
    end