]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/rm/rm_runner.rb
1 require 'common/errors'
2 require 'common/runner'
4 # Perform the removal of users/domains using {RmPlugin}s.
9 # Run *plugin* to remove the users/domains in *targets*. The method
10 # signature includes the unused *cfg* for consistency with the
11 # runners that do need a {Configuration}.
13 # @param cfg [Configuration] unused.
15 # @param plugin [Class] plugin class that will perform the removal.
17 # @param targets [Array<User,Domain>] the users and domains to be
20 def run(cfg
, plugin
, *targets
)
21 targets
.each
do |target
|
22 remove_target(plugin
, target
)
29 # Remove *target* using *plugin*. This operation is separate from
30 # the <tt>run()</tt> method so that it can be accessed by the prune
33 # @param plugin [RmPlugin] the plugin that will remove the *target*.
35 # @param target [User,Domain] the user or domain to remove.
37 def remove_target(plugin
, target
)
38 target_description
= plugin
.describe(target
)
42 msg
= "Removed #{target.class.to_s().downcase()} "
43 msg +
= add_description(target
, target_description
)
47 rescue NonexistentDomainError
, NonexistentUserError
=> e
48 report(plugin
, "#{target.class.to_s()} #{e.to_s} not found.")