From 9f19fa55fe601584c04c0e69e1fed2a8caca9d61 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Mon, 7 Aug 2023 22:06:22 +0000 Subject: [PATCH] fix: Delete root-owned files when provisioning This should help avoid permissions errors for existing devstack users when they re-provision. Ticket: https://github.com/openedx/devstack/issues/1138 --- pavelib/prereqs.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pavelib/prereqs.py b/pavelib/prereqs.py index ebb49aeacb..21e50c9060 100644 --- a/pavelib/prereqs.py +++ b/pavelib/prereqs.py @@ -128,6 +128,23 @@ def node_prereqs_installation(): """ Configures npm and installs Node prerequisites """ + # Before July 2023, these directories were created and written to + # as root. Afterwards, they are created as being owned by the + # `app` user -- but also need to be deleted by that user (due to + # how npm runs post-install scripts.) Developers with an older + # devstack installation who are reprovisioning will see errors + # here if the files are still owned by root. Deleting the files in + # advance prevents this error. + # + # This hack should probably be left in place for at least a year. + # See ADR 17 for more background on the transition. + sh("rm -rf common/static/common/js/vendor/ common/static/common/css/vendor/") + # At the time of this writing, the js dir has git-versioned files + # but the css dir does not, so the latter would have been created + # as root-owned (in the process of creating the vendor + # subdirectory). Delete it only if empty, just in case + # git-versioned files are added later. + sh("rmdir common/static/common/css || true") # NPM installs hang sporadically. Log the installation process so that we # determine if any packages are chronic offenders.