def alias(command, *uri, **opts): force = opts['FORCE'] cmd = CMD.get(command) if cmd == CMD_ADD: if len(uri) < 1: raise Error (ENOARG, 'uri') if len(uri) < 2: raise Error (ENOARG, 'alias') a = Alias_ctl(opts['DB_URI'], multi_rpc(opts)) a.add(uri[0], uri[1:], force) elif cmd == CMD_RM: if len(uri) < 1: raise Error (ENOARG, 'alias') a = Alias_ctl(opts['DB_URI'], multi_rpc(opts)) a.rm(uri, force) else: raise Error (EINVAL, command)
def user(command, uri, *aliases, **opts): force = opts['FORCE'] cmd = CMD.get(command) idtype = get_idtype(opts) if cmd == CMD_ADD: prompt='Please, enter password for the new subscriber.\nPassword: '******'DB_URI'], multi_rpc(opts)) u.add(uri, aliases, password, idtype, force) elif cmd == CMD_RM: u = User_ctl(opts['DB_URI'], multi_rpc(opts)) u.rm(uri, idtype, force) elif cmd == CMD_SHOW: cols, fformat, limit, rsep, lsep, astab = show_opts(opts) u = User_ctl(opts['DB_URI'], multi_rpc(opts)) ret, desc = u.show(uri, cols, fformat, limit) tabprint(ret, desc, rsep, lsep, astab) else: raise Error (EINVAL, command)
def reload(**opts): rpc = multi_rpc(opts) rpc.reload()
def password(uri, password=None, **opts): force = opts['FORCE'] prompt="Please, enter new subscriber's password.\nPassword: " password = get_password(opts, prompt=prompt) u = User_ctl(opts['DB_URI'], multi_rpc(opts)) u.passwd(uri, password, force)