Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize before release #146

Merged
merged 16 commits into from
Feb 28, 2024
Merged

Finalize before release #146

merged 16 commits into from
Feb 28, 2024

Conversation

snaselj
Copy link
Contributor

@snaselj snaselj commented Feb 27, 2024

Closes: NaN

What's Changed

  • Added Source and Nautobot stats to summaries.
    • Renamed DiffSummary to DiffSyncSummary.
    • Added NautobotModelSummary, NautobotModelsStats and SourceModelStats.
    • Moved issues to appropriate NautobotModelSummary.
    • Fixed printing stats based on changes.
    • Moved first and second pass to separate SourceModel methods and added more detailed stats calculating.
  • Fixed units field importer.
  • Fixed importer for u_height field to use default importer.
    • Custom importer is not necessary anymore as the default integer importer truncates to integer and adds an importer issue.
  • Fixed failing import when CustomField.label field is empty.
    • Added default value to CustomField.label.
  • Fixed to use add_issue() instead of logger.warning()
  • Refactored setting target values using source_field.set_nautobot_value() instead of setattr().
  • Removed print_field_mappings argument.
    • Summary is now printed including field mappings, the argument was not necessary.
  • Fixed tests:
    • Replaced hard-coded test stats in test_import.py with stats stored in summaries.
    • Added --build-fixtures argument to invoke unittest to build fixtures.
    • Fixed order of arguments in self.assertX(), to pass expected as the first argument.
    • Replaced dynamic test cases by defined, e.g. test_3_6().
  • Updated docs.

Summary is now printed including field mappings, the argument was not
necessary.
- Added default value to `CustomField.label`.
Custom importer is not necessary anymore as the default integer importer truncates to integer and adds an importer issue.
Added better documentation in the code to be used in docs.
- Renamed `DiffSummary` to `DiffSyncSummary`.
- Added `NautobotModelSummary`, `NautobotModelsStats` and
  `SourceModelStats`.
- Moved issues to appropriate `NautobotModelSummary`.
- Fixed printing stats based on changes.
- Moved first and second pass to separate `SourceModel` methods.
- Added more detailed stats calculating.
- Replaced hard-coded summaries in `test_import.py` with stats stored in
  summaries.
- Added `--build-fixtures` argument to `invoke unittest`.
- Fixed order of arguments in `self.assertX()`, to pass expected as
  the first argument.
- Replaced dynamic test cases by defined, e.g. `test_3_6()`.
@@ -46,11 +46,14 @@ This is achieved through `adapter.configure_model(content_type: ContentTypeStr)`
- `identifiers`: A list of fields identifiable as unique references in the source data.
- `default_reference`: A `RecordData` dictionary of default values to reference this model. This is useful when the source data does not provide a reference that is required in Nautobot.
- `extend_content_type`: Define this when a source model extends another source model to merge into a single Nautobot model.
- `forward_references`: Define to forward references to another content type. This is useful when the source data references a content type that is not directly related to the Nautobot content type. For example, a source data references a `dcim.location` content type, but the Nautobot content type is `dcim.locationtype`.
- `disable_related_reference`: Define, to disable storing references to this content type from other content types. This is useful for e.g. `ObjectChange` model.
- `pre_import`: Define a callable to be executed before importing the source data. Can be used to alter or cache the source data before importing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to document:

  • the args that the callable should accept
  • the fact that it actually gets called twice during the import process

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

nautobot = "^2.1.2"
nautobot = "^2.0.6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Why 2.0.6 in particular?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the change made by dependabot. 2.0.6 was there before as it was the latest 2.0 version without security issues AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the revert was that there are more changes to be made to support 2.1.2, and I didn't want to mix it here. Should I update it in a separate PR, or leave it for the release? WDYT @glennmatthews

@snaselj snaselj merged commit 74d2a99 into develop Feb 28, 2024
16 checks passed
@snaselj snaselj deleted the u/snaselj-napps-251-finalize branch February 28, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants