def METHOD_NAME(logger, source_war, target_war, config_file=None,
               insert_path=None):
    """
    Copy warSource to warTarget (checking existence of both), optionally
    repacking the warTarget archive if configuration file resides in
    non-default location.
    """
    if not os.path.isfile(source_war):
        logger.error("{} is not a file".format(source_war))
    if os.path.isdir(target_war):
        orig = target_war
        target_war = os.path.join(target_war, os.path.basename(source_war))
        logger.debug("Target {} is directory, will use {}".
                     format(orig, target_war))
    # If user does not use default configuration file location then attempt to
    # extract WEB-INF/web.xml from the war file using jar or zip utility,
    # update the hardcoded values and then update source.war with the new
    # WEB-INF/web.xml.
    tmp_war = None
    if (config_file and config_file != DEFAULT_CONFIG_FILE) or insert_path:
        # Resolve the path to be absolute so that webapp can find the file.
        if config_file:
            config_file = os.path.abspath(config_file)
        with tempfile.NamedTemporaryFile(prefix='OpenGroktmpWar',
                                         suffix='.war',
                                         delete=False) as tmp_war:
            logger.debug('Repacking {} with custom configuration path to {}'.
                         format(source_war, tmp_war.name))
            repack_war(logger, source_war, tmp_war.name, DEFAULT_CONFIG_FILE,
                       config_file, insert_path)
            source_war = tmp_war.name
    logger.debug(f"Installing '{source_war}' to '{target_war}'")
    target_dir = os.path.dirname(target_war)
    if not os.path.isdir(target_dir):
        os.makedirs(target_dir)
    copyfile(source_war, target_war)
    if tmp_war:
        os.remove(tmp_war.name)