From bc2cdf2b237b53232fe3413408ded4fe91b431c3 Mon Sep 17 00:00:00 2001 From: William Pearson Date: Wed, 13 Sep 2017 15:56:00 -0700 Subject: [PATCH] Add explanatory comments for extension rolling upgrade --- azurelinuxagent/common/protocol/wire.py | 2 ++ azurelinuxagent/ga/exthandlers.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/azurelinuxagent/common/protocol/wire.py b/azurelinuxagent/common/protocol/wire.py index 100a3cf..0a0ef8b 100644 --- a/azurelinuxagent/common/protocol/wire.py +++ b/azurelinuxagent/common/protocol/wire.py @@ -1315,6 +1315,7 @@ class ExtensionsConfig(object): logger.verbose("Load ExtensionsConfig.xml") self.ext_handlers = ExtHandlerList() self.vmagent_manifests = VMAgentManifestList() + # Default the rolling upgrade flag to False self.rolling_upgrade = False self.status_upload_blob = None self.status_upload_blob_type = None @@ -1330,6 +1331,7 @@ class ExtensionsConfig(object): guest_agent = find(xml_doc, "GuestAgentExtension") ru_text = findtext(guest_agent, "ExtensionRollingUpgrade") + # The value of the flag defaults to False if ru_text and ru_text.lower() == "true": self.rolling_upgrade = True diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py index 3ca7a44..18e5b47 100644 --- a/azurelinuxagent/ga/exthandlers.py +++ b/azurelinuxagent/ga/exthandlers.py @@ -301,10 +301,14 @@ class ExtHandlersHandler(object): state = ext_handler.properties.state # Valid states are enabled, disabled and uninstall if state == u"enabled": + # Return early to skip upgrading if the rolling_upgrade + # flag is True and the upgrade GUID is NOT new if self.protocol.get_rolling_upgrade() and \ not self.is_new_guid(ext_handler): return elif state == u"disabled" or state == u"uninstall": + # Remove the GUID from the dictionary in this case so that + # it is upgraded upon re-enabling/re-install self.last_guids.pop(ext_handler.name, None) ext_handler_i.decide_version() if not ext_handler_i.is_upgrade and self.last_etag == etag: