def pulled(name, tag='latest', force=False, insecure_registry=False, *args, **kwargs):
 inspect_image = __salt__['docker.inspect_image']
 image_name = _get_image_name(name, tag)
 image_infos = inspect_image(image_name)
 if (image_infos['status'] and (not force)):
  return _valid(name=name, comment='Image already pulled: {0}'.format(image_name))
 if __opts__['test']:
  comment = 'Image {0} will be pulled'.format(image_name)
  return _ret_status(name=name, comment=comment)
 previous_id = (image_infos['out']['Id'] if image_infos['status'] else None)
 pull = __salt__['docker.pull']
 returned = pull(name, tag=tag, insecure_registry=insecure_registry)
 if (previous_id != returned['id']):
  changes = {name: {'old': previous_id, 'new': returned['id']}}
  comment = 'Image {0} pulled'.format(image_name)
 else:
  changes = {}
  comment = ''
 return _ret_status(returned, name, changes=changes, comment=comment)

def pulled ( name , tag = 'latest' , force = False , insecure_registry = False , * args , ** kwargs ) : inspect_image = __salt__ [ 'docker.inspect_image' ] image_name = _get_image_name ( name , tag ) image_infos = inspect_image ( image_name ) if ( image_infos [ 'status' ] and ( not force ) ) : return _valid ( name = name , comment = 'Image already pulled: {0}' . format ( image_name ) ) if __opts__ [ 'test' ] : comment = 'Image {0} will be pulled' . format ( image_name ) return _ret_status ( name = name , comment = comment ) previous_id = ( image_infos [ 'out' ] [ 'Id' ] if image_infos [ 'status' ] else None ) pull = __salt__ [ 'docker.pull' ] returned = pull ( name , tag = tag , insecure_registry = insecure_registry ) if ( previous_id != returned [ 'id' ] ) : changes = { name : { 'old' : previous_id , 'new' : returned [ 'id' ] } } comment = 'Image {0} pulled' . format ( image_name ) else : changes = { } comment = '' return _ret_status ( returned , name , changes = changes , comment = comment )
pull an image from a docker registry .