#NEWLINE# def update( name , source = None , pre_versions = False ) : #NEWLINE# #INDENT# '\n    Instructs Chocolatey to update packages on the system.\n\n    name\n        The name of the package to update, or "all" to update everything\n        installed on the system.\n\n    source\n        Chocolatey repository (directory, share or remote URL feed) the package\n        comes from. Defaults to the official Chocolatey feed.\n\n    pre_versions\n        Include pre-release packages in comparison. Defaults to False.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt "*" chocolatey.update all\n        salt "*" chocolatey.update <package name> pre_versions=True\n    ' #NEWLINE# choc_path = _find_chocolatey ( __context__ , __salt__ ) #NEWLINE# cmd = [ choc_path , 'update' , name ] #NEWLINE# if source : #NEWLINE# #INDENT# cmd . extend ( [ '-Source' , source ] ) #NEWLINE# #UNINDENT# if salt . utils . is_true ( cmd ) : #NEWLINE# #INDENT# cmd . append ( '-PreRelease' ) #NEWLINE# #UNINDENT# cmd . extend ( _yes ( __context__ ) ) #NEWLINE# result = __salt__ [ 'cmd.run_all' ] ( cmd , python_shell = False ) #NEWLINE# if ( result [ 'retcode' ] != 0 ) : #NEWLINE# #INDENT# err = 'Running chocolatey failed: {0}' . format ( result [ 'stderr' ] ) #NEWLINE# log . error ( err ) #NEWLINE# raise CommandExecutionError ( err ) #NEWLINE# #UNINDENT# return result [ 'stdout' ]