FIX: user deletion now triggers an e-smith event
This commit is contained in:
parent
0b485392e0
commit
d17be4755b
@ -5,8 +5,6 @@
|
|||||||
# from "group" it becomes "group-deleted".
|
# from "group" it becomes "group-deleted".
|
||||||
# We still need to manage this, as we can't add a group with the same name
|
# We still need to manage this, as we can't add a group with the same name
|
||||||
# of a removed group.
|
# of a removed group.
|
||||||
# - It looks like the above problem is present for users also. The error is:
|
|
||||||
# Attempt to create account 'XXXXXXXX' which already exists in passwd at /usr/share/perl5/vendor_perl/esmith/AccountsDB.pm line 493, <FH> line XXXXXXXX.
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
@ -67,8 +65,16 @@ while(<FH>) {
|
|||||||
$record = $accountsDb->get($username);
|
$record = $accountsDb->get($username);
|
||||||
if($record) {
|
if($record) {
|
||||||
if ( $remove_users ) {
|
if ( $remove_users ) {
|
||||||
$record->delete;
|
$record->set_prop('type', 'user-deleted');
|
||||||
warn "[INFO] deleted $username\n";
|
my @args = ('/usr/bin/sudo', '-n', '/sbin/e-smith/signal-event', 'user-delete', $username);
|
||||||
|
my $ret = system(@args);
|
||||||
|
if ($ret==0) {
|
||||||
|
$record->delete;
|
||||||
|
warn "[INFO] deleted user $username\n";
|
||||||
|
} else {
|
||||||
|
$record->set_prop('type', 'user');
|
||||||
|
warn "[INFO] unable to delete user $username\n";
|
||||||
|
}
|
||||||
next;
|
next;
|
||||||
} else {
|
} else {
|
||||||
if ( ! $add_existing_users_to_groups ) {
|
if ( ! $add_existing_users_to_groups ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user