]>
gitweb.michael.orlitzky.com - mailshears.git/blob - rm_runner.rb
114aabc355ad1c215f0b95e3cf1f20a2a626ea4d
1 require 'common/runner'
6 def run(plugin
, *targets
)
7 targets
.each
do |target
|
8 # Why think too hard? An account has an @, a domain doesn't.
9 if target
.include?('@') then
11 account_description
= plugin
.describe_account(target
)
12 plugin
.delete_account(target
)
13 report(plugin
, "Removed account: #{target} (#{account_description})")
15 rescue NonexistentAccountError
=> e
16 report(plugin
, "Account not found: #{e.to_s}")
17 rescue StandardError
=> e
18 report(plugin
, "There was an error removing the account: #{e.to_s}")
19 Kernel
.exit(ExitCodes
::DATABASE_ERROR)
23 domain_description
= plugin
.describe_domain(target
)
24 plugin
.delete_domain(target
)
25 report(plugin
, "Removed domain: #{target} (#{domain_description})")
27 rescue NonexistentAccountError
=> e
28 # Can happen in the usernames.each... block.
29 report(plugin
, "Account not found: #{e.to_s}")
30 rescue NonexistentDomainError
=> e
31 report(plugin
, "Domain not found: #{e.to_s}")
32 rescue StandardError
=> e
33 report(plugin
, "There was an error removing the domain: #{e.to_s}")
34 Kernel
.exit(ExitCodes
::DATABASE_ERROR)