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 create_stage(options): """Create accounts in the mid-approval stage.""" try: principal = options.admin_user + "/admin" if getattr(options, "keytab", None) is None: # Autheticate our ldap session using gssapi options.admin_password = \ getpass("{0}@OCF.BERKELEY.EDU's Password: "******"", ldap.sasl.gssapi("")) with fancy_open(options.mid_approve, lock = True, pass_missing = True, delete = True) as f: finalize_accounts(get_users(f, options), options) finally: check_call(["kdestroy"])