X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Frm%2Fplugins%2Fdovecot.rb;h=0ced5bec3acf4aca70bbdd7008882112c78ba412;hp=4283e9c2267f9b0088febcd4d5b45ea423ddb660;hb=f819b178c5c1cb8adda0182c610e5c52fad8bea7;hpb=7f8654ed6582062a295e1be75ae70e99de41b323 diff --git a/lib/rm/plugins/dovecot.rb b/lib/rm/plugins/dovecot.rb index 4283e9c..0ced5be 100644 --- a/lib/rm/plugins/dovecot.rb +++ b/lib/rm/plugins/dovecot.rb @@ -11,15 +11,23 @@ class DovecotRm def delete_domain(domain) - # Will raise an exception if the path doesn't exist. domain_path = self.get_domain_path(domain) + + if not File.directory?(domain_path) + raise NonexistentDomainError.new(domain.to_s()) + end + FileUtils.rm_r(domain_path) end - def delete_account(account) - # Will raise an exception if the path doesn't exist. - account_path = self.get_account_path(account) - FileUtils.rm_r(account_path) + def delete_user(user) + user_path = self.get_user_path(user) + + if not File.directory?(user_path) + raise NonexistentUserError.new(user.to_s()) + end + + FileUtils.rm_r(user_path) end end