Commit Graph

43 Commits

Author SHA1 Message Date
J vanBemmel
0f79f452c4
Fix image upload v2 (#91)
* Add upload_image functionality to new beta script

* Updated for new location of files with Boolean flag for front/rear image
2023-03-28 09:37:50 -04:00
Daniel W. Anner
98857fc649
Beta Release Merge (#87)
* 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 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

* added back executable on file (#79)

* Add more info to failed device_type creations (#81)

---------

Co-authored-by: Philipp Rintz <13933258+p-rintz@users.noreply.github.com>
2023-03-24 15:13:38 -04: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
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
minitriga
9f20f76650
Merge pull request #39 from suom1/patch-1
Passing branch to update_package()
2021-11-24 09:46:47 +00:00
Flo
12572c9d7d
Update nb-dt-import.py 2021-11-24 08:36:44 +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
b2c20b2cc6
Merge branch 'master' into master 2021-11-10 11:09:30 +00: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
rsp2k
85b868c12e
Import all YAML files
Add list of YAML extensions. The netbox device type library excepts both *.yaml and *.yml files
2021-10-02 10:07:38 -06:00
minitriga
17e2bf9c50
Merge pull request #30 from dalrrard/add-ssl-verify-setting
Added IGNORE_SSL_ERRORS option
2021-09-07 05:24:42 -04:00
Dalton Rardin
269d5abb48 Added IGNORE_SSL_ERRORS option to settings and .env and refactored a few things 2021-08-25 11:57:38 -05:00
Dalton Rardin
3f09512256 Refactored import functions to use bulk POSTs and list GETs instead of individual ones 2021-08-25 09:52:50 -05:00
k0rventen
315dce530b add vendors as an env var 2021-05-16 14:46:09 +02:00
lordwolf2004
91e78f36e7
Update nb-dt-import.py
fixed AttributeError when using --vendors switch
2021-03-20 19:22:35 -05:00
minitriga
5cb2b033a3
Merge pull request #15 from FlorianHeigl/patch-2
match 'vendors' arg between docs and code
2021-03-19 09:04:59 +00:00
ndom91
ef4c0fa515 add: script timer + devicetype library repo url to .env 2021-02-27 01:02:03 +01:00
ndom91
f8a078220c update: README and added dotenv other small stuff 2021-02-26 23:26:32 +01:00
Florian Heigl
17cc30f6a3
match 'vendors' arg between docs and code
the arg was called vendor (singular), while most of the code and the readme mentioned 'vendors' (plural) and the arg in fact supports multiple vendors.
2021-02-09 02:26:59 +01:00
mayafox
73b605275b pep8 formatting and fix for vendors with spaces in names 2020-12-11 10:37:00 -08:00
Mark Tinberg
d57b93faae Strip invalid spaces from Manufacturer slug generation 2020-11-13 09:36:53 -06:00
Mark Tinberg
a78df75074 Switch early return so readYAML can continue with other files 2020-11-12 13:44:11 -06:00
Mark Tinberg
00e9b3d73f Update output messages with git remote and local path
so it's clear what data is being used
if a non-default git url is specified
2020-11-12 13:38:48 -06:00
Mark Tinberg
2188ac7a62 Return empty deviceTypes in readYAML on error
instead of continuing with uninitilized data
2020-11-12 13:22:35 -06:00
Mark Tinberg
54907aaffb Add CLI options for git URL
help text to CLI options
2020-11-12 13:20:21 -06:00
ndom91
16b922b383 fix: create poweroutlet with unambiguous powerport 2020-10-10 21:12:53 +02:00
ndom91
c6bc1fbbc8 add: fix for missing powerport when multiple are available i.e. AP7721 template 2020-10-10 21:02:56 +02:00
ndom91
408b342613 add: update counters 2020-10-08 22:28:12 +02:00
Nico Domino
de5b4cef77
Update power-port/power-ports check 2020-07-28 15:21:58 +02:00
Alexander GITTINGS
7b81c3b0cd add readme and update some bits 2020-02-26 14:49:12 +00:00
Alexander GITTINGS
cd8439127d update 2020-02-26 14:07:07 +00:00
Alex Gittings
da363c5b37 Init 2020-02-20 13:59:59 +00:00