#NEWLINE# def pull( repo , tag = None , insecure_registry = False ) : #NEWLINE# #INDENT# "\n    Pulls an image from any registry. See documentation at top of this page to\n    configure authenticated access\n\n    repo\n        name of repository\n\n    tag\n        specific tag to pull (Optional)\n\n    insecure_registry\n        set as ``True`` to use insecure (non HTTPS) registry. Default is ``False``\n        (only available if using docker-py >= 0.5.0)\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' docker.pull <repository> [tag]\n    " #NEWLINE# client = _get_client ( ) #NEWLINE# status = base_status . copy ( ) #NEWLINE# try : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# 'tag' : tag , #NEWLINE# #UNINDENT# } #NEWLINE# if salt . utils . compare_versions ( ver1 = docker . __version__ , oper = '>=' , ver2 = '0.5.0' ) : #NEWLINE# #INDENT# kwargs [ 'insecure_registry' ] = insecure_registry #NEWLINE# #UNINDENT# ret = client . pull ( repo , ** kwargs ) #NEWLINE# if ret : #NEWLINE# #INDENT# ( image_logs , infos ) = _parse_image_multilogs_string ( ret ) #NEWLINE# if ( infos and infos . get ( 'Id' , None ) ) : #NEWLINE# #INDENT# repotag = repo #NEWLINE# if tag : #NEWLINE# #INDENT# repotag = '{0}:{1}' . format ( repo , tag ) #NEWLINE# #UNINDENT# _valid ( status , out = ( image_logs if image_logs else ret ) , id_ = infos [ 'Id' ] , comment = 'Image {0} was pulled ({1})' . format ( repotag , infos [ 'Id' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _pull_assemble_error_status ( status , ret , image_logs ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# _invalid ( status ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# _invalid ( status , id_ = repo , out = traceback . format_exc ( ) ) #NEWLINE# #UNINDENT# return status