From 369d0b0925a3082cf3e57a595293ea8a8ef7a973 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 2 Oct 2023 20:50:16 -0500 Subject: [PATCH] Make workdir independent --- deploy/portainer/deploy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/portainer/deploy.py b/deploy/portainer/deploy.py index 18be662..7a613e4 100644 --- a/deploy/portainer/deploy.py +++ b/deploy/portainer/deploy.py @@ -7,6 +7,7 @@ import requests import json from dotenv import load_dotenv from string import Template +from pathlib import Path load_dotenv() @@ -77,7 +78,8 @@ else: ### Template substitution for the portainer stack deployment ### portainer_deploy_json = None -with open('portainer_deploy.template.json', 'r') as file: +template_file = f'{Path( __file__ ).parent.absolute()}/portainer_deploy.template.json' +with open(template_file, 'r') as file: portainer_template = Template(file.read()) # Perform variable substitution