def main():
    utils.verify_build_directory(deploy_options.namespace)
    verify_ocp_versions(
        json.loads(json.loads('"{}"'.format(deploy_options.ocp_versions))))

    with open(SRC_FILE, "r") as src:
        with open(DST_FILE, "w+") as dst:
            data = src.read()
            data = data.replace("REPLACE_DOMAINS",
                                '"{}"'.format(deploy_options.base_dns_domains))

            if deploy_options.apply_manifest:
                data = data.replace(
                    "REPLACE_BASE_URL",
                    utils.get_service_url(
                        service=SERVICE,
                        target=deploy_options.target,
                        domain=deploy_options.domain,
                        namespace=deploy_options.namespace,
                        disable_tls=deploy_options.disable_tls))

            data = data.replace('REPLACE_NAMESPACE',
                                f'"{deploy_options.namespace}"')
            data = data.replace('REPLACE_AUTH_TYPE_FLAG',
                                '"{}"'.format(deploy_options.auth_type))
            data = data.replace(
                'REPLACE_WITH_AMS_SUBSCRIPTIONS',
                '"{}"'.format(deploy_options.with_ams_subscriptions))
            data = data.replace('REPLACE_CHECK_CLUSTER_VERSION_FLAG',
                                '"{}"'.format(deploy_options.check_cvo))
            data = data.replace('REPLACE_JWKS_URL',
                                '"{}"'.format(deploy_options.jwks_url))
            data = data.replace('REPLACE_OCM_BASE_URL',
                                '"{}"'.format(deploy_options.ocm_url))
            data = data.replace('REPLACE_OPENSHIFT_VERSIONS',
                                '"{}"'.format(deploy_options.ocp_versions))
            data = data.replace(
                'REPLACE_PUBLIC_CONTAINER_REGISTRIES',
                '"{}"'.format(deploy_options.public_registries))
            data = data.replace('REPLACE_IPV6_SUPPORT',
                                '"{}"'.format(deploy_options.ipv6_support))
            data = data.replace('REPLACE_HW_VALIDATOR_REQUIREMENTS',
                                '"{}"'.format(deploy_options.hw_requirements))
            data = data.replace(
                'REPLACE_DISABLED_HOST_VALIDATIONS',
                '"{}"'.format(deploy_options.disabled_host_validations))

            versions = {
                "INSTALLER_IMAGE": "assisted-installer",
                "CONTROLLER_IMAGE": "assisted-installer-controller",
                "AGENT_DOCKER_IMAGE": "assisted-installer-agent"
            }
            for env_var_name, image_short_name in versions.items():
                versions[env_var_name] = deployment_options.get_image_override(
                    deploy_options, image_short_name, env_var_name)
                log.info(f"Logging {image_short_name} information")
                log_image_revision(versions[env_var_name])

            # Edge case for controller image override
            if os.environ.get("INSTALLER_IMAGE"
                              ) and not os.environ.get("CONTROLLER_IMAGE"):
                versions[
                    "CONTROLLER_IMAGE"] = deployment_options.IMAGE_FQDN_TEMPLATE.format(
                        "assisted-installer-controller",
                        deployment_options.get_tag(
                            versions["INSTALLER_IMAGE"]))

            versions["SELF_VERSION"] = deployment_options.get_image_override(
                deploy_options, "assisted-service", "SERVICE")
            log.info(f"Logging assisted-service information")
            log_image_revision(versions["SELF_VERSION"])
            deploy_tag = get_deployment_tag(deploy_options)
            if deploy_tag:
                versions["RELEASE_TAG"] = deploy_tag

            y = yaml.safe_load(data)
            y['data'].update(versions)

            y['data'][
                'ENABLE_SINGLE_NODE_DNSMASQ'] = deploy_options.enable_sno_dnsmasq
            y['data']['STORAGE'] = deploy_options.storage

            if deploy_options.installation_timeout:
                y['data']['INSTALLATION_TIMEOUT'] = str(
                    deploy_options.installation_timeout)

            admins = get_admin_users()
            if admins:
                y['data']['ADMIN_USERS'] = admins

            if deploy_options.img_expr_time:
                y['data'][
                    'IMAGE_EXPIRATION_TIME'] = deploy_options.img_expr_time

            if deploy_options.img_expr_time:
                y['data'][
                    'IMAGE_EXPIRATION_INTERVAL'] = deploy_options.img_expr_interval

            if deploy_options.enable_kube_api:
                y['data']['ENABLE_KUBE_API'] = 'true'

            if deploy_options.kubeapi_day2:
                y['data']['ENABLE_KUBE_API_DAY2'] = deploy_options.kubeapi_day2

            data = yaml.dump(y)
            dst.write(data)

    if deploy_options.apply_manifest:
        log.info("Deploying {}".format(DST_FILE))
        utils.apply(target=deploy_options.target,
                    namespace=deploy_options.namespace,
                    file=DST_FILE)
def main():
    log = utils.get_logger('deploy-service-configmap')
    utils.verify_build_directory(deploy_options.namespace)
    verify_ocp_versions(json.loads(json.loads('"{}"'.format(deploy_options.ocp_versions))))

    with open(SRC_FILE, "r") as src:
        with open(DST_FILE, "w+") as dst:
            data = src.read()
            data = data.replace("REPLACE_DOMAINS", '"{}"'.format(deploy_options.base_dns_domains))
            data = data.replace("REPLACE_BASE_URL", utils.get_service_url(service=SERVICE,
                                                                          target=deploy_options.target,
                                                                          domain=deploy_options.domain,
                                                                          namespace=deploy_options.namespace,
                                                                          profile=deploy_options.profile,
                                                                          disable_tls=deploy_options.disable_tls))

            data = data.replace('REPLACE_NAMESPACE', f'"{deploy_options.namespace}"')
            data = data.replace('REPLACE_AUTH_ENABLED_FLAG', '"{}"'.format(deploy_options.enable_auth))
            data = data.replace('REPLACE_CHECK_CLUSTER_VERSION_FLAG', '"{}"'.format(deploy_options.check_cvo))
            data = data.replace('REPLACE_JWKS_URL', '"{}"'.format(deploy_options.jwks_url))
            data = data.replace('REPLACE_OCM_BASE_URL', '"{}"'.format(deploy_options.ocm_url))
            data = data.replace('REPLACE_OPENSHIFT_VERSIONS', '"{}"'.format(deploy_options.ocp_versions))
            data = data.replace('REPLACE_OPENSHIFT_INSTALL_RELEASE_IMAGE', '"{}"'.format(deploy_options.ocp_override))
            data = data.replace('REPLACE_PUBLIC_CONTAINER_REGISTRIES', '"{}"'.format(deploy_options.public_registries))

            versions = {"INSTALLER_IMAGE": "assisted-installer",
                        "CONTROLLER_IMAGE": "assisted-installer-controller",
                        "AGENT_DOCKER_IMAGE": "assisted-installer-agent",
                        "CONNECTIVITY_CHECK_IMAGE": "assisted-installer-agent",
                        "INVENTORY_IMAGE": "assisted-installer-agent",
                        "FREE_ADDRESSES_IMAGE": "assisted-installer-agent",
                        "DHCP_LEASE_ALLOCATOR_IMAGE": "assisted-installer-agent",
                        "API_VIP_CONNECTIVITY_CHECK_IMAGE": "assisted-installer-agent",
                        "FIO_PERF_CHECK_IMAGE": "assisted-installer-agent",
                        "NTP_SYNCHRONIZER_IMAGE": "assisted-installer-agent"}
            for env_var_name, image_short_name in versions.items():
                versions[env_var_name] = deployment_options.get_image_override(deploy_options, image_short_name, env_var_name)

            # Edge case for controller image override
            if os.environ.get("INSTALLER_IMAGE") and not os.environ.get("CONTROLLER_IMAGE"):
                versions["CONTROLLER_IMAGE"] = deployment_options.IMAGE_FQDN_TEMPLATE.format("assisted-installer-controller",
                    deployment_options.get_tag(versions["INSTALLER_IMAGE"]))

            versions["SELF_VERSION"] = deployment_options.get_image_override(deploy_options, "assisted-service", "SERVICE")
            deploy_tag = get_deployment_tag(deploy_options)
            if deploy_tag:
                versions["RELEASE_TAG"] = deploy_tag

            y = yaml.load(data)
            y['data'].update(versions)

            if deploy_options.installation_timeout:
                y['data']['INSTALLATION_TIMEOUT'] = str(deploy_options.installation_timeout)

            admins = get_admin_users()
            if admins:
                y['data']['ADMIN_USERS'] = admins

            if deploy_options.img_expr_time:
                y['data']['IMAGE_EXPIRATION_TIME'] = deploy_options.img_expr_time

            if deploy_options.img_expr_time:
                y['data']['IMAGE_EXPIRATION_INTERVAL'] = deploy_options.img_expr_interval

            data = yaml.dump(y)
            dst.write(data)

    log.info("Deploying {}".format(DST_FILE))
    utils.apply(
        target=deploy_options.target,
        namespace=deploy_options.namespace,
        profile=deploy_options.profile,
        file=DST_FILE
    )