#NEWLINE# def download_updates( skips = None , retries = 5 , categories = None ) : #NEWLINE# #INDENT# '\n    Downloads all available updates, skipping those that require user\n    interaction.\n\n    Various aspects of the updates can be included or excluded. this feature is\n    still in development.\n\n    retries\n        Number of retries to make before giving up. This is total, not per\n        step.\n\n    categories\n        Specify the categories to update. Must be passed as a list.\n\n        .. code-block:: bash\n\n            salt \'*\' win_update.download_updates categories="[\'Updates\']"\n\n        Categories include the following:\n\n        * Updates\n        * Windows 7\n        * Critical Updates\n        * Security Updates\n        * Update Rollups\n\n    CLI Examples:\n\n    .. code-block:: bash\n\n        # Normal Usage\n        salt \'*\' win_update.download_updates\n\n        # Download critical updates only\n        salt \'*\' win_update.download_updates categories="[\'Critical Updates\']"\n\n    ' #NEWLINE# log . debug ( 'categories to search for are: {0}' . format ( str ( categories ) ) ) #NEWLINE# quidditch = PyWinUpdater ( skipDownloaded = True ) #NEWLINE# quidditch . SetCategories ( categories ) #NEWLINE# quidditch . SetSkips ( skips ) #NEWLINE# ( comment , passed , retries ) = _search ( quidditch , retries ) #NEWLINE# if ( not passed ) : #NEWLINE# #INDENT# return ( comment , str ( passed ) ) #NEWLINE# #UNINDENT# ( comment , passed , retries ) = _download ( quidditch , retries ) #NEWLINE# if ( not passed ) : #NEWLINE# #INDENT# return ( comment , str ( passed ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# comment = quidditch . GetDownloadResults ( ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# comment = 'could not get results, but updates were installed. {0}' . format ( exc ) #NEWLINE# #UNINDENT# return 'Windows is up to date. \n{0}' . format ( comment )