From 47770b71b4965b1b302f02df91350839b7db24f9 Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Mon, 14 Mar 2022 15:34:30 -0700 Subject: [PATCH 1/2] Add keep_alive property to collect_logs (#2533) --- azurelinuxagent/common/interfaces.py | 9 +++++++++ azurelinuxagent/ga/collect_logs.py | 3 +++ azurelinuxagent/ga/update.py | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/azurelinuxagent/common/interfaces.py b/azurelinuxagent/common/interfaces.py index d6b0753bb9..41b16e6681 100644 --- a/azurelinuxagent/common/interfaces.py +++ b/azurelinuxagent/common/interfaces.py @@ -30,6 +30,15 @@ def get_thread_name(): def run(self): raise NotImplementedError("run() not implemented") + def keep_alive(self): + """ + Returns true if the thread handler should be restarted when the thread dies + and false when it should remain dead. + + Defaults to True and can be overridden by sub-classes. + """ + return True + def is_alive(self): raise NotImplementedError("is_alive() not implemented") diff --git a/azurelinuxagent/ga/collect_logs.py b/azurelinuxagent/ga/collect_logs.py index b26e260ca3..dc62fccf21 100644 --- a/azurelinuxagent/ga/collect_logs.py +++ b/azurelinuxagent/ga/collect_logs.py @@ -107,6 +107,9 @@ def __init__(self): def run(self): self.start() + def keep_alive(self): + return self.should_run + def is_alive(self): return self.event_thread.is_alive() diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py index cfac6f48c1..2b0e857b43 100644 --- a/azurelinuxagent/ga/update.py +++ b/azurelinuxagent/ga/update.py @@ -421,7 +421,7 @@ def _check_daemon_running(self, debug): def _check_threads_running(self, all_thread_handlers): # Check that all the threads are still running for thread_handler in all_thread_handlers: - if not thread_handler.is_alive(): + if thread_handler.keep_alive() and not thread_handler.is_alive(): logger.warn("{0} thread died, restarting".format(thread_handler.get_thread_name())) thread_handler.start() From fed399f394a925d08732588d2d5082e848feb2e6 Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Mon, 14 Mar 2022 16:18:44 -0700 Subject: [PATCH 2/2] Set agent version to 2.7.1.0. (#2534) --- azurelinuxagent/common/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurelinuxagent/common/version.py b/azurelinuxagent/common/version.py index 721cad6d7a..71dfe2937f 100644 --- a/azurelinuxagent/common/version.py +++ b/azurelinuxagent/common/version.py @@ -209,7 +209,7 @@ def has_logrotate(): # # When doing a release, be sure to use the actual agent version. # -AGENT_VERSION = '2.7.0.6' +AGENT_VERSION = '2.7.1.0' AGENT_LONG_VERSION = "{0}-{1}".format(AGENT_NAME, AGENT_VERSION) AGENT_DESCRIPTION = """ The Azure Linux Agent supports the provisioning and running of Linux