Skip to content

Commit

Permalink
fixing __file__ issue for ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulyalin committed May 3, 2022
1 parent 6f0a77d commit 67cd597
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions ttp_templates/ttp_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 67cd597

Please sign in to comment.