def main(args): options = _delete_parser().parse_args(args = args) user = getuser() if user not in ["root", "create"]: raise RuntimeError("Not running as superuser: "******"", "") options.ocf_ldap.protocol_version = ldap.VERSION3 accounts = [{"account_name": user} for user in options.accounts] # Autheticate our ldap session using gssapi options.admin_password = \ getpass("{0}/[email protected]'s Password: "******"{0}/admin".format(options.admin_user), options.admin_password) options.ocf_ldap.sasl_interactive_bind_s("", ldap.sasl.gssapi("")) rm_all(accounts, options) _send_rm_emails(accounts, options) finally: check_call(["kdestroy"])
def _rename_user(old_user, new_user, options): dumps = dump_all([old_user], options) add_all([new_user], options, dumps = dumps) rm_all([old_user], options)