Exception: Puppet::ModuleTool::Errors::ModuleIsRequiredError
- Inherits:
-
UninstallError
- Object
- RuntimeError
- Error
- ModuleToolError
- UninstallError
- Puppet::ModuleTool::Errors::ModuleIsRequiredError
- Defined in:
- lib/puppet/module_tool/errors/uninstaller.rb
Instance Attribute Summary
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(options) ⇒ ModuleIsRequiredError
constructor
A new instance of ModuleIsRequiredError.
- #multiline ⇒ Object
Methods inherited from ModuleToolError
Constructor Details
#initialize(options) ⇒ ModuleIsRequiredError
Returns a new instance of ModuleIsRequiredError.
25 26 27 28 29 30 31 32 |
# File 'lib/puppet/module_tool/errors/uninstaller.rb', line 25 def initialize() @module_name = [:module_name] @required_by = [:required_by] @requested_version = [:requested_version] @installed_version = [:installed_version] super _("Could not uninstall '%{module_name}'; installed modules still depend upon it") % { module_name: @module_name } end |
Instance Method Details
#multiline ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/puppet/module_tool/errors/uninstaller.rb', line 34 def multiline = [] if @requested_version << _("Could not uninstall module '%{module_name}' (v%{requested_version})") % { module_name: @module_name, requested_version: @requested_version } else << _("Could not uninstall module '%{module_name}'") % { module_name: @module_name } end << _(" Other installed modules have dependencies on '%{module_name}' (%{version})") % { module_name: @module_name, version: v(@installed_version) } += @required_by.map do |mod| _(" '%{module_name}' (%{version}) requires '%{module_dep}' (%{dep_version})") % { module_name: mod['name'], version: v(mod['version']), module_dep: @module_name, dep_version: v(mod['version_requirement']) } end << _(" Use `puppet module uninstall --force` to uninstall this module anyway") .join("\n") end |