From 68a18b35d89a2ccf481d97b530a1ecfbc487eda3 Mon Sep 17 00:00:00 2001 From: Hans Krijger Date: Fri, 18 Nov 2016 15:54:19 -0800 Subject: [PATCH] Merge hotfix/2.2.0 back to master (#497) * Decide version hotfix (#493) * correct the check for installed version * add length check to remove_bom * update version to 2.2.1 --- azurelinuxagent/common/utils/textutil.py | 6 ++++-- azurelinuxagent/common/version.py | 2 +- azurelinuxagent/ga/exthandlers.py | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/azurelinuxagent/common/utils/textutil.py b/azurelinuxagent/common/utils/textutil.py index f60df26..d1aee4b 100644 --- a/azurelinuxagent/common/utils/textutil.py +++ b/azurelinuxagent/common/utils/textutil.py @@ -251,8 +251,10 @@ def set_ini_config(config, name, val): def remove_bom(c): - if str_to_ord(c[0]) > 128 and str_to_ord(c[1]) > 128 and \ - str_to_ord(c[2]) > 128: + if len(c) > 2 \ + and str_to_ord(c[0]) > 128 \ + and str_to_ord(c[1]) > 128 \ + and str_to_ord(c[2]) > 128: c = c[3:] return c diff --git a/azurelinuxagent/common/version.py b/azurelinuxagent/common/version.py index b57b8fd..6643bc2 100644 --- a/azurelinuxagent/common/version.py +++ b/azurelinuxagent/common/version.py @@ -56,7 +56,7 @@ def get_distro(): AGENT_NAME = "WALinuxAgent" AGENT_LONG_NAME = "Azure Linux Agent" -AGENT_VERSION = '2.2.0' +AGENT_VERSION = '2.2.1' AGENT_LONG_VERSION = "{0}-{1}".format(AGENT_NAME, AGENT_VERSION) AGENT_DESCRIPTION = """\ The Azure Linux Agent supports the provisioning and running of Linux diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py index dda122c..9d3e9d8 100644 --- a/azurelinuxagent/ga/exthandlers.py +++ b/azurelinuxagent/ga/exthandlers.py @@ -360,9 +360,10 @@ class ExtHandlerInstance(object): # Determine the desired and installed versions requested_version = FlexibleVersion(self.ext_handler.properties.version) - installed_version = FlexibleVersion(self.get_installed_version()) - if installed_version is None: - installed_version = requested_version + installed_version_string = self.get_installed_version() + installed_version = requested_version \ + if installed_version_string is None \ + else FlexibleVersion(installed_version_string) # Divide packages # - Find the installed package (its version must exactly match)