- 
                Notifications
    
You must be signed in to change notification settings  - Fork 121
 
Remove Repo init from __init__ #76
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
Conversation
Initializing the repository from init, before the path has been updated, will lead to various errors when the script is not run directly from the repository.
| 
           Hey @p-rintz good catch. I am in the middle of doing a complete overhaul and I really appreciate you catching this potential regression (might have always been there? dunno). Either way this was a great catch and in the latest release which is yet to come, the actual root cause of the issue is fixed. Now we will utilize   | 
    
| 
           In testing, it looks like this issue is exasperated more so the further away you get. Anyway I have implemented a full fix in the dev branch I have right now.. Can you give me access to your repo so I can push those changes into your PR? That or please implement these changes. nb-dt-import.py settings.py  | 
    
| 
           Thanks @p-rintz! Could you please pull down and test my changes? Once you approve I will merge this :)  | 
    
| 
           I will do so tomorrow, once I'm at work. Currently 1am here. 😄 Thanks for the quick fix.  | 
    
| 
           Awesome! Happy to help  | 
    
| 
           LGTM Ran through fine both from inside and outside the script-folder.  | 
    
* Removed multiple imports of settings.py * stating to abstract the netbox api calls to their own class * Abstracted away determine features from main script, implemented as part of class initialization * added helper functions to get repos relative & absolute path * renaming gitcmd to repo * starting to abstract away the get_files * fixed issue where spaces and commas in vendor list with/without spaces breaks matching * Added prelim fix for slugs if same issue vendors arg was facing exists. untested * Finished abstracting the get_files function. Reduced fors and ifs to be cleaner and more efficent * abstracted getFiles to repo class. Fixed slug issue not matching because of new slug format. added non-halting log function and renamed exception handler to log handler. * utilized new logging class throughout script to reduce excess logging * Abstracted and optimized create manufacturers * Abstracted the create interfaces for devices to the netbox api class * Fixed regression where check manufactuerers did not have the latest list * Fixed regression caused by externally calling script. Discovered from #76 * abstracted all device interfaces to the devicetype class. optimized function calls to reduce duplicate code and reduce extra log calls * Ran against all devices and passed with flying colors * formatting settings.py * formatting repo.py * formatting main file * formatting log_handler.py
* Delete gitcmd.py * Delete nb-dt-import.py * Add files via upload * Logging cleanup (#78) * Removed multiple imports of settings.py * stating to abstract the netbox api calls to their own class * Abstracted away determine features from main script, implemented as part of class initialization * added helper functions to get repos relative & absolute path * renaming gitcmd to repo * starting to abstract away the get_files * fixed issue where spaces and commas in vendor list with/without spaces breaks matching * Added prelim fix for slugs if same issue vendors arg was facing exists. untested * Finished abstracting the get_files function. Reduced fors and ifs to be cleaner and more efficent * abstracted getFiles to repo class. Fixed slug issue not matching because of new slug format. added non-halting log function and renamed exception handler to log handler. * utilized new logging class throughout script to reduce excess logging * Abstracted and optimized create manufacturers * Abstracted the create interfaces for devices to the netbox api class * Fixed regression where check manufactuerers did not have the latest list * Fixed regression caused by externally calling script. Discovered from #76 * abstracted all device interfaces to the devicetype class. optimized function calls to reduce duplicate code and reduce extra log calls * Ran against all devices and passed with flying colors * formatting settings.py * formatting repo.py * formatting main file * formatting log_handler.py * added back executable on file (#79) * Add more info to failed device_type creations (#81) --------- Co-authored-by: Philipp Rintz <[email protected]>
Initializing the repository from init, before the path has been updated, will lead an exception when the script is not run directly from the repository.
Example exception (during the run in an ansible playbook):
git.exc.InvalidGitRepositoryError: /home/ansible
I ran the script successfully directy from the folder as well as from outside with the line removed:
# python3 nb-dt-import.py# /opt/Netbox-Device-Type-Library-Import/.venv/bin/python3 /opt/Netbox-Device-Type-Library-Import/nb-dt-import.py