def _get_diff(self):
        """Get a diff between running config and a proposed file."""
        diff = []
        self._create_sot_file()
        diff_out = self._send_command(
            "show diff rollback-patch file {} file {}".format(
                "sot_file", self.candidate_cfg
            ),
            raw_text=True,
        )
        try:
            diff_out = (
                diff_out.split("Generating Rollback Patch")[1]
                .replace("Rollback Patch is Empty", "")
                .strip()
            )
            for line in diff_out.splitlines():
                if line:
                    if line[0].strip() != "!" and line[0].strip() != ".":
                        diff.append(line.rstrip(" "))
        except (AttributeError, KeyError):
            raise ReplaceConfigException(
                "Could not calculate diff. It's possible the given file doesn't exist."
            )
        return "\n".join(diff)
def _get_diff ( self ) : diff = [ ] self . _create_sot_file ( ) diff_out = self . _send_command ( "show diff rollback-patch file {} file {}" . format ( "sot_file" , self . candidate_cfg ) , raw_text = True , ) try : diff_out = ( diff_out . split ( "Generating Rollback Patch" ) [ 1 ] . replace ( "Rollback Patch is Empty" , "" ) . strip ( ) ) for line in diff_out . splitlines ( ) : if line : if line [ 0 ] . strip ( ) != "!" and line [ 0 ] . strip ( ) != "." : diff . append ( line . rstrip ( " " ) ) except ( AttributeError , KeyError ) : raise ReplaceConfigException ( "Could not calculate diff. It's possible the given file doesn't exist." ) return "\n" . join ( diff )
Get a diff between running config and a proposed file.