def add_property_to_keystore()

in cars/v1/apm_tracing/config.py [0:0]


def add_property_to_keystore(keystore_binary, property_name, property_value, env):
    logger = logging.getLogger(LOGGER_NAME)

    echo_value = subprocess.Popen(["echo", property_value], stdout=subprocess.PIPE)

    keystore_command = "{keystore} --silent add --stdin {key}".format(
        keystore=keystore_binary, key=property_name
    )

    return_code = process.run_subprocess_with_logging(
        keystore_command, stdin=echo_value.stdout, env=env
    )

    if return_code != 0:
        logger.error("%s has exited with code [%d]", keystore_command, return_code)
        raise exceptions.SystemSetupError(
            "Could not add APM tracing keystore secure setting [{}]. Please see the log for details.".format(
                property_name
            )
        )