def delete_posixuser(self): """Demotes this PosixUser to a normal Account.""" if self.entity_id is None: raise Errors.NoEntityAssociationError( "Unable to determine which entity to delete.") if hasattr(super(PosixUser, self), 'delete_posixuser'): super(PosixUser, self).delete_posixuser() binds = {'account_id': self.entity_id} exists_stmt = """ SELECT EXISTS ( SELECT 1 FROM [:table schema=cerebrum name=posix_user] WHERE account_id=:account_id )""" if not self.query_1(exists_stmt, binds): # False positive return delete_stmt = """ DELETE FROM [:table schema=cerebrum name=posix_user] WHERE account_id=:account_id""" self.execute(delete_stmt, binds) self._db.log_change(self.entity_id, self.clconst.posix_demote, None, change_params={ 'uid': int(self.posix_uid), 'gid': int(self.gid_id), 'shell': int(self.shell), 'gecos': self.gecos })
def delete_machine(self): """Demotes Machine to a normal host""" if self.entity_id is None: raise Errors.NoEntityAssociationError( "Unable to determine which entity to delete.") self._db.log_change(self.entity_id, self.const.machine_demote, None) self.execute( """ DELETE FROM [:table schema=cerebrum name=machine_info] WHERE host_id=:e_id""", {'e_id': self.entity_id})
def delete_posixuser(self): """Demotes this PosixUser to a normal Account.""" if self.entity_id is None: raise Errors.NoEntityAssociationError( "Unable to determine which entity to delete.") if hasattr(super(PosixUser, self), 'delete_posixuser'): super(PosixUser, self).delete_posixuser() self._db.log_change(self.entity_id, self.const.posix_demote, None, change_params={ 'uid': int(self.posix_uid), 'gid': int(self.gid_id), 'shell': int(self.shell), 'gecos': self.gecos }) self.execute( """ DELETE FROM [:table schema=cerebrum name=posix_user] WHERE account_id=:e_id""", {'e_id': self.entity_id})