def commit_config(self, source: str='running') -> ScrapliCfgResponse:
    scrapli_responses = []
    response = self._pre_commit_config(source=source, session_or_config_file=bool(self.candidate_config_filename))
    file_prompt_mode = self._determine_file_prompt_mode()
    if (self._replace is True):
        replace_command = f'configure replace {self.filesystem}{self.candidate_config_filename} force'
        commit_result = self.conn.send_command(command=replace_command)
    else:
        commit_result = self._commit_config_merge(file_prompt_mode=file_prompt_mode)
    scrapli_responses.append(commit_result)
    save_config_result = self.save_config()
    scrapli_responses.append(save_config_result)
    if self.cleanup_post_commit:
        cleanup_result = self._delete_candidate_config()
        scrapli_responses.append(cleanup_result)
    self._reset_config_session()
    return self._post_load_config(response=response, scrapli_responses=scrapli_responses)
def commit_config(self, source: str='running') -> ScrapliCfgResponse:
    scrapli_responses = []
    response = self._pre_commit_config(source=source, session_or_config_file=bool(self.candidate_config_filename))
    file_prompt_mode = self._determine_file_prompt_mode()
    if (self._replace is True):
        replace_command = f'configure replace {self.filesystem}{self.candidate_config_filename} force'
        commit_result = self.conn.send_command(command=replace_command)
    else:
        commit_result = self._commit_config_merge(file_prompt_mode=file_prompt_mode)
    scrapli_responses.append(commit_result)
    save_config_result = self.save_config()
    scrapli_responses.append(save_config_result)
    if self.cleanup_post_commit:
        cleanup_result = self._delete_candidate_config()
        scrapli_responses.append(cleanup_result)
    self._reset_config_session()
    return self._post_load_config(response=response, scrapli_responses=scrapli_responses)