def get_agent_distribution_builder(distribution, python_version):
    "\n    Find agent distribution docker image for smoke testing.\n    :param distribution: distribution name on which agent package should be installed.\n    Possible values are in the 'ALL_DISTRIBUTION_NAMES' constant.\n    :param python_version: Version of the python interpreter in the distribution.\n    "
    distribution = distribution.lower()
    dockerfiles_directory_path = (Path(__file__).parent / 'distribution_dockerfiles')
    fpm_builder_dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.fpm_package_builder')
    fpm_package_builder_dockerfile_content = fpm_builder_dockerfile_path.read_text()
    if (distribution == AMAZONLINUX):

        class AmazonLinuxSmokeImageBuilder(AgentImageBuilder):
            PYTHON_VERSION = python_version
            COPY_AGENT_SOURCE = True
            IMAGE_TAG = 'scalyr_agent_smoke_{0}_{1}'.format(distribution, python_version)

            @classmethod
            def get_dockerfile_content(cls):
                dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.amazonlinux')
                dockerfile_content = dockerfile_path.read_text()
                return dockerfile_content.format(fpm_package_builder_dockerfile=fpm_package_builder_dockerfile_content, python_version=cls.PYTHON_VERSION)
        return AmazonLinuxSmokeImageBuilder
    elif (distribution == UBUNTU):

        class _UbuntuSmokeImageBuilder(AgentImageBuilder):
            PYTHON_VERSION = python_version
            COPY_AGENT_SOURCE = True
            IMAGE_TAG = 'scalyr_agent_smoke_{0}_{1}'.format(distribution, python_version)

            @classmethod
            def get_dockerfile_content(cls):
                dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.ubuntu')
                dockerfile_content = dockerfile_path.read_text()
                return dockerfile_content.format(fpm_package_builder_dockerfile=fpm_package_builder_dockerfile_content, python_package_name=('python' if (cls.PYTHON_VERSION == 'python2') else cls.PYTHON_VERSION), python_version=cls.PYTHON_VERSION)
        return _UbuntuSmokeImageBuilder
    else:
        raise IOError('Can not find such distribution: {0}'.format(distribution))
Find agent distribution docker image for smoke testing.
:param distribution: distribution name on which agent package should be installed.
Possible values are in the 'ALL_DISTRIBUTION_NAMES' constant.
:param python_version: Version of the python interpreter in the distribution.
def get_agent_distribution_builder(distribution, python_version):
    "\n    Find agent distribution docker image for smoke testing.\n    :param distribution: distribution name on which agent package should be installed.\n    Possible values are in the 'ALL_DISTRIBUTION_NAMES' constant.\n    :param python_version: Version of the python interpreter in the distribution.\n    "
    distribution = distribution.lower()
    dockerfiles_directory_path = (Path(__file__).parent / 'distribution_dockerfiles')
    fpm_builder_dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.fpm_package_builder')
    fpm_package_builder_dockerfile_content = fpm_builder_dockerfile_path.read_text()
    if (distribution == AMAZONLINUX):

        class AmazonLinuxSmokeImageBuilder(AgentImageBuilder):
            PYTHON_VERSION = python_version
            COPY_AGENT_SOURCE = True
            IMAGE_TAG = 'scalyr_agent_smoke_{0}_{1}'.format(distribution, python_version)

            @classmethod
            def get_dockerfile_content(cls):
                dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.amazonlinux')
                dockerfile_content = dockerfile_path.read_text()
                return dockerfile_content.format(fpm_package_builder_dockerfile=fpm_package_builder_dockerfile_content, python_version=cls.PYTHON_VERSION)
        return AmazonLinuxSmokeImageBuilder
    elif (distribution == UBUNTU):

        class _UbuntuSmokeImageBuilder(AgentImageBuilder):
            PYTHON_VERSION = python_version
            COPY_AGENT_SOURCE = True
            IMAGE_TAG = 'scalyr_agent_smoke_{0}_{1}'.format(distribution, python_version)

            @classmethod
            def get_dockerfile_content(cls):
                dockerfile_path = (dockerfiles_directory_path / 'Dockerfile.ubuntu')
                dockerfile_content = dockerfile_path.read_text()
                return dockerfile_content.format(fpm_package_builder_dockerfile=fpm_package_builder_dockerfile_content, python_package_name=('python' if (cls.PYTHON_VERSION == 'python2') else cls.PYTHON_VERSION), python_version=cls.PYTHON_VERSION)
        return _UbuntuSmokeImageBuilder
    else:
        raise IOError('Can not find such distribution: {0}'.format(distribution))