Ejemplo n.º 1
0
Archivo: image.py Proyecto: quay/quay
def set_secscan_status(image, indexed, version):
    return (
        Image.update(security_indexed=indexed, security_indexed_engine=version)
        .where(Image.id == image.id)
        .where((Image.security_indexed_engine != version) | (Image.security_indexed != indexed))
        .execute()
    ) != 0
Ejemplo n.º 2
0
    def test_select_images_to_scan(self):
        # Set all images to have a security index of a version to that of the config.
        expected_version = app.config["SECURITY_SCANNER_ENGINE_VERSION_TARGET"]
        Image.update(security_indexed_engine=expected_version).execute()

        # Ensure no images are available for scanning.
        self.assertIsNone(
            model.image.get_min_id_for_sec_scan(expected_version))
        self.assertTrue(
            len(model.image.get_images_eligible_for_scan(expected_version)) ==
            0)

        # Check for a higher version.
        self.assertIsNotNone(
            model.image.get_min_id_for_sec_scan(expected_version + 1))
        self.assertTrue(
            len(model.image.get_images_eligible_for_scan(expected_version +
                                                         1)) > 0)