def install(pecls, defaults=False, force=False, preferred_state='stable'):
    '''
    .. versionadded:: 0.17.0

    Installs one or several pecl extensions.

    pecls
        The pecl extensions to install.

    defaults
        Use default answers for extensions such as pecl_http which ask
        questions before installation. Without this option, the pecl.installed
        state will hang indefinitely when trying to install these extensions.

    force
        Whether to force the installed version or not

    CLI Example:

    .. code-block:: bash

        salt '*' pecl.install fuse
    '''
    if isinstance(pecls, six.string_types):
        pecls = [pecls]
    preferred_state = '-d preferred_state={0}'.format(_cmd_quote(preferred_state))
    if force:
        return _pecl('{0} install -f {1}'.format(preferred_state, _cmd_quote(' '.join(pecls))),
                     defaults=defaults)
    else:
        _pecl('{0} install {1}'.format(preferred_state, _cmd_quote(' '.join(pecls))),
              defaults=defaults)
        if not isinstance(pecls, list):
            pecls = [pecls]
        for pecl in pecls:
            found = False
            if '/' in pecl:
                channel, pecl = pecl.split('/')
            else:
                channel = None
            installed_pecls = list_(channel)
            for pecl in installed_pecls:
                installed_pecl_with_version = '{0}-{1}'.format(
                    pecl,
                    installed_pecls.get(pecl)[0]
                )
                if pecl in installed_pecl_with_version:
                    found = True
            if not found:
                return False
        return True
def install ( pecls , defaults = False , force = False , preferred_state = 'stable' ) : if isinstance ( pecls , six . string_types ) : pecls = [ pecls ] preferred_state = '-d preferred_state={0}' . format ( _cmd_quote ( preferred_state ) ) if force : return _pecl ( '{0} install -f {1}' . format ( preferred_state , _cmd_quote ( ' ' . join ( pecls ) ) ) , defaults = defaults ) else : _pecl ( '{0} install {1}' . format ( preferred_state , _cmd_quote ( ' ' . join ( pecls ) ) ) , defaults = defaults ) if not isinstance ( pecls , list ) : pecls = [ pecls ] for pecl in pecls : found = False if '/' in pecl : channel , pecl = pecl . split ( '/' ) else : channel = None installed_pecls = list_ ( channel ) for pecl in installed_pecls : installed_pecl_with_version = '{0}-{1}' . format ( pecl , installed_pecls . get ( pecl ) [ 0 ] ) if pecl in installed_pecl_with_version : found = True if not found : return False return True
.. versionadded:: 0.17.0

    Installs one or several pecl extensions.

    pecls
        The pecl extensions to install.

    defaults
        Use default answers for extensions such as pecl_http which ask
        questions before installation. Without this option, the pecl.installed
        state will hang indefinitely when trying to install these extensions.

    force
        Whether to force the installed version or not

    CLI Example:

    .. code-block:: bash

        salt '*' pecl.install fuse