def absent(name,
           if_exists=None,
           restrict=None,
           cascade=None,
           user=None,
           maintenance_db=None,
           db_user=None,
           db_password=None,
           db_host=None,
           db_port=None):
    '''
    Ensure that the named extension is absent.

    name
        Extension name of the extension to remove

    if_exists
        Add if exist slug

    restrict
        Add restrict slug

    cascade
        Drop on cascade

    user
        System user all operations should be performed on behalf of

    maintenance_db
        Database to act on

    db_user
        Database username if different from config or default

    db_password
        User password if any password for a specified user

    db_host
        Database host if different from config or default

    db_port
        Database port if different from config or default
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}
    db_args = {
        'maintenance_db': maintenance_db,
        'runas': user,
        'host': db_host,
        'user': db_user,
        'port': db_port,
        'password': db_password,
    }
    # check if extension exists and remove it
    exists = __salt__['postgres.is_installed_extension'](name, **db_args)
    if exists:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'Extension {0} is set to be removed'.format(name)
            return ret
        if __salt__['postgres.drop_extension'](name,
                                               if_exists=if_exists,
                                               restrict=restrict,
                                               cascade=cascade,
                                               **db_args):
            ret['comment'] = 'Extension {0} has been removed'.format(name)
            ret['changes'][name] = 'Absent'
            return ret
        else:
            ret['result'] = False
            ret['comment'] = 'Extension {0} failed to be removed'.format(name)
            return ret
    else:
        ret['comment'] = 'Extension {0} is not present, so it cannot ' \
                         'be removed'.format(name)

    return ret
def absent ( name , if_exists = None , restrict = None , cascade = None , user = None , maintenance_db = None , db_user = None , db_password = None , db_host = None , db_port = None ) : ret = { 'name' : name , 'changes' : { } , 'result' : True , 'comment' : '' } db_args = { 'maintenance_db' : maintenance_db , 'runas' : user , 'host' : db_host , 'user' : db_user , 'port' : db_port , 'password' : db_password , } exists = __salt__ [ 'postgres.is_installed_extension' ] ( name , ** db_args ) if exists : if __opts__ [ 'test' ] : ret [ 'result' ] = None ret [ 'comment' ] = 'Extension {0} is set to be removed' . format ( name ) return ret if __salt__ [ 'postgres.drop_extension' ] ( name , if_exists = if_exists , restrict = restrict , cascade = cascade , ** db_args ) : ret [ 'comment' ] = 'Extension {0} has been removed' . format ( name ) ret [ 'changes' ] [ name ] = 'Absent' return ret else : ret [ 'result' ] = False ret [ 'comment' ] = 'Extension {0} failed to be removed' . format ( name ) return ret else : ret [ 'comment' ] = 'Extension {0} is not present, so it cannot ' 'be removed' . format ( name ) return ret
Ensure that the named extension is absent.

    name
        Extension name of the extension to remove

    if_exists
        Add if exist slug

    restrict
        Add restrict slug

    cascade
        Drop on cascade

    user
        System user all operations should be performed on behalf of

    maintenance_db
        Database to act on

    db_user
        Database username if different from config or default

    db_password
        User password if any password for a specified user

    db_host
        Database host if different from config or default

    db_port
        Database port if different from config or default