[rt-users] FW: Delete User accounts through a perl script

Potla, Ashish Bassaliel c_apotla at qualcomm.com
Tue Feb 23 08:41:49 EST 2010


Hi, Even on CLI : ./rt-shredder --plugin 'Objects=User,39236'
Is taking forever. It has been running for quite sometime till now.

-Ashish
________________________________
From: Potla, Ashish Bassaliel
Sent: Tuesday, February 23, 2010 6:30 PM
To: rt-users at lists.bestpractical.com
Subject: Delete User accounts through a perl script

Hello I consistently keep getting this error : Couldn't wipeout object:  at /opt/prj/rt/rt3/local/lib/RTx/Shredder.pm line 427.

At the end of this mail is my subroutine -
If I change the Wipeout to WipeoutAll , it just takes on forever at that statement.

Let me know if you have any other logic to delete user accounts from a perl script.

Please Help,
Thanks
-Ashish

sub delete_user {
    # Grab the user id
    my $id = shift;

    # Form an RT::User object string for the user
    my $object_string = 'RT::User-' . $id;
    # Create a single item array with the object string
    my @users_to_delete = ($object_string);

    # Create a shredder object and pass it the array
    my $shredder = new RTx::Shredder( force => 1 );
    $shredder->PutObjects( Objects => \@users_to_delete );

    # Shred the user
    eval {
        $shredder->Wipeout
    };

    if ( $@ ) {
        return (-1, "Failed to delete user with id '$id': $@");
    }
    return (1, "User with id '$id' deleted successfully.\n");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100223/cd6b835f/attachment.htm>


More information about the rt-users mailing list