lib/puppet_litmus/rake_helper.rb
# Uninstall a module from a specified target
# @param inventory_hash [Hash] the pre-loaded inventory
# @param target_node_name [String] the name of the target where the module should be uninstalled
# @param module_to_remove [String] the name of the module to remove. Defaults to the module under test.
# @param opts [Hash] additional options to pass on to `puppet module uninstall`
Uninstall a module from a specified target
Uninstall a module from a specified target
def uninstall_module(inventory_hash, target_node_name, module_to_remove = nil, **opts)
    include ::BoltSpec::Run
    module_name = module_to_remove || metadata_module_name
    target_nodes = find_targets(inventory_hash, target_node_name)
    install_module_command = "puppet module uninstall #{module_name}"
    install_module_command += ' --force' if opts[:force]
    bolt_result = run_command(install_module_command, target_nodes, config: nil, inventory: inventory_hash)
    raise_bolt_errors(bolt_result, "uninstalling #{module_name} failed.") unless opts[:force]
    bolt_result
  end
def uninstall_module ( inventory_hash , target_node_name , module_to_remove = nil , ** opts ) include :: BoltSpec :: Run module_name = module_to_remove || metadata_module_name target_nodes = find_targets ( inventory_hash , target_node_name ) install_module_command = "puppet module uninstall #{module_name}" install_module_command += ' --force' if opts [ :force ] bolt_result = run_command ( install_module_command , target_nodes , config : nil , inventory : inventory_hash ) raise_bolt_errors ( bolt_result , "uninstalling #{module_name} failed." ) unless opts [ :force ] bolt_result end
Uninstall a module from a specified target
Uninstall a module from a specified target
# `puppet module uninstall --force` fails if the module is not installed. Ignore errors when force is set
inventory_hash
the pre-loaded inventory
the pre - loaded inventory
target_node_name
the name of the target where the module should be uninstalled
the name of the target where the module should be uninstalled
module_to_remove
the name of the module to remove. Defaults to the module under test.
the name of the module to remove . Defaults to the module under test .
opts
additional options to pass on to `puppet module uninstall`
additional options to pass on to ` puppet module uninstall `