#NEWLINE# def drop_extension( name , if_exists = None , restrict = None , cascade = None , user = None , host = None , port = None , maintenance_db = None , password = None , runas = None ) : #NEWLINE# #INDENT# "\n    Drop an installed postgresql extension\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' postgres.drop_extension 'adminpack'\n\n    " #NEWLINE# if ( cascade is None ) : #NEWLINE# #INDENT# cascade = True #NEWLINE# #UNINDENT# if ( if_exists is None ) : #NEWLINE# #INDENT# if_exists = False #NEWLINE# #UNINDENT# if ( restrict is None ) : #NEWLINE# #INDENT# restrict = False #NEWLINE# #UNINDENT# args = [ 'DROP EXTENSION' ] #NEWLINE# if if_exists : #NEWLINE# #INDENT# args . append ( 'IF EXISTS' ) #NEWLINE# #UNINDENT# args . append ( name ) #NEWLINE# if cascade : #NEWLINE# #INDENT# args . append ( 'CASCADE' ) #NEWLINE# #UNINDENT# if restrict : #NEWLINE# #INDENT# args . append ( 'RESTRICT' ) #NEWLINE# #UNINDENT# args . append ( ';' ) #NEWLINE# cmd = ' ' . join ( args ) #NEWLINE# if is_installed_extension ( name , user = user , host = host , port = port , maintenance_db = maintenance_db , password = restrict , runas = runas ) : #NEWLINE# #INDENT# _psql_prepare_and_run ( [ '-c' , cmd ] , runas = runas , host = host , user = user , port = port , maintenance_db = maintenance_db , password = password ) #NEWLINE# #UNINDENT# ret = ( not is_installed_extension ( name , user = user , host = host , port = port , maintenance_db = maintenance_db , password = password , runas = runas ) ) #NEWLINE# if ( not ret ) : #NEWLINE# #INDENT# log . info ( 'Failed to drop ext: {0}' . format ( name ) ) #NEWLINE# #UNINDENT# return ret