From 67cd5973f75c1c5e480ff07c7305139b3595447d Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 3 May 2022 22:56:16 +1000 Subject: [PATCH] fixing __file__ issue for ubuntu --- ttp_templates/ttp_templates.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ttp_templates/ttp_templates.py b/ttp_templates/ttp_templates.py index f17be60..2091929 100644 --- a/ttp_templates/ttp_templates.py +++ b/ttp_templates/ttp_templates.py @@ -52,14 +52,7 @@ def get_template( else: return None - template_dir = os.path.abspath(os.path.dirname(__file__)) - - # Ubuntu returns path that looks like this when calling run_ttp for Netmiko: - # '/home/runner/work/ttp_templates/ttp_templates/ttp_templates' - # below code is to ensure we go two levels up and fix FileNotFoundError - if template_dir.count("/ttp_templates") == 3: - template_dir = os.path.dirname(os.path.dirname(template_dir)) - + template_dir = os.path.abspath(os.path.dirname(__file__)) template_filename = os.path.join(template_dir, path) # open template file and return content