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

Fixing "Hello World!" job not syncing on recent versions (>v2.0?) #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cdtomkins
Copy link

@cdtomkins cdtomkins commented Jan 8, 2025

This is only needed if the training labs are tracking latest version or are moving on to a version that is > v2.0. I was following along with the lab on my own lab environment (v2.3.15), hence discovering the issue.

This change was needed in line with the note here:

"As a result of the changes to the way jobs are imported the top-level directory of any Git Repository that provides Jobs must now contain an init.py file."

Before:

2025-01-08 14:12:09.780146 	main 	Info 	— 	
Refreshing jobs...
2025-01-08 14:12:09.784553 	jobs 	Warning 	— 	
No jobs were registered on loading the training_git_demo.jobs submodule. Did you miss a register_jobs() call? Or was there a syntax error or similar in your code?

After:

2025-01-08 14:17:35.020198 	main 	Info 	— 	
Refreshing jobs...
2025-01-08 14:17:35.052720 	jobs 	Info 	Hello World! 	
Created Job record for nautobot_git_demo_cdtomkins_fork.jobs.hello_world.HelloWorld

I have not tested for this causing any regression on older Nautobot versions or other steps in the lab, although I wouldn't anticipate any.

@cdtomkins
Copy link
Author

@cmsirbu I hope this is useful! If not please feel free to just close it.

@cmsirbu
Copy link
Contributor

cmsirbu commented Jan 8, 2025

Hey @cdtomkins thanks for the PR! This repo is tested with the lab pod snapshot that's 2.1.7 where it works as expected.

The odd part is that docs say that the repo must have an __init__.py in the root of the repo, not sure why I didn't add it back then.

Could you please test with an empty __init__.py (without the imports) if you still have the environment?

@cmsirbu
Copy link
Contributor

cmsirbu commented Jan 8, 2025

Ah the reason it works in our labs is that the requirement for that file was introduced in a change in 2.2.3 - see nautobot/nautobot#5971

@cdtomkins
Copy link
Author

I have tested your suggestion and you're correct - an empty file is sufficient, it still works. Also, interesting link, thanks!

@cmsirbu
Copy link
Contributor

cmsirbu commented Jan 9, 2025

I have tested your suggestion and you're correct - an empty file is sufficient, it still works. Also, interesting link, thanks!

Awesome, thanks! I'll keep this open until I can test it in the lab pod just to be 100% sure there's no weirdness in that version, then merge it.

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