Closed
Description
Environment
- DiffSync version: 1.3.0
Proposed Functionality
Currently doing a diff_to/from
followed by a sync_to/from
, result in calculating the diff twice because sync_to/from
are calculating a new diff automatically.
The proposal is to extend sync_from
and sync_to
to accept an existing diff
self.log_info(message="Loading current data from Data Source...")
diffsync1 = DataSourceDiffSync(job=self, sync=self.sync)
diffsync1.load()
self.log_info(message="Loading current data from Nautobot...")
diffsync2 = NautobotDiffSync(job=self, sync=self.sync)
diffsync2.load()
diffsync_flags = DiffSyncFlags.CONTINUE_ON_FAILURE
self.log_info(message="Calculating diffs...")
diff = diffsync1.diff_to(diffsync_1, flags=diffsync_flags)
if not self.kwargs["dry_run"]:
self.log_info(message="Syncing from Data Source to Nautobot...")
diffsync1.sync_to(diffsync2, flags=diffsync_flags, diff=diff). <<<<<<<<<<<
self.log_info(message="Sync complete")
Use Case
Performance improvement, there is no need to calculate the diff twice on the same dataset
Metadata
Metadata
Assignees
Labels
No labels