diff --git a/gitcmd.py b/gitcmd.py index 0a6e05b7..c1924695 100644 --- a/gitcmd.py +++ b/gitcmd.py @@ -11,7 +11,7 @@ def __init__(self, args, repo_path): self.url = args.url self.repo_path = repo_path self.branch = args.branch - self.repo = Repo() +# self.repo = Repo() self.cwd = os.getcwd() if os.path.isdir(self.repo_path): @@ -43,4 +43,3 @@ def clone_repo(self): settings.handle.exception("GitCommandError", self.url, git_error) except Exception as git_error: settings.handle.exception("Exception", 'Git Repository Error', git_error) - diff --git a/nb-dt-import.py b/nb-dt-import.py index 7cfa93d0..7e55e171 100755 --- a/nb-dt-import.py +++ b/nb-dt-import.py @@ -53,7 +53,7 @@ def getFiles(vendors=None): files = [] discoveredVendors = [] - base_path = './repo/device-types/' + base_path = f'{settings.REPO_PATH}/device-types/' if vendors: for r, d, f in os.walk(base_path): for folder in d: @@ -88,7 +88,7 @@ def get_files_modules(vendors=None): files = [] discoveredVendors = [] - base_path = './repo/module-types/' + base_path = f'{settings.REPO_PATH}/module-types/' if vendors: for r, d, f in os.walk(base_path): for folder in d: diff --git a/settings.py b/settings.py index 4a4ef56b..22902a63 100644 --- a/settings.py +++ b/settings.py @@ -12,7 +12,7 @@ NETBOX_URL = os.getenv("NETBOX_URL") NETBOX_TOKEN = os.getenv("NETBOX_TOKEN") IGNORE_SSL_ERRORS = (os.getenv("IGNORE_SSL_ERRORS", default="False") == "True") -REPO_PATH = "./repo" +REPO_PATH = f"{os.path.dirname(os.path.realpath(__file__))}/repo" # optionally load vendors through a comma separated list as env var VENDORS = list(filter(None, os.getenv("VENDORS", "").split(",")))