def remove_user(self): pghba = PgHba() for role in ('dsp_role1', 'dsp_role2', 'dsp_role3', 'dsp_role4', 'dsp_role5'): entries = pghba.search( user = role ) for ent in entries: ent.delete() pghba.write() gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
def remove_user(self, role): """ @description: Remove an entry for user in pg_hba.conf """ pghba = PgHba() entries = pghba.search( user = role ) for ent in entries: ent.delete() pghba.write() gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
def remove_user(self, role): """ @description: Remove an entry for user in pg_hba.conf """ pghba = PgHba() entries = pghba.search( user = role ) for ent in entries: ent.delete() pghba.write() gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
def add_user(self): """ @description: Add an entry for each user in pg_hba.conf """ pghba = PgHba() for role in ("dsp_role1", "dsp_role2", "dsp_role3", "dsp_role4", "dsp_role5"): new_entry = Entry(entry_type="local", database="all", user=role, authmethod="password") pghba.add_entry(new_entry) pghba.write() # Check if the roles are added correctly res = pghba.search(type="local", database="all", user=role, authmethod="password") if not res: raise Exception("The entry is not added to pg_hba.conf correctly") gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
def add_user(self, role, mode): """ @description: Add an entry for each user in pg_hba.conf """ pghba = PgHba() new_entry = Entry(entry_type='local', database = 'all', user = role, authmethod = mode) pghba.add_entry(new_entry) pghba.write() # Check if the roles are added correctly res = pghba.search(type='local', database='all', user = role, authmethod= mode) if not res: raise Exception('The entry is not added to pg_hba.conf correctly') gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
def add_user(self, role, mode): """ @description: Add an entry for each user in pg_hba.conf """ pghba = PgHba() new_entry = Entry(entry_type='local', database = 'all', user = role, authmethod = mode) pghba.add_entry(new_entry) pghba.write() # Check if the roles are added correctly res = pghba.search(type='local', database='all', user = role, authmethod= mode) if not res: raise Exception('The entry is not added to pg_hba.conf correctly') gpstop = GpStop() gpstop.run_gpstop_cmd(reload=True) # reload to activate the users