From 7024eb6faeff17a349678aaa928a254913f518e9 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 21 May 2023 00:28:38 +0200 Subject: [PATCH] Refine Vagrantfile location Read from script directory if run from Git checkout and from /usr/share/ if run from a packaged installation. Signed-off-by: Georg Pfuetzenreuter --- scullery.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scullery.py b/scullery.py index c656f26..e1d569d 100755 --- a/scullery.py +++ b/scullery.py @@ -40,6 +40,14 @@ vmprefix = 'scullery' cwd = os.getcwd() sshfile='{}/.scullery_ssh'.format(cwd) envfile='{}/.scullery_env'.format(cwd) +vagfile='Vagrantfile-Template' + +# replaced in scullery.spec +is_packaged = False +if is_packaged: + vagfile='/usr/share/scullery/{}'.format(vagfile) +else: + vagfile='{}/{}'.format(os.path.abspath(os.path.dirname(__file__)), vagfile) def _abort(msg): log.error(msg) @@ -163,7 +171,7 @@ def main_interactive(): _abort('Suite referencs an undefined box') box_name = boxconf.get('name', None) box_image = boxconf.get('image', None) - box_file = boxconf.get('file', '{}/Vagrantfile-Template'.format(os.path.abspath(os.path.dirname(__file__)))) + box_file = boxconf.get('file', vagfile) if None in [box_name, box_image, box_file]: _abort('Box configuration is incomplete') box_bootstrap = boxconf.get('bootstrap', None)