# class Puppet::ModuleTool::Errors::ModuleIsRequiredError

### Public Class Methods

new(options) click to toggle source
Calls superclass method Puppet::Error.new

    # File lib/puppet/module_tool/errors/uninstaller.rb, line 25
    def initialize(options)
      @module_name       = options[:module_name]
      @required_by       = options[:required_by]
      @requested_version = options[:requested_version]
      @installed_version = options[:installed_version]

      super "Could not uninstall '#{@module_name}'; installed modules still depend upon it"
    end

### Public Instance Methods

multiline() click to toggle source

    # File lib/puppet/module_tool/errors/uninstaller.rb, line 34
    def multiline
      message = []
      message << ("Could not uninstall module '#{@module_name}'" << (@requested_version ? " (#{v(@requested_version)})" : ''))
      message << "  Other installed modules have dependencies on '#{@module_name}' (#{v(@installed_version)})"
      message += @required_by.map do |mod|
        "    '#{mod['name']}' (#{v(mod['version'])}) requires '#{@module_name}' (#{v(mod['version_requirement'])})"
      end
      message << "    Use `puppet module uninstall --force` to uninstall this module anyway"
      message.join("\n")
    end