// loadImages() loads all the images defined in the registered services
503650
func (m *Manager) loadImages() error {
	loadedImages := make(map[string]bool)
	for _, c := range m.services {
		exists, err := m.imageExists(c.Repo, c.Tag)
		if err != nil {
			return err
		}
		if exists {
			log.WithFields(logrus.Fields{
				"isvc": c.Name,
				"repo": c.Repo,
				"tag":  c.Tag,
			}).Debug("Found image for internal service")
			continue
		}
		localTar := path.Join(m.imagesDir, c.Repo, c.Tag+".tar.gz")
		imageRepoTag := c.Repo + ":" + c.Tag
		log := log.WithFields(logrus.Fields{
			"image": imageRepoTag,
		})
		if _, exists := loadedImages[imageRepoTag]; exists {
			continue
		}
		if _, err := os.Stat(localTar); err == nil {
			if err := docker.ImportImage(imageRepoTag, localTar); err != nil {
				return err
			}
			loadedImages[imageRepoTag] = true
			log.WithFields(logrus.Fields{
				"tarball": localTar,
			}).Debug("Loaded image from local tarball")
		} else {
			log.Debug("Pulling image")
			if err := docker.PullImage(imageRepoTag); err != nil {
				return fmt.Errorf("Failed to pull image %s: %s", imageRepoTag, err)
			}
			loadedImages[imageRepoTag] = true
			log.Info("Pulled image")
		}
	}
	return nil
}
607804
func ImageMetadataToImages(inputs []*imagemetadata.ImageMetadata) []Image {
	result := make([]Image, len(inputs))
	for index, input := range inputs {
		result[index] = Image{
			Id:       input.Id,
			VirtType: input.VirtType,
			Arch:     input.Arch,
		}
	}
	return result
}
1132240
func CacheAndLoadImages(images []string) error {
	if err := CacheImages(images, constants.ImageCacheDir); err != nil {
		return err
	}
	api, err := NewAPIClient()
	if err != nil {
		return err
	}
	defer api.Close()
	h, err := api.Load(config.GetMachineName())
	if err != nil {
		return err
	}

	client, err := sshutil.NewSSHClient(h.Driver)
	if err != nil {
		return err
	}
	cmdRunner, err := bootstrapper.NewSSHRunner(client), nil
	if err != nil {
		return err
	}

	return LoadImages(cmdRunner, images, constants.ImageCacheDir)
}
196048
func (c *Client) ListImages(filter *Filter) ([]Image, error) {
	var resp []Image
	req := request{
		method: client.GET,
		url:    apiImages,
		filter: filter,
		resp:   &resp,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to get list of images")
	}
	return resp, nil
}
162067
func loadKeys(keys map[rune]kb.Key) error {
	// load key converter data
	keycodeConverterMap, err := loadKeycodeConverterData()
	if err != nil {
		return err
	}

	// load dom code map
	domKeyMap, err := loadDomKeyData()
	if err != nil {
		return err
	}

	// load US layout data
	layoutBuf, err := grab(domUsLayoutDataH)
	if err != nil {
		return err
	}

	// load scan code map
	scanCodeMap, err := loadScanCodes(keycodeConverterMap, domKeyMap, layoutBuf)
	if err != nil {
		return err
	}

	// process printable
	err = loadPrintable(keys, keycodeConverterMap, domKeyMap, layoutBuf, scanCodeMap)
	if err != nil {
		return err
	}

	// process non-printable
	err = loadNonPrintable(keys, keycodeConverterMap, domKeyMap, layoutBuf, scanCodeMap)
	if err != nil {
		return err
	}

	return nil
}
75998
func (c *Client) ListImages(kind, series, arch string) ([]params.ImageMetadata, error) {
	p := params.ImageFilterParams{
		Images: []params.ImageSpec{
			{Kind: kind, Series: series, Arch: arch},
		},
	}
	var result params.ListImageResult
	err := c.facade.FacadeCall("ListImages", p, &result)
	return result.Result, err
}
775098
func (c *Conn) Images(album *Album) ([]*Image, error) {
	var out struct {
		Album struct {
			Images []*Image
		}
	}

	if err := c.do("smugmug.images.get", &out,
		"AlbumID", itoa64(album.ID),
		"AlbumKey", album.Key,
		"Heavy", "1",
	); err != nil {
		return nil, err
	}

	return out.Album.Images, nil
}
637622
func (s *storeImpl) GetImages(ctx datastore.Context) ([]Image, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.GetImages"))
	query := search.Query().Search("_exists_:Library")
	search := search.Search("controlplane").Type(kind).Size("50000").Query(query)
	q := datastore.NewQuery(ctx)
	results, err := q.Execute(search)
	if err != nil {
		return nil, err
	}
	return convert(results)
}
1016896
func (c *Client) ImageService() images.Store {
	if c.imageStore != nil {
		return c.imageStore
	}
	c.connMu.Lock()
	defer c.connMu.Unlock()
	return NewImageStoreFromClient(imagesapi.NewImagesClient(c.conn))
}
403924
func (m *Manager) allImagesExist() error {
	for _, c := range m.services {
		if exists, err := m.imageExists(c.Repo, c.Tag); err != nil {
			return err
		} else {
			if !exists {
				return ErrImageNotExists
			}
		}
	}
	return nil
}
572224
func (api *ImageManagerAPI) ListImages(arg params.ImageFilterParams) (params.ListImageResult, error) {
	var result params.ListImageResult
	admin, err := api.authorizer.HasPermission(permission.SuperuserAccess, api.state.ControllerTag())
	if err != nil {
		return result, errors.Trace(err)
	}
	if !admin {
		return result, common.ServerError(common.ErrPerm)
	}

	if len(arg.Images) > 1 {
		return result, errors.New("image filter with multiple terms not supported")
	}
	filter := imagestorage.ImageFilter{}
	if len(arg.Images) == 1 {
		filter = imagestorage.ImageFilter{
			Kind:   arg.Images[0].Kind,
			Series: arg.Images[0].Series,
			Arch:   arg.Images[0].Arch,
		}
	}
	stor := api.state.ImageStorage()
	metadata, err := stor.ListImages(filter)
	if err != nil {
		return result, nil
	}
	result.Result = make([]params.ImageMetadata, len(metadata))
	for i, m := range metadata {
		result.Result[i] = params.ImageMetadata{
			Kind:    m.Kind,
			Series:  m.Series,
			Arch:    m.Arch,
			URL:     m.SourceURL,
			Created: m.Created,
		}
	}
	return result, nil
}
1036057
func (d *Daemon) ListImages(ctx context.Context, spec update.ResourceSpec) ([]v6.ImageStatus, error) {
	return d.ListImagesWithOptions(ctx, v10.ListImagesOptions{Spec: spec})
}
901824
func (bow *Browser) Images() []*Image {
	images := make([]*Image, 0, InitialAssetsSliceSize)
	bow.Find("img").Each(func(_ int, s *goquery.Selection) {
		src, err := bow.attrToResolvedUrl("src", s)
		if err == nil {
			images = append(images, NewImageAsset(
				src,
				bow.attrOrDefault("id", "", s),
				bow.attrOrDefault("alt", "", s),
				bow.attrOrDefault("title", "", s),
			))
		}
	})

	return images
}
472776
func (f *Finder) FindImages(al *apps.Apps) error {
	return al.Walk(func(app *apps.App) error {
		h, err := f.FindImage(app.Image, app.Asc)
		if err != nil {
			return err
		}
		app.ImageID = *h
		return nil
	})
}
829748
func LoadCachedImagesInConfigFile() error {
	images, err := imagesInConfigFile()
	if err != nil {
		return err
	}
	if len(images) == 0 {
		return nil
	}
	return machine.CacheAndLoadImages(images)
}
551878
func (c *Client) SearchImages(term string) ([]APIImageSearch, error) {
	resp, err := c.do("GET", "/images/search?term="+term, doOptions{})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	var searchResult []APIImageSearch
	if err := json.NewDecoder(resp.Body).Decode(&searchResult); err != nil {
		return nil, err
	}
	return searchResult, nil
}
1144636
func (bt *Tagger) TagImages(imageID image.ID) error {
	for _, rt := range bt.repoAndTags {
		if err := bt.imageComponent.TagImageWithReference(imageID, rt); err != nil {
			return err
		}
		fmt.Fprintf(bt.stdout, "Successfully tagged %s\n", reference.FamiliarString(rt))
	}
	return nil
}