bots.account_creator

Robot to be run periodically from cron and handle RT user creation tickets that come from the website. This semi-automates the steps of creating the account including checking with the PI, adding the user to various systems, emailing the new user, and updating the ticket.

Account creation is run as a pipeline repurposing the ticket priority number to indicate the stage of each new account request. The stages are given in the pipeline description below:

  • Priority 0 : New ticket

  • Priority 1 : VUNetID verified and cluster account does not exist

  • Priotity 2 : Sent PI verification message, awaiting response from PI

  • Priority 3 : Ready to be added to the database

  • Priority 4 : Username added to database, ready for cluster account creation

  • Priority 5 : Account created in POSIX. Ready for secondary group addition and slurm associations

  • Priority 6 : Account fully created, ready to be updated in RT

  • Priority 7 : Username updated in RT, ticket is ready to be closed

  • Priority -1 : An error has occurred and manual intervention is required. After fixing the priority can be set back to a positive integer and the automated process may resume.

Note that ACCRE staff must manually change ticket priority to 3 after verification for account creation to begin.

For priority 0 the ticket status should be ‘new’, for all others ‘open’, otherwise the account creation bot will ignore a ticket.

class accre.bots.account_creator.NewUser(name, vunetid, email, group, ticket)[source]

Bases: object

Stores information about the new user and performs each step of the user creation pipeline

add_pipeline_description()[source]

Adds a comment to the ticket with a description of the creation pipeline and instructions to the administrator.

add_to_database(stage)[source]

Add the new user to the database along with any secondary groups specified.

close_ticket(stage, threshold=1.0)[source]

Close the new user ticket if threshold days have passed with no ticket activity

create_cluster_account(stage)[source]

Initial creation of the POSIX account

fail_and_report(msg)[source]

Log failure messge, add to ticket, set ticket priority to -1 to stop pipeline

initial_account_repair(stage)[source]

Perform initial account repairs, i.e. add secondary groups and required slurm associations.

maybe_remind_pi(stage)[source]

Remind the PI to decide on approving the user if the ticket has not been updated in two days

process_stage(stage)[source]

Dispatch method for each pipeline stage

update_rt_username(stage)[source]

Change new user’s RT name from their email to their vunetid

verify_account(stage)[source]

Verify that this user is not already in the database and has an active VUNetID or robot equivalent and that the email matches

verify_pi(stage)[source]

Request approval from the PI

accre.bots.account_creator.retrieve_new_users(stage)[source]

Search all tickets for the given stage, and return a list of NewUser objects from the ticket data matching the given pipeline stage.

Parameters

stage (int) – Pipeline stage to check

Returns

list of new user requests

Return type

list(NewUser)

accre.bots.account_creator.run_account_creator()[source]

Function or CLI endpoint to run the account creator, searching through all RT tickets and performing appropriate steps in the account creation pipeline.

To simply and rapidly process account requests, each pipeline stage is executed as a separate task in sequence and tickets are re-read each time.