def do_listenumkey(args, dbh, settings): cerr('List enumkey') ekeys = dbh.list_ekeys(group = args.ekeygroup) for ek in ekeys: cout('%s' % ek.key)
def do_initdb(args, dbh, settings): print('do_initdb()') dbh.initdb(create_table = (not args.no_create_table), init_data = (not args.no_init_data)) from rhombus.scripts.setup import populate_db userclass = yaml.load(open(args.initial_userclass)) if args.initial_userclass else None groups = yaml.load(open(args.initial_groups)) if args.initial_groups else None populate_db(dbh.session(), groups, userclass) cout('INFO - database has been initialized')
def do_adduser(args, dbh, settings): print('do_adduser()') if not args.userclass: cexit('ERR - please provide userclass') domain = dbh.get_userclass( args.userclass ) if not domain: cexit('ERR - userclass: %s does not exist!' % args.userclass) if not args.login: cexit('ERR - please provide login name') if not args.lastname: cexit('ERR - please provide last name') if not args.firstname: cexit('ERR - please provide firstname') if not args.email: cexit('ERR - please provide email address') if not args.primarygroup: cexit('ERR - please provide primarygroup') if args.groups: groups = args.groups.split(',') else: groups = [] user = domain.add_user( login = args.login, email = args.email, lastname = args.lastname, firstname = args.firstname, primarygroup = args.primarygroup, groups = groups, session = dbh.session() ) cout('User %s added sucessfully.' % user.login)
def main(args): cout('Greeting from plasmogen-run test script')