Commit Graph

105 Commits

Author SHA1 Message Date
Philipp Rintz
e1e2d780bc
Add more info to failed device_type creations (#81) 2023-03-09 10:01:42 -05:00
Daniel W. Anner
542a56a947
added back executable on file (#79) 2023-03-09 00:53:00 -05:00
Daniel W. Anner
cef5c992d4
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 https://github.com/netbox-community/Device-Type-Library-Import/pull/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
2023-03-09 00:45:32 -05:00
Daniel W. Anner
1872ac577f
Add files via upload 2023-03-09 00:45:00 -05:00
Daniel W. Anner
805a12eae9
Delete nb-dt-import.py 2023-03-09 00:40:53 -05:00
Daniel W. Anner
520c28dfed
Delete gitcmd.py 2023-03-09 00:40:39 -05:00
Philipp Rintz
8832370aba
Remove Repo init from __init__ (#76)
* Remove Repo init from __init__

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.

* Implemented fix that will allow for running script from any directory

---------

Co-authored-by: Daniel W. Anner <daniel.anner@danstechsupport.com>
2023-03-08 13:30:18 -05:00
Daniel W. Anner
4fca4a7fb4
Cleanup (#75)
* - Added exception handler function with easy map dictionary.
- Added extra default values for ENV vars.
- Moved parser args to Settings for global use.
- Started implementing new exception handler
- Moved git functions to gitcmd.py.
- Implemented exception handler for git functions.
- Removed extra imports where no longer needed.

* Added how to fix ssl error in case it pops up

* - Removed circular import of settings.py and gitcmd.py
- Added exception_handler.py to handle exceptions (refer to above)
- Made GitCMD a class with init and run methods
- Removed git completely from nb-dt-import.py

* Fixed missing arg

* made exception handler a class to prevent circular import
2023-03-03 16:03:17 -05:00
Daniel W. Anner
1345a9d89e
Added try except block to catch ssl errors. (#74)
If IGNORE_SSL_ERRORS is true, then silence SSL verification & continue.
If IGNORE_SSL_ERRORS is false, then raise the error with custom message.
Added verbose option to assist with reducing output and allowing for verbose logging if desired.
If IGNORE_SSL_ERRORS is false, and --verbose is specified, then print the exception.
2023-03-03 12:25:25 -05:00
Daniel W. Anner
3726326225
Merge pull request #73 from danner26/workflow-updates
Adding back workflows
2023-03-03 11:28:38 -05:00
Daniel W. Anner
ad4ad1c893
Adding back workflows 2023-03-03 16:27:48 +00:00
Daniel W. Anner
04653aedc1
Merge pull request #72 from danner26/dependabot-updates
Bump Requirement Version & Trim
2023-03-03 11:23:09 -05:00
Daniel W. Anner
f4e8559f77
Removed extra requirements and bumped to latest versions 2023-03-03 16:20:25 +00:00
Daniel W. Anner
517808052f
Merge pull request #66 from danner26/workflow-updates
Workflow updates
2023-03-03 10:31:02 -05:00
Daniel W. Anner
a71bc0cd86
commenting out docker build for the time being 2023-03-03 15:30:31 +00:00
Daniel W. Anner
a0aced0c4a
Adding stale PR workflow, but commented out until we get this repo up to date 2023-03-03 15:27:19 +00:00
Daniel W. Anner
3eef30710a
Added monthly dependabot definition 2023-03-03 15:25:57 +00:00
minitriga
730c8d2f8e
Merge pull request #52 from dmcken/add-module-bay
Add module bays and module types.
2022-09-09 17:04:38 +01:00
David Mc Ken
27db043f9d Update nb-dt-import.py
Removed type hint which is throwing an error on python 3.8.10
2022-09-09 11:01:08 -04:00
David Mc Ken
e733964bc1 Added module counters separate from device-types. 2022-09-08 14:53:18 -04:00
David Mc Ken
541a357b9f Removed manual setting for IMPORT_MODULES.
Instead automatically detect via version 3.2 or higher.
2022-09-08 12:48:24 -04:00
David Mc Ken
6cd282acd8 Added docstring to create_module_types 2022-09-08 10:50:49 -04:00
David Mc Ken
9115a7d310 Removed duplicate create_module_power_outlets 2022-09-08 09:37:47 -04:00
David Mc Ken
22106427d0 Add docstring to get_files_modules 2022-09-08 09:15:19 -04:00
David Mc Ken
397d25e5ca Reactivate createDeviceTypes which was disabled for testing. 2022-09-07 21:38:26 -04:00
David Mc Ken
44b8970854 Modules are now imported as well. 2022-09-07 21:37:23 -04:00
David Mc Ken
926b0ff268 Update nb-dt-import.py
Add create_module_bays and activate in createDeviceTypes()
2022-09-07 10:04:33 -04:00
David Mc Ken
0a99e617e9 Added IMPORT_MODULES setting, default to disabled. 2022-09-06 21:24:11 -04:00
minitriga
cef9773d60
Merge pull request #46 from rmundel/patch-1
Update README.md
2022-02-22 10:33:22 +00:00
Rafael Mundel
b5a790b0b1
Update README.md
Fixed docker pull command - invalid reference format: repository name must be lowercase
Ficker docker run command - Unable to find image 'netbox-devicetype-import-library:latest' locally
2022-01-19 21:06:19 -04:00
minitriga
94d9ec13d2
Merge pull request #45 from dalrrard/patch-1
Fix import failure when no vendor specified
2022-01-07 12:01:25 +00:00
dalrrard
f0c53e29a3
Fix import failure when no vendor specified
Close #44 
Fix regression introduced by #34 

Check to see if each item in the list produced by `split` is iterable. If it is not, remove it. This should only occur when no vendor is specified since a non-empty string is truthy.
2021-12-16 16:26:22 -06:00
minitriga
625bdba434
Merge pull request #43 from gaby/publish-image
Support for ghcr.io container registry.
2021-12-01 10:06:53 +00:00
Juan Calderon-Perez
2ef30d739a Update README 2021-11-25 01:29:42 -05:00
Juan Calderon-Perez
8a3a1256fe Github Workflow and Docker improvements 2021-11-25 01:22:36 -05:00
minitriga
9f20f76650
Merge pull request #39 from suom1/patch-1
Passing branch to update_package()
2021-11-24 09:46:47 +00:00
minitriga
8f3a4b4fdf
Merge pull request #41 from byts-tech/Fix--Issue-#34
Fixes #34: Change Vendor Delimiter
2021-11-24 09:46:28 +00:00
minitriga
d11a527a40
Merge pull request #42 from byts-tech/Fix--Issue-#8
Fixes #8: Strip all not supported chars in manufacturer slug
2021-11-24 09:45:51 +00:00
Flo
12572c9d7d
Update nb-dt-import.py 2021-11-24 08:36:44 +01:00
Flo
183716867e
Update README.md 2021-11-24 08:30:09 +01:00
Flo
6e2e4ff6c3
Update settings.py 2021-11-24 08:16:55 +01:00
Markus Viitamäki
f725796ac2 Passing branch to update_package()
Solves the problem where script dies when running it and having an existing 'repo' folder checked out.
2021-11-17 11:23:36 +01:00
minitriga
ed737e22ee
Merge pull request #33 from rsp2k/master
Add SLUGS option to specify a space-separated list of device_type slug…
2021-11-10 11:09:37 +00:00
minitriga
b2c20b2cc6
Merge branch 'master' into master 2021-11-10 11:09:30 +00:00
minitriga
eaf8f03dfd
Merge pull request #36 from dmcken/add-repo-branch-option
Add repo branch option
2021-11-10 11:07:53 +00:00
David Mc Ken
58be6126d6 Update README.md
Added documentation for REPO_BRANCH environment variable.
2021-10-31 18:14:09 -04:00
David Mc Ken
c0fbe76247 Update settings.py
Fixed quotes to be consistent with the rest of settings.py
2021-10-31 18:09:54 -04:00
David Mc Ken
46e71fdc62 Update .env.example
Added REPO_BRANCH default env variable.
2021-10-31 18:07:25 -04:00
David Mc Ken
bee2eb7776 Add branch support
Set default branch name of 'master' in settings.py and then checkout the branch as appropriate.
2021-10-31 17:54:46 -04:00
Ryan Malloy
8160b6c4aa Add SLUG option to specify a space-separated list of device_type slugs to import 2021-10-05 09:02:21 -06:00