def _role_create(name,
                 user=None,
                 host=None,
                 port=None,
                 maintenance_db=None,
                 password=None,
                 createdb=None,
                 createroles=None,
                 encrypted=None,
                 superuser=None,
                 login=None,
                 connlimit=None,
                 inherit=None,
                 replication=None,
                 rolepassword=None,
                 valid_until=None,
                 typ_='role',
                 groups=None,
                 runas=None):
    '''
    Creates a Postgres role. Users and Groups are both roles in postgres.
    However, users can login, groups cannot.
    '''

    # check if role exists
    if user_exists(name, user, host, port, maintenance_db,
                   password=password, runas=runas):
        log.info('%s \'%s\' already exists', typ_.capitalize(), name)
        return False

    sub_cmd = 'CREATE ROLE "{0}" WITH'.format(name)
    sub_cmd = '{0} {1}'.format(sub_cmd, _role_cmd_args(
        name,
        typ_=typ_,
        encrypted=encrypted,
        login=login,
        connlimit=connlimit,
        inherit=inherit,
        createdb=createdb,
        createroles=createroles,
        superuser=superuser,
        groups=groups,
        replication=replication,
        rolepassword=rolepassword,
        valid_until=valid_until
    ))
    ret = _psql_prepare_and_run(['-c', sub_cmd],
                                runas=runas, host=host, user=user, port=port,
                                maintenance_db=maintenance_db,
                                password=password)

    return ret['retcode'] == 0
def _role_create ( name , user = None , host = None , port = None , maintenance_db = None , password = None , createdb = None , createroles = None , encrypted = None , superuser = None , login = None , connlimit = None , inherit = None , replication = None , rolepassword = None , valid_until = None , typ_ = 'role' , groups = None , runas = None ) : if user_exists ( name , user , host , port , maintenance_db , password = password , runas = runas ) : log . info ( '%s \'%s\' already exists' , typ_ . capitalize ( ) , name ) return False sub_cmd = 'CREATE ROLE "{0}" WITH' . format ( name ) sub_cmd = '{0} {1}' . format ( sub_cmd , _role_cmd_args ( name , typ_ = typ_ , encrypted = encrypted , login = login , connlimit = connlimit , inherit = inherit , createdb = createdb , createroles = createroles , superuser = superuser , groups = groups , replication = replication , rolepassword = rolepassword , valid_until = valid_until ) ) ret = _psql_prepare_and_run ( [ '-c' , sub_cmd ] , runas = runas , host = host , user = user , port = port , maintenance_db = maintenance_db , password = password ) return ret [ 'retcode' ] == 0
Creates a Postgres role. Users and Groups are both roles in postgres.
    However, users can login, groups cannot.