def commit_config(self, message="<STR_LIT>"):
if message:<EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>self._gen_rollback_cfg()<EOL>if self.config_replace:<EOL><INDENT>filename = self.candidate_cfg<EOL>cfg_file = self._gen_full_path(filename)<EOL>if not self._check_file_exists(cfg_file):<EOL><INDENT>raise ReplaceConfigException("<STR_LIT>")<EOL><DEDENT>if self.auto_rollback_on_error:<EOL><INDENT>cmd = "<STR_LIT>".format(cfg_file)<EOL><DEDENT>else:<EOL><INDENT>cmd = "<STR_LIT>".format(cfg_file)<EOL><DEDENT>output = self._commit_handler(cmd)<EOL>if (<EOL>("<STR_LIT>" in output)<EOL>or ("<STR_LIT:error>" in output.lower())<EOL>or ("<STR_LIT>" in output.lower())<EOL>or ("<STR_LIT>" in output.lower())<EOL>):<EOL><INDENT>msg = "<STR_LIT>".format(output)<EOL>raise ReplaceConfigException(msg)<EOL><DEDENT>elif "<STR_LIT>" in output:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ReplaceConfigException(msg)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>filename = self.merge_cfg<EOL>cfg_file = self._gen_full_path(filename)<EOL>if not self._check_file_exists(cfg_file):<EOL><INDENT>raise MergeConfigException("<STR_LIT>")<EOL><DEDENT>cmd = "<STR_LIT>".format(cfg_file)<EOL>output = self._commit_handler(cmd)<EOL>if "<STR_LIT>" in output:<EOL><INDENT>self.rollback()<EOL>err_header = "<STR_LIT>"<EOL>merge_error = "<STR_LIT>".format(err_header, output)<EOL>raise MergeConfigException(merge_error)<EOL><DEDENT><DEDENT>self.prompt_quiet_configured = None<EOL>output += self.device.save_config()<EOL>
If replacement operation, perform 'configure replace' for the entire config.

If merge operation, perform copy <file> running-config.