1717 module_port_added = 0 ,
1818 )
1919
20- def get_files_modules (vendors = None ):
21- '''Get files list for modules.
22-
23- Args:
24- vendors: List of vendors to sync or None to sync all vendors.
25-
26- Returns:
27- A 2-tuple of:
28- - list of filenames found
29- - list of vendors found
30-
31- '''
32-
33- files = []
34- discoveredVendors = []
35- base_path = './repo/module-types/'
36- if vendors :
37- for r , d , f in os .walk (base_path ):
38- for folder in d :
39- for vendor in vendors :
40- if vendor .lower () == folder .lower ():
41- discoveredVendors .append ({'name' : folder ,
42- 'slug' : settings .dtl_repo .slug_format (folder )})
43- for extension in settings .dtl_repo .yaml_extensions :
44- files .extend (
45- glob (
46- base_path + folder + f'/*.{ extension } '
47- )
48- )
49- else :
50- for r , d , f in os .walk (base_path ):
51- for folder in d :
52- if folder .lower () != "Testing" :
53- discoveredVendors .append ({'name' : folder ,
54- 'slug' : settings .dtl_repo .slug_format (folder )})
55- for extension in settings .dtl_repo .yaml_extensions :
56- files .extend (glob (base_path + f'[!Testing]*/*.{ extension } ' ))
57-
58- return files , discoveredVendors
5920
6021def read_yaml_modules (files , ** kwargs ):
6122
@@ -662,7 +623,7 @@ def main():
662623
663624 netbox = NetBox (settings )
664625 nb = netbox .get_api ()
665- files , vendors = settings .dtl_repo .get_devices ('./repo /device-types/' , args .vendors )
626+ files , vendors = settings .dtl_repo .get_devices (f' { settings . dtl_repo . repo_path } /device-types/' , args .vendors )
666627
667628 settings .handle .log (f'{ len (vendors )} Vendors Found' )
668629 device_types = settings .dtl_repo .parse_files (files , slugs = args .slugs )
@@ -672,7 +633,7 @@ def main():
672633
673634 if netbox .modules :
674635 settings .handle .log ("Modules Enabled. Creating Modules..." )
675- files , vendors = settings .dtl_repo .get_devices ('./repo /module-types/' , args .vendors )
636+ files , vendors = settings .dtl_repo .get_devices (f' { settings . dtl_repo . repo_path } /module-types/' , args .vendors )
676637 settings .handle .log (f'{ len (vendors )} Module Vendors Found' )
677638 module_types = settings .dtl_repo .parse_files (files , slugs = args .slugs )
678639 settings .handle .log (f'{ len (module_types )} Module-Types Found' )
0 commit comments