def _best_image(self, properties):
        # Check whether user exported all required environment variables.
        images = glance_images.get_images()
        match_all = images.keys()
        architecture = properties.get(self.ARCHITECTURE)
        if architecture is None:
            self._log_compute_msg(self.ARCHITECTURE, 'image')
        match_arch = self._match_images(match_all, images,
                                        self.ARCHITECTURE, architecture)
        type = properties.get(self.TYPE)
        if type is None:
            self._log_compute_msg(self.TYPE, 'image')
        match_type = self._match_images(match_arch, images, self.TYPE, type)
        distribution = properties.get(self.DISTRIBUTION)
        if distribution is None:
            self._log_compute_msg(self.DISTRIBUTION, 'image')
        match_distribution = self._match_images(match_type, images,
                                                self.DISTRIBUTION,
                                                distribution)
        version = properties.get(self.VERSION)
        if version is None:
            self._log_compute_msg(self.VERSION, 'image')
        match_version = self._match_images(match_distribution, images,
                                           self.VERSION, version)

        if len(match_version):
            return list(match_version)[0]
    def _best_image(self, properties):
        # Check whether user exported all required environment variables.
        images = glance_images.get_images()
        match_all = images.keys()
        architecture = properties.get(self.ARCHITECTURE)
        if architecture is None:
            self._log_compute_msg(self.ARCHITECTURE, 'image')
        match_arch = self._match_images(match_all, images, self.ARCHITECTURE,
                                        architecture)
        type = properties.get(self.TYPE)
        if type is None:
            self._log_compute_msg(self.TYPE, 'image')
        match_type = self._match_images(match_arch, images, self.TYPE, type)
        distribution = properties.get(self.DISTRIBUTION)
        if distribution is None:
            self._log_compute_msg(self.DISTRIBUTION, 'image')
        match_distribution = self._match_images(match_type, images,
                                                self.DISTRIBUTION,
                                                distribution)
        version = properties.get(self.VERSION)
        if version is None:
            self._log_compute_msg(self.VERSION, 'image')
        match_version = self._match_images(match_distribution, images,
                                           self.VERSION, version)

        if len(match_version):
            return list(match_version)[0]