#NEWLINE# def pulled( name , tag = 'latest' , force = False , insecure_registry = False , * args , **kwargs ) : #NEWLINE# #INDENT# '\n    Pull an image from a docker registry. (`docker pull`)\n\n    .. note::\n\n        See first the documentation for `docker login`, `docker pull`,\n        `docker push`,\n        and `docker.import_image <https://github.com/dotcloud/docker-py#api>`_\n        (`docker import\n        <http://docs.docker.io/en/latest/reference/commandline/cli/#import>`_).\n        NOTE that we added in SaltStack a way to authenticate yourself with the\n        Docker Hub Registry by supplying your credentials (username, email &\n        password) using pillars. For more information, see salt.modules.dockerio\n        execution module.\n\n    name\n        Name of the image\n\n    tag\n        Tag of the image\n\n    force\n        Pull even if the image is already pulled\n\n    insecure_registry\n        Set to ``True`` to allow connections to non-HTTPS registries. Default ``False``.\n    ' #NEWLINE# inspect_image = __salt__ [ 'docker.inspect_image' ] #NEWLINE# image_name = _get_image_name ( name , tag ) #NEWLINE# image_infos = inspect_image ( image_name ) #NEWLINE# if ( image_infos [ 'status' ] and ( not force ) ) : #NEWLINE# #INDENT# return _valid ( name = name , comment = 'Image already pulled: {0}' . format ( image_name ) ) #NEWLINE# #UNINDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# comment = 'Image {0} will be pulled' . format ( image_name ) #NEWLINE# return _ret_status ( name = name , comment = comment ) #NEWLINE# #UNINDENT# previous_id = ( image_infos [ 'out' ] [ 'Id' ] if image_infos [ 'status' ] else None ) #NEWLINE# pull = __salt__ [ 'docker.pull' ] #NEWLINE# returned = pull ( name , tag = tag , insecure_registry = insecure_registry ) #NEWLINE# if ( previous_id != returned [ 'id' ] ) : #NEWLINE# #INDENT# changes = { #NEWLINE# #INDENT# name : { #NEWLINE# #INDENT# 'old' : previous_id , #NEWLINE# 'new' : returned [ 'id' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# comment = 'Image {0} pulled' . format ( image_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# changes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# comment = '' #NEWLINE# #UNINDENT# return _ret_status ( returned , name , changes = changes , comment = comment )