From 4c55410145efd2a23ff816fcdb806ae55e8b1c60 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 27 Jan 2016 17:00:33 -0500 Subject: [PATCH] Use relative path instead of absolute path for latest symlink This maintains the intended functionality while simultaneously allowing to copy or move the folder somewhere else. Otherwise, if I copy /var/tmp/packstack elsewhere, the symlink will keep pointing to /var/tmp/packstack. Change-Id: I7da0af24dbccb14d1f7fb1d75079ac109e981882 --- packstack/installer/basedefs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packstack/installer/basedefs.py b/packstack/installer/basedefs.py index ffada3a29..39b18e717 100644 --- a/packstack/installer/basedefs.py +++ b/packstack/installer/basedefs.py @@ -75,7 +75,10 @@ if os.path.exists(LATEST_LOG_DIR): print ('Unable to delete symbol link for log dir %s.' % LATEST_LOG_DIR) try: - os.symlink(DIR_LOG, LATEST_LOG_DIR) + # Extract folder name at /var/tmp/packstack/ and do a relative + # symlink to /var/tmp/packstack/latest + os.symlink(os.path.basename(VAR_DIR), + os.path.join(PACKSTACK_VAR_DIR, 'latest')) except OSError: print ('Unable to create symbol link for log dir %s.' % LATEST_LOG_DIR)