Sha256: f5d5e0f347b1c1a5e92533ad2833b36fe18a4910666c8fa705fd2f94e50b5e2e

Contents?: true

Size: 1.54 KB

Versions: 8

Compression:

Stored size: 1.54 KB

Contents

module Puppet::ModuleTool::Errors

  class UpgradeError < ModuleToolError
    def initialize(msg)
      @action = :upgrade
      super
    end
  end

  class VersionAlreadyInstalledError < UpgradeError
    attr_reader :newer_versions

    def initialize(options)
      @module_name       = options[:module_name]
      @requested_version = options[:requested_version]
      @installed_version = options[:installed_version]
      @dependency_name   = options[:dependency_name]
      @newer_versions    = options[:newer_versions]
      @possible_culprits = options[:possible_culprits]
      super "Could not upgrade '#{@module_name}'; more recent versions not found"
    end

    def multiline
      message = []
      message << "Could not upgrade module '#{@module_name}' (#{vstring})"
      if @newer_versions.empty?
        message << "  The installed version is already the latest version matching #{vstring}"
      else
        message << "  There are #{@newer_versions.length} newer versions"
        message << "    No combination of dependency upgrades would satisfy all dependencies"
        unless @possible_culprits.empty?
          message << "    Dependencies will not be automatically upgraded across major versions"
          message << "    Upgrading one or more of these modules may permit the upgrade to succeed:"
          @possible_culprits.each do |name|
            message << "    - #{name}"
          end
        end
      end
      message << "    Use `puppet module upgrade --force` to upgrade only this module"
      message.join("\n")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-3.6.2 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.2-x86-mingw32 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.1 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.1-x86-mingw32 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.0 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.0-x86-mingw32 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.0.rc1 lib/puppet/module_tool/errors/upgrader.rb
puppet-3.6.0.rc1-x86-mingw32 lib/puppet/module_tool/errors/upgrader.rb