#NEWLINE# def install_updates( skips = None , retries = 5 , categories = None ) : #NEWLINE# #INDENT# '\n    Downloads and installs all available updates, skipping those that require\n    user interaction.\n\n    Add ``cached`` to only install those updates which have already been downloaded.\n\n    you can set the maximum number of retries to ``n`` in the search process by\n    adding: ``retries=n``\n\n    various aspects of the updates can be included or excluded. This function is\n    still under 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 install. Must be passed as a list.\n\n        .. code-block:: bash\n\n            salt \'*\' win_update.install_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.install_updates\n\n        # Install all critical updates\n        salt \'*\' win_update.install_updates categories="[\'Critical Updates\']"\n\n    ' #NEWLINE# log . debug ( 'categories to search for are: {0}' . format ( str ( categories ) ) ) #NEWLINE# quidditch = PyWinUpdater ( ) #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# ( comment , passed , retries ) = _install ( quidditch , retries ) #NEWLINE# if ( not passed ) : #NEWLINE# #INDENT# return ( comment , str ( passed ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# comment = quidditch . GetInstallationResultsPretty ( ) #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 )