Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Job run failed, but Dry run is successful #119

Closed
ksoufan opened this issue Nov 8, 2022 · 13 comments
Closed

Job run failed, but Dry run is successful #119

ksoufan opened this issue Nov 8, 2022 · 13 comments

Comments

@ksoufan
Copy link

ksoufan commented Nov 8, 2022

Environment

  • Python version: 3.10.8
  • Nautobot version: 1.4.7
  • aristacv-sync version: 1.4.0

Sync completed

Getting IndexError
Dry run is successful

@jdrew82
Copy link
Contributor

jdrew82 commented Nov 10, 2022

Can you please provide the traceback? I need to know where in the code it's throwing the IndexError.

@ksoufan
Copy link
Author

ksoufan commented Nov 11, 2022

Below is the traceback, not sure if it's related to issue #116

Traceback (most recent call last):
File "/opt/nautobot/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 332, in run
self.sync_data()
File "/opt/nautobot/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 167, in sync_data
self.execute_sync()
File "/opt/nautobot/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 95, in execute_sync
self.source_adapter.sync_to(self.target_adapter, flags=self.diffsync_flags)
File "/opt/nautobot/lib/python3.10/site-packages/diffsync/init.py", line 546, in sync_to
target.sync_from(self, diff_class=diff_class, flags=flags, callback=callback, diff=diff)
File "/opt/nautobot/lib/python3.10/site-packages/diffsync/init.py", line 524, in sync_from
result = syncer.perform_sync()
File "/opt/nautobot/lib/python3.10/site-packages/diffsync/helpers.py", line 326, in perform_sync
changed |= self.sync_diff_element(element)
File "/opt/nautobot/lib/python3.10/site-packages/diffsync/helpers.py", line 366, in sync_diff_element
changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
File "/opt/nautobot/lib/python3.10/site-packages/diffsync/helpers.py", line 415, in sync_model
dst_model = self.model_class.create(diffsync=self.dst_diffsync, ids=ids, attrs=attrs)
File "/opt/nautobot/lib/python3.10/site-packages/nautobot_ssot_aristacv/diffsync/models/nautobot.py", line 43, in create
site_code, role_code = nautobot.parse_hostname(ids["name"].lower())
File "/opt/nautobot/lib/python3.10/site-packages/nautobot_ssot_aristacv/utils/nautobot.py", line 127, in parse_hostname
if match.group("site"):
IndexError: no such group

@ksoufan
Copy link
Author

ksoufan commented Nov 15, 2022

@jdrew82 Were you able to find the issue in the nautobot model?

@jdrew82
Copy link
Contributor

jdrew82 commented Nov 15, 2022

@ksoufan I've not had a chance to look into this one yet. I'll try to take a look today or tomorrow. It's a bit of an odd error. What do you have in your hostname_patterns setting? I'm going to guess that you don't have a capture group that has the site key.

@ksoufan
Copy link
Author

ksoufan commented Nov 15, 2022

Yep, the Nautobot instance is a fresh installed and trying to pull all from cloudvision.

@jdrew82
Copy link
Contributor

jdrew82 commented Nov 15, 2022

@ksoufan Can you please share your settings for the plugin from nautobot_config.py?

@jdrew82
Copy link
Contributor

jdrew82 commented Nov 15, 2022

Actually, nevermind. I've recreated this in my unit tests. It's definitely because there's no capture group in your hostname_patterns setting using the site key.

qduk pushed a commit that referenced this issue Nov 30, 2022
* test: ✅ Update override settings for tests to be explicit to remove dependence on dev config.

To ensure that any changes to the plugin settings in the dev settings doesn't impact the test I'm explicitly setting the hostname patterns and site or role mappings accordingly.

* fix: 🐛 Add validation that site or role named capture group is in hostname_patterns. Fixes 119.

To ensure that the match group for site or role is defined in the hostname_patterns setting we need to check for it. This fixes the issue that was detailed in #119. I've also included some unit tests to confirm that defining only site or role capture groups should work.

Co-authored-by: Justin Drew <jdrew82@users.noreply.github.com>
@jdrew82
Copy link
Contributor

jdrew82 commented Dec 12, 2022

@ksoufan can you confirm if this is still an issue or not?

@ksoufan
Copy link
Author

ksoufan commented Dec 23, 2022

@jdrew82 I tried upgrading the plugin but I got the same version, how do I install this fix?

@jdrew82
Copy link
Contributor

jdrew82 commented Jan 3, 2023

@ksoufan This would most likely be because a new release hasn't been cut yet. I'm working on having that done. Until that's done, you'll need to pull from the develop branch of this repo. There are steps on how you can do that detailed in my recent blog post: https://blog.networktocode.com/post/manage_nautobot_poetry/.

@jdrew82
Copy link
Contributor

jdrew82 commented Jan 24, 2023

@ksoufan We've got a new release cut and pushed to PyPI so you should be able to install from there. That should address your issue and we can close this out.

@qduk
Copy link
Contributor

qduk commented Mar 28, 2023

@ksoufan did updating resolve your issue?

@qduk
Copy link
Contributor

qduk commented Sep 14, 2023

@ksoufan I'm closing this as there hasn't been a response in awhile. If there is still an issue, please open an issue on the aggregate nautobot-ssot app.

@qduk qduk closed this as completed Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants