From c5181c05024e6bb03caccf877b82004db8b7ac09 Mon Sep 17 00:00:00 2001 From: Norberto Arrieta Date: Mon, 2 Oct 2023 12:09:31 -0700 Subject: [PATCH] Fix for "local variable _COLLECT_NOEXEC_ERRORS referenced before assignment" (#2935) * Fix for "local variable _COLLECT_NOEXEC_ERRORS referenced before assignment" * pylint --------- Co-authored-by: narrieta --- azurelinuxagent/ga/extensionprocessutil.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azurelinuxagent/ga/extensionprocessutil.py b/azurelinuxagent/ga/extensionprocessutil.py index c24ebf1946..d2b37551ba 100644 --- a/azurelinuxagent/ga/extensionprocessutil.py +++ b/azurelinuxagent/ga/extensionprocessutil.py @@ -107,6 +107,10 @@ def _check_noexec(): """ Check if /var is mounted with the noexec flag. """ + # W0603: Using the global statement (global-statement) + # OK to disable; _COLLECT_NOEXEC_ERRORS is used only within _check_noexec, but needs to persist across calls. + global _COLLECT_NOEXEC_ERRORS # pylint: disable=W0603 + try: agent_dir = conf.get_lib_dir() with open('/proc/mounts', 'r') as f: