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

Git imported template immediately removed during import #570

Closed
u1735067 opened this issue Jun 14, 2021 · 2 comments · Fixed by #582
Closed

Git imported template immediately removed during import #570

u1735067 opened this issue Jun 14, 2021 · 2 comments · Fixed by #582
Assignees
Labels
type: bug Something isn't working as expected

Comments

@u1735067
Copy link
Contributor

Environment

  • Python version: 3.6
  • Nautobot version: 1.0.2

Steps to Reproduce

  1. Create Git repo with /export_templates/ipam/vlan/html_export.html export template
  2. Add Git repo in Nautobot
  3. Launch (or relaunch) sync

Expected Behavior

Template is imported and kept

Observed Behavior

Template is imported and then immediately removed, in log we can observe:

worker_1 | 11:52:36.095 INFO nautobot.datasources.git :
worker_1 | Loading `ipam.vlan` export template from `text_export.html`
worker_1 | 11:52:36.179 INFO nautobot.datasources.git :
worker_1 | Successfully created export template
worker_1 | 11:52:36.190 WARNING nautobot.datasources.git :
worker_1 | Deleted export template [GitLab] ipam | VLAN: text_export.html

This seems to be caused by https://github.com/nautobot/nautobot/blob/v1.0.2/nautobot/extras/datasources/git.py#L694, where template_record.content_type.name (=VLAN) is used instead of template_record.content_type.model (=vlan), may I submit a PR with this change?

@glennmatthews glennmatthews added status: accepted type: bug Something isn't working as expected labels Jun 14, 2021
@glennmatthews
Copy link
Contributor

Thank you for the report and for the analysis! I agree with your analysis; please do feel free to submit a PR that fixes this and adds an appropriate unit test covering this issue.

@u1735067
Copy link
Contributor Author

u1735067 commented Jun 14, 2021

While I have a PR ready for the fix (develop...u1735067:patch-1), I don't have the tests part and cannot work on it until maybe wednesday because of workstation lacking ressources for another dev environment, so I'll then look into it, if you haven't already completed it by this time.

glennmatthews pushed a commit that referenced this issue Jun 21, 2021
* Fix git template import for some objects

Closes #570.

* Add test for Git imported vlan template
glennmatthews added a commit that referenced this issue Jun 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants