def installed(name, version=None, source=None, force=False, install_args=None,
            override_args=False, force_x86=False, package_args=None):
    '''
    Installs a package if not already installed

    name
      The name of the package to be installed.

    version
      Install a specific version of the package. Defaults to latest version.

    source
      Chocolatey repository (directory, share or remote URL, feed). Defaults to
      the official Chocolatey feed.

    force
      Reinstall the current version of an existing package. Default is false.

    install_args
      A list of install arguments you want to pass to the installation
      process i.e product key or feature list

    override_args
      Set to true if you want to override the original install arguments (
      for the native installer)in the package and use your own.
      When this is set to False install_args will be appended to the end of
      the default arguments

    force_x86
      Force x86 (32bit) installation on 64 bit systems. Defaults to false.

    package_args
        A list of arguments you want to pass to the package

    .. code-block:: yaml

        Installsomepackage:
          chocolatey.installed:
            - name: packagename
            - version: '12.04'
            - source: 'mychocolatey/source'
            - force: True

    '''

    ret = {'name': name,
           'result': True,
           'changes': {},
           'comment': ''}

    # Determine if the package is installed
    if name not in __salt__['cmd.run']('choco list --local-only'):
        ret['changes'] = {'name': '{0} will be installed'.format(name)}
    elif force:
        ret['changes'] = {'name': '{0} is already installed but will reinstall'
            .format(name)}
    else:
        ret['comment'] = 'The Package {0} is already installed'.format(name)
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'The installation was tested'
        return ret

    # Install the package
    ret['changes'] = {name: __salt__['chocolatey.install'](name, version,
                                                             source,
                                                             force,
                                                             install_args,
                                                             override_args,
                                                             force_x86,
                                                             package_args)}

    if 'Running chocolatey failed' not in ret['changes']:
        ret['result'] = True
    else:
        ret['result'] = False

    if not ret['result']:
        ret['comment'] = 'Failed to install the package {0}'.format(name)

    return ret
dataset/ETHPy150Open saltstack/salt/salt/states/chocolatey.py/installed/original