Ejemplo n.º 1
0
def create_remoteusers(argvs):
    msg = 'the new remote users file'
    remoteuser_file = parse_argvs(argvs, msg)
    source = yaml_parser(remoteuser_file)
    if source:
        for key,val in source.items():
            obj = models.RemoteUser(username=val.get('username'),auth_type=val.get('auth_type'),password=val.get('password'))
            session.add(obj)
        session.commit()
Ejemplo n.º 2
0
 def create_remoteusers(remoteuser_file):
     source = yaml_parser(remoteuser_file)
     if source:
         for key, val in source.items():
             print(key, val)
             obj = models.RemoteUser(username=val['username'],
                                     auth_type=val['auth_type'],
                                     password=val.get('password'))
             session.add(obj)
         session.commit()
Ejemplo n.º 3
0
def create_remoteusers(argvs):
    if '-f' in argvs:
        remoteusers_file = argvs[argvs.index("-f") + 1]
    else:
        print_err(
            "invalid usage, should be:\ncreate_remoteusers -f <the new remoteusers file>",
            quit=True)
    source = yaml_parser(remoteusers_file)
    if source:
        for key, val in source.items():
            print(key, val)
            obj = models.RemoteUser(username=val.get('username'),
                                    auth_type=val.get('auth_type'),
                                    password=val.get('password'))
            session.add(obj)
        session.commit()